OLD | NEW |
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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 { | 215 { |
216 data = std::make_shared<SharedData>(); | 216 data = std::make_shared<SharedData>(); |
217 BaseJsTest::SetUp(); | 217 BaseJsTest::SetUp(); |
218 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem())); | 218 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new LazyFileSystem())); |
219 jsEngine->SetWebRequest(webRequest = std::make_shared<MockWebRequest>()); | 219 jsEngine->SetWebRequest(webRequest = std::make_shared<MockWebRequest>()); |
220 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem())); | 220 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new LazyLogSystem())); |
221 | 221 |
222 subscriptionUrlPrefix = "http://example"; | 222 subscriptionUrlPrefix = "http://example"; |
223 ServerResponse exampleSubscriptionResponse; | 223 ServerResponse exampleSubscriptionResponse; |
224 exampleSubscriptionResponse.responseStatus = 200; | 224 exampleSubscriptionResponse.responseStatus = 200; |
225 exampleSubscriptionResponse.status = WebRequest::NS_OK; | 225 exampleSubscriptionResponse.status = IWebRequest::NS_OK; |
226 exampleSubscriptionResponse.responseText = "[Adblock Plus 2.0]\n||example.
com"; | 226 exampleSubscriptionResponse.responseText = "[Adblock Plus 2.0]\n||example.
com"; |
227 webRequest->responses.emplace(subscriptionUrlPrefix, exampleSubscriptionRe
sponse); | 227 webRequest->responses.emplace(subscriptionUrlPrefix, exampleSubscriptionRe
sponse); |
228 createParams.preconfiguredPrefs.emplace("first_run_subscription_auto_selec
t", jsEngine->NewValue(false)); | 228 createParams.preconfiguredPrefs.emplace("first_run_subscription_auto_selec
t", jsEngine->NewValue(false)); |
229 data->isConnectionAllowed = true; | 229 data->isConnectionAllowed = true; |
230 auto closure = data; | 230 auto closure = data; |
231 createParams.isConnectionAllowedCallback = [closure](const std::string* al
lowedConnectionType)->bool{ | 231 createParams.isConnectionAllowedCallback = [closure](const std::string* al
lowedConnectionType)->bool{ |
232 closure->capturedConnectionTypes.Add(allowedConnectionType); | 232 closure->capturedConnectionTypes.Add(allowedConnectionType); |
233 return closure->isConnectionAllowed; | 233 return closure->isConnectionAllowed; |
234 }; | 234 }; |
235 } | 235 } |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 filterEngine->SetAllowedConnectionType(&testConnection); | 1131 filterEngine->SetAllowedConnectionType(&testConnection); |
1132 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); | 1132 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); |
1133 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr
ing()); | 1133 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr
ing()); |
1134 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size()); | 1134 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size()); |
1135 auto capturedConnectionTypes = data->capturedConnectionTypes.GetStrings(); | 1135 auto capturedConnectionTypes = data->capturedConnectionTypes.GetStrings(); |
1136 ASSERT_EQ(1u, capturedConnectionTypes.size()); | 1136 ASSERT_EQ(1u, capturedConnectionTypes.size()); |
1137 EXPECT_TRUE(capturedConnectionTypes[0].first); | 1137 EXPECT_TRUE(capturedConnectionTypes[0].first); |
1138 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); | 1138 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); |
1139 } | 1139 } |
1140 } | 1140 } |
OLD | NEW |