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

Side by Side Diff: test/Notification.cpp

Issue 29508555: Issue 5450 - move FilterEngine into Platform (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created Aug. 7, 2017, 8:28 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 22 matching lines...) Expand all
33 std::unique_ptr<Platform> platform; 33 std::unique_ptr<Platform> platform;
34 FilterEnginePtr filterEngine; 34 FilterEnginePtr filterEngine;
35 void SetUp() 35 void SetUp()
36 { 36 {
37 LazyFileSystem* fileSystem; 37 LazyFileSystem* fileSystem;
38 ThrowingPlatformCreationParameters platformParams; 38 ThrowingPlatformCreationParameters platformParams;
39 platformParams.timer.reset(new NoopTimer()); 39 platformParams.timer.reset(new NoopTimer());
40 platformParams.fileSystem.reset(fileSystem = new LazyFileSystem()); 40 platformParams.fileSystem.reset(fileSystem = new LazyFileSystem());
41 platformParams.webRequest.reset(new NoopWebRequest()); 41 platformParams.webRequest.reset(new NoopWebRequest());
42 platform.reset(new Platform(std::move(platformParams))); 42 platform.reset(new Platform(std::move(platformParams)));
43 filterEngine = CreateFilterEngine(*fileSystem, platform->GetJsEngine()); 43 filterEngine = CreateFilterEngine(*fileSystem, *platform);
44 } 44 }
45 45
46 void AddNotification(const std::string& notification) 46 void AddNotification(const std::string& notification)
47 { 47 {
48 filterEngine->GetJsEngine()->Evaluate("(function()" 48 filterEngine->GetJsEngine()->Evaluate("(function()"
49 "{" 49 "{"
50 "require('notification').Notification.addNotification(" + notification + ");" 50 "require('notification').Notification.addNotification(" + notification + ");"
51 "})();"); 51 "})();");
52 } 52 }
53 53
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 TEST_F(NotificationTest, Links) 197 TEST_F(NotificationTest, Links)
198 { 198 {
199 AddNotification("{ id: 'id', links: ['link1', 'link2'] }"); 199 AddNotification("{ id: 'id', links: ['link1', 'link2'] }");
200 auto notification = PeekNotification(); 200 auto notification = PeekNotification();
201 ASSERT_TRUE(notification); 201 ASSERT_TRUE(notification);
202 std::vector<std::string> notificationLinks = notification->GetLinks(); 202 std::vector<std::string> notificationLinks = notification->GetLinks();
203 ASSERT_EQ(2u, notificationLinks.size()); 203 ASSERT_EQ(2u, notificationLinks.size());
204 EXPECT_EQ("link1", notificationLinks[0]); 204 EXPECT_EQ("link1", notificationLinks[0]);
205 EXPECT_EQ("link2", notificationLinks[1]); 205 EXPECT_EQ("link2", notificationLinks[1]);
206 } 206 }
OLDNEW
« test/BaseJsTest.cpp ('K') | « test/FilterEngine.cpp ('k') | test/Prefs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld