Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: test/Notification.cpp

Issue 4847491308584960: Noissue - Fix Android build (Closed)
Patch Set: Created Feb. 26, 2015, 1:49 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 13 matching lines...) Expand all
24 //#define NotificationMockWebRequestTest_ENABLED 24 //#define NotificationMockWebRequestTest_ENABLED
25 25
26 namespace 26 namespace
27 { 27 {
28 typedef std::tr1::shared_ptr<FilterEngine> FilterEnginePtr; 28 typedef std::tr1::shared_ptr<FilterEngine> FilterEnginePtr;
29 29
30 class NotificationTest : public BaseJsTest 30 class NotificationTest : public BaseJsTest
31 { 31 {
32 protected: 32 protected:
33 FilterEnginePtr filterEngine; 33 FilterEnginePtr filterEngine;
34 void SetUp() override 34 void SetUp()
35 { 35 {
36 BaseJsTest::SetUp(); 36 BaseJsTest::SetUp();
37 jsEngine->SetFileSystem(FileSystemPtr(new LazyFileSystem())); 37 jsEngine->SetFileSystem(FileSystemPtr(new LazyFileSystem()));
38 jsEngine->SetWebRequest(WebRequestPtr(new LazyWebRequest())); 38 jsEngine->SetWebRequest(WebRequestPtr(new LazyWebRequest()));
39 jsEngine->SetLogSystem(LogSystemPtr(new DefaultLogSystem())); 39 jsEngine->SetLogSystem(LogSystemPtr(new DefaultLogSystem()));
40 filterEngine.reset(new FilterEngine(jsEngine)); 40 filterEngine.reset(new FilterEngine(jsEngine));
41 } 41 }
42 42
43 void AddNotification(const std::string& notification) 43 void AddNotification(const std::string& notification)
44 { 44 {
(...skipping 25 matching lines...) Expand all
70 serverResponse.responseText = responseText; 70 serverResponse.responseText = responseText;
71 return serverResponse; 71 return serverResponse;
72 } 72 }
73 }; 73 };
74 74
75 #ifdef NotificationMockWebRequestTest_ENABLED 75 #ifdef NotificationMockWebRequestTest_ENABLED
76 class NotificationMockWebRequestTest : public BaseJsTest 76 class NotificationMockWebRequestTest : public BaseJsTest
77 { 77 {
78 protected: 78 protected:
79 FilterEnginePtr filterEngine; 79 FilterEnginePtr filterEngine;
80 void SetUp() override 80 void SetUp()
81 { 81 {
82 BaseJsTest::SetUp(); 82 BaseJsTest::SetUp();
83 jsEngine->SetFileSystem( 83 jsEngine->SetFileSystem(
84 std::tr1::shared_ptr<LazyFileSystem>(new LazyFileSystem())); 84 std::tr1::shared_ptr<LazyFileSystem>(new LazyFileSystem()));
85 const char* responseJsonText = "{" 85 const char* responseJsonText = "{"
86 "\"notifications\": [{" 86 "\"notifications\": [{"
87 "\"id\": \"some id\"," 87 "\"id\": \"some id\","
88 "\"type\": \"information\"," 88 "\"type\": \"information\","
89 "\"message\": {" 89 "\"message\": {"
90 "\"en-US\": \"message\"" 90 "\"en-US\": \"message\""
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 TEST_F(NotificationTest, Links) 182 TEST_F(NotificationTest, Links)
183 { 183 {
184 AddNotification("{ id: 'id', links: ['link1', 'link2'] }"); 184 AddNotification("{ id: 'id', links: ['link1', 'link2'] }");
185 NotificationPtr notification = filterEngine->GetNextNotificationToShow(); 185 NotificationPtr notification = filterEngine->GetNextNotificationToShow();
186 ASSERT_TRUE(notification); 186 ASSERT_TRUE(notification);
187 std::vector<std::string> notificationLinks = notification->GetLinks(); 187 std::vector<std::string> notificationLinks = notification->GetLinks();
188 ASSERT_EQ(2, notificationLinks.size()); 188 ASSERT_EQ(2, notificationLinks.size());
189 EXPECT_EQ("link1", notificationLinks[0]); 189 EXPECT_EQ("link1", notificationLinks[0]);
190 EXPECT_EQ("link2", notificationLinks[1]); 190 EXPECT_EQ("link2", notificationLinks[1]);
191 } 191 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld