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

Delta Between Two Patch Sets: test/Notification.cpp

Issue 29525558: Issue 5506 - Fix notification test (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Review comments addressed. Created Aug. 23, 2017, 7:21 p.m.
Right Patch Set: addressed review comment Created Aug. 23, 2017, 7:53 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 return; 73 return;
74 } 74 }
75 ServerResponse serverResponse; 75 ServerResponse serverResponse;
76 serverResponse.status = IWebRequest::NS_OK; 76 serverResponse.status = IWebRequest::NS_OK;
77 serverResponse.responseStatus = 200; 77 serverResponse.responseStatus = 200;
78 serverResponse.responseText = responseText; 78 serverResponse.responseText = responseText;
79 getCallback(serverResponse); 79 getCallback(serverResponse);
80 } 80 }
81 }; 81 };
82 82
83
84 // To run this test one needs to set INITIAL_DELAY to about 2000 msec
85 // in notification.js.
83 class NotificationMockWebRequestTest : public BaseJsTest 86 class NotificationMockWebRequestTest : public BaseJsTest
84 { 87 {
85 protected: 88 protected:
86 bool isNotificationCallbackCalled; 89 bool isNotificationCallbackCalled;
87 void SetUp() 90 void SetUp()
88 { 91 {
89 isNotificationCallbackCalled = false; 92 isNotificationCallbackCalled = false;
90 const char* responseJsonText = "{" 93 const char* responseJsonText = "{"
91 "\"notifications\": [{" 94 "\"notifications\": [{"
92 "\"id\": \"some id\"," 95 "\"id\": \"some id\","
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 TEST_F(NotificationTest, Links) 188 TEST_F(NotificationTest, Links)
186 { 189 {
187 AddNotification("{ id: 'id', links: ['link1', 'link2'] }"); 190 AddNotification("{ id: 'id', links: ['link1', 'link2'] }");
188 auto notification = PeekNotification(); 191 auto notification = PeekNotification();
189 ASSERT_TRUE(notification); 192 ASSERT_TRUE(notification);
190 std::vector<std::string> notificationLinks = notification->GetLinks(); 193 std::vector<std::string> notificationLinks = notification->GetLinks();
191 ASSERT_EQ(2u, notificationLinks.size()); 194 ASSERT_EQ(2u, notificationLinks.size());
192 EXPECT_EQ("link1", notificationLinks[0]); 195 EXPECT_EQ("link1", notificationLinks[0]);
193 EXPECT_EQ("link2", notificationLinks[1]); 196 EXPECT_EQ("link2", notificationLinks[1]);
194 } 197 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld