-
Notifications
You must be signed in to change notification settings - Fork 389
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
185 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Tests/L1Tests/patches/0001-Add-IAnalytics-interface-R2.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
From 9a2398b7bc356f341e25c414e45b6919df135d58 Mon Sep 17 00:00:00 2001 | ||
From: Adrian Muzyka <adrian.muzyka@consult.red> | ||
Date: Thu, 19 Sep 2024 12:34:27 +0200 | ||
Subject: [PATCH] Add IAnalytics interface R2 | ||
|
||
--- | ||
interfaces/IAnalytics.h | 27 +++++++++++++++++++++++++++ | ||
interfaces/Ids.h | 1 + | ||
2 files changed, 28 insertions(+) | ||
create mode 100644 interfaces/IAnalytics.h | ||
|
||
diff --git a/interfaces/IAnalytics.h b/interfaces/IAnalytics.h | ||
new file mode 100644 | ||
index 0000000..19f5a3a | ||
--- /dev/null | ||
+++ b/interfaces/IAnalytics.h | ||
@@ -0,0 +1,27 @@ | ||
+#pragma once | ||
+ | ||
+#include "Module.h" | ||
+ | ||
+// @stubgen:include <com/IRPCIterator.h> | ||
+ | ||
+namespace WPEFramework { | ||
+namespace Exchange { | ||
+ | ||
+ struct EXTERNAL IAnalytics : virtual public Core::IUnknown { | ||
+ enum { ID = ID_ANALYTICS }; | ||
+ | ||
+ virtual ~IAnalytics() override = default; | ||
+ | ||
+ virtual uint32_t SendEvent(const string& eventName /* @in */, | ||
+ const string& eventVersion /* @in */, | ||
+ const string& eventSource /* @in */, | ||
+ const string& eventSourceVersion /* @in */, | ||
+ RPC::IStringIterator* const& cetList /* @in */, | ||
+ const uint64_t& epochTimestamp /* @in */, | ||
+ const uint64_t& uptimeTimestamp /* @in */, | ||
+ const string& eventPayload /* @in */ ) = 0; | ||
+ virtual uint32_t SetSessionId(const string& id /* @in */) = 0; | ||
+ virtual uint32_t SetTimeReady() = 0; | ||
+ }; | ||
+} | ||
+} | ||
diff --git a/interfaces/Ids.h b/interfaces/Ids.h | ||
index 7ef9a42..fa5c1dd 100644 | ||
--- a/interfaces/Ids.h | ||
+++ b/interfaces/Ids.h | ||
@@ -288,6 +288,7 @@ namespace Exchange { | ||
ID_DTV_TRANSPORT, | ||
ID_TEXT_TO_SPEECH, | ||
ID_TEXT_TO_SPEECH_NOTIFICATION, | ||
+ ID_ANALYTICS, | ||
|
||
}; | ||
} | ||
-- | ||
2.25.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "Analytics.h" | ||
|
||
using namespace WPEFramework; | ||
|
||
class AnalyticsTest : public ::testing::Test { | ||
protected: | ||
Core::ProxyType<Plugin::Analytics> plugin; | ||
Core::JSONRPC::Handler& handler; | ||
Core::JSONRPC::Connection connection; | ||
string response; | ||
|
||
AnalyticsTest() | ||
: plugin(Core::ProxyType<Plugin::Analytics>::Create()) | ||
, handler(*(plugin)) | ||
, connection(1, 0) | ||
{ | ||
} | ||
virtual ~AnalyticsTest() = default; | ||
}; | ||
|
||
TEST_F(AnalyticsTest, RegisteredMethods) | ||
{ | ||
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("sendEvent"))); | ||
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("setSessionId"))); | ||
EXPECT_EQ(Core::ERROR_NONE, handler.Exists(_T("setTimeReady"))); | ||
} | ||
|
||
TEST_F(AnalyticsTest, sendEvent) | ||
{ | ||
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("sendEvent"), _T("{\"eventName\":\"tile_impression\", \"eventVersion\":\"1\", \"eventSource\":\"ImmerseUI\", \"eventSourceVersion\":\"1.2\", \"cetList\":[\"cet1\",\"cet2\",\"cet3\"], \"eventPayload\": { \"event_trigger\": \"user_key_select\"}}"), response)); | ||
EXPECT_EQ(response, string("{\"success\":true}")); | ||
} | ||
|
||
TEST_F(AnalyticsTest, setSessionId) | ||
{ | ||
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setSessionId"), _T("{\"sessionId\":\"123456789\"}"), response)); | ||
EXPECT_EQ(response, string("{\"success\":true}")); | ||
} | ||
|
||
TEST_F(AnalyticsTest, setTimeReady) | ||
{ | ||
EXPECT_EQ(Core::ERROR_NONE, handler.Invoke(connection, _T("setTimeReady"), _T("{}"), response)); | ||
EXPECT_EQ(response, string("{\"success\":true}")); | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters