| Left: | ||
| Right: |
| 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-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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 719 documentUrls1)); | 719 documentUrls1)); |
| 720 } | 720 } |
| 721 | 721 |
| 722 TEST_F(FilterEngineWithFreshFolder, LangAndAASubscriptionsAreChosenOnFirstRun) | 722 TEST_F(FilterEngineWithFreshFolder, LangAndAASubscriptionsAreChosenOnFirstRun) |
| 723 { | 723 { |
| 724 AppInfo appInfo; | 724 AppInfo appInfo; |
| 725 appInfo.locale = "zh"; | 725 appInfo.locale = "zh"; |
| 726 const std::string langSubscriptionUrl = "https://easylist-downloads.adblockplu s.org/easylistchina+easylist.txt"; | 726 const std::string langSubscriptionUrl = "https://easylist-downloads.adblockplu s.org/easylistchina+easylist.txt"; |
| 727 auto jsEngine = createJsEngine(appInfo); | 727 auto jsEngine = createJsEngine(appInfo); |
| 728 auto filterEngine = AdblockPlus::FilterEngine::Create(jsEngine); | 728 auto filterEngine = AdblockPlus::FilterEngine::Create(jsEngine); |
| 729 auto subscriptions = filterEngine->GetListedSubscriptions(); | 729 const auto subscriptions = filterEngine->GetListedSubscriptions(); |
| 730 ASSERT_EQ(2u, subscriptions.size()); | 730 ASSERT_EQ(2u, subscriptions.size()); |
| 731 std::unique_ptr<Subscription> aaSubscription; | 731 std::unique_ptr<Subscription> aaSubscription; |
| 732 std::unique_ptr<Subscription> langSubscription; | 732 std::unique_ptr<Subscription> langSubscription; |
| 733 if (subscriptions[0].IsAA()) | 733 if (subscriptions[0].IsAA()) |
| 734 { | 734 { |
| 735 aaSubscription.reset(new Subscription(std::move(subscriptions[0]))); | 735 aaSubscription.reset(new Subscription(subscriptions[0])); |
|
sergei
2017/04/24 14:12:36
I would not expect that android code is never copy
hub
2017/04/24 15:02:42
Done.
| |
| 736 langSubscription.reset(new Subscription(std::move(subscriptions[1]))); | 736 langSubscription.reset(new Subscription(subscriptions[1])); |
| 737 } | 737 } |
| 738 else if (subscriptions[1].IsAA()) | 738 else if (subscriptions[1].IsAA()) |
| 739 { | 739 { |
| 740 aaSubscription.reset(new Subscription(std::move(subscriptions[1]))); | 740 aaSubscription.reset(new Subscription(subscriptions[1])); |
| 741 langSubscription.reset(new Subscription(std::move(subscriptions[0]))); | 741 langSubscription.reset(new Subscription(subscriptions[0])); |
| 742 } | 742 } |
| 743 ASSERT_NE(nullptr, aaSubscription); | 743 ASSERT_NE(nullptr, aaSubscription); |
| 744 ASSERT_NE(nullptr, langSubscription); | 744 ASSERT_NE(nullptr, langSubscription); |
| 745 EXPECT_EQ(langSubscriptionUrl, langSubscription->GetProperty("url").AsString() ); | 745 EXPECT_EQ(langSubscriptionUrl, langSubscription->GetProperty("url").AsString() ); |
| 746 EXPECT_TRUE(filterEngine->IsAAEnabled()); | 746 EXPECT_TRUE(filterEngine->IsAAEnabled()); |
| 747 } | 747 } |
| 748 | 748 |
| 749 TEST_F(FilterEngineWithFreshFolder, DisableSubscriptionsAutoSelectOnFirstRun) | 749 TEST_F(FilterEngineWithFreshFolder, DisableSubscriptionsAutoSelectOnFirstRun) |
| 750 { | 750 { |
| 751 auto jsEngine = createJsEngine(); | 751 auto jsEngine = createJsEngine(); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1088 filterEngine->SetAllowedConnectionType(&testConnection); | 1088 filterEngine->SetAllowedConnectionType(&testConnection); |
| 1089 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); | 1089 auto subscription = EnsureExampleSubscriptionAndForceUpdate("subB"); |
| 1090 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr ing()); | 1090 EXPECT_EQ("synchronize_ok", subscription.GetProperty("downloadStatus").AsStr ing()); |
| 1091 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size()); | 1091 EXPECT_EQ(1u, subscription.GetProperty("filters").AsList().size()); |
| 1092 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings(); | 1092 auto capturedConnectionTypes = this->capturedConnectionTypes.GetStrings(); |
| 1093 ASSERT_EQ(1u, capturedConnectionTypes.size()); | 1093 ASSERT_EQ(1u, capturedConnectionTypes.size()); |
| 1094 EXPECT_TRUE(capturedConnectionTypes[0].first); | 1094 EXPECT_TRUE(capturedConnectionTypes[0].first); |
| 1095 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); | 1095 EXPECT_EQ(testConnection, capturedConnectionTypes[0].second); |
| 1096 } | 1096 } |
| 1097 } | 1097 } |
| LEFT | RIGHT |