OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/offline_pages/offline_page_model_impl.h" | 5 #include "components/offline_pages/offline_page_model_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1106 base::FeatureList::ClearInstanceForTesting(); | 1106 base::FeatureList::ClearInstanceForTesting(); |
1107 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList); | 1107 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList); |
1108 feature_list2->InitializeFromCommandLine( | 1108 feature_list2->InitializeFromCommandLine( |
1109 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," + | 1109 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," + |
1110 offline_pages::kOfflinePagesBackgroundLoadingFeature.name, | 1110 offline_pages::kOfflinePagesBackgroundLoadingFeature.name, |
1111 ""); | 1111 ""); |
1112 base::FeatureList::SetInstance(std::move(feature_list2)); | 1112 base::FeatureList::SetInstance(std::move(feature_list2)); |
1113 EXPECT_TRUE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); | 1113 EXPECT_TRUE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); |
1114 } | 1114 } |
1115 | 1115 |
| 1116 TEST(CommandLineFlagsTest, OfflinePagesSharing) { |
| 1117 // Enable offline bookmarks feature first. |
| 1118 // TODO(dimich): once offline pages are enabled by default, remove this. |
| 1119 base::FeatureList::ClearInstanceForTesting(); |
| 1120 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 1121 feature_list->InitializeFromCommandLine( |
| 1122 offline_pages::kOfflineBookmarksFeature.name, ""); |
| 1123 base::FeatureList::SetInstance(std::move(feature_list)); |
| 1124 |
| 1125 // This feature is still disabled by default. |
| 1126 EXPECT_FALSE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1127 |
| 1128 // Check if feature is correctly enabled by command-line flag. |
| 1129 base::FeatureList::ClearInstanceForTesting(); |
| 1130 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList); |
| 1131 feature_list2->InitializeFromCommandLine( |
| 1132 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," + |
| 1133 offline_pages::kOfflinePagesSharingFeature.name, |
| 1134 ""); |
| 1135 base::FeatureList::SetInstance(std::move(feature_list2)); |
| 1136 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1137 } |
| 1138 |
1116 } // namespace offline_pages | 1139 } // namespace offline_pages |
OLD | NEW |