| LEFT | RIGHT |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| LEFT | RIGHT |