| 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 | 1206 |
| 1207 // Check if feature is correctly enabled by command-line flag. | 1207 // Check if feature is correctly enabled by command-line flag. |
| 1208 scoped_feature_list.reset(new base::test::ScopedFeatureList); | 1208 scoped_feature_list.reset(new base::test::ScopedFeatureList); |
| 1209 scoped_feature_list->InitFromCommandLine( | 1209 scoped_feature_list->InitFromCommandLine( |
| 1210 std::string(kOfflineBookmarksFeature.name) + "," + | 1210 std::string(kOfflineBookmarksFeature.name) + "," + |
| 1211 kOffliningRecentPagesFeature.name, | 1211 kOffliningRecentPagesFeature.name, |
| 1212 ""); | 1212 ""); |
| 1213 EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled()); | 1213 EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled()); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 TEST(CommandLineFlagsTest, OfflinePagesBackgroundLoading) { | |
| 1217 // Enable offline bookmarks feature first. | |
| 1218 // TODO(dimich): once offline pages are enabled by default, remove this. | |
| 1219 std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list( | |
| 1220 new base::test::ScopedFeatureList); | |
| 1221 scoped_feature_list->InitAndEnableFeature(kOfflineBookmarksFeature); | |
| 1222 | |
| 1223 // This feature is still disabled by default. | |
| 1224 EXPECT_FALSE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); | |
| 1225 | |
| 1226 // Check if feature is correctly enabled by command-line flag. | |
| 1227 scoped_feature_list.reset(new base::test::ScopedFeatureList); | |
| 1228 scoped_feature_list->InitFromCommandLine( | |
| 1229 std::string(kOfflineBookmarksFeature.name) + "," + | |
| 1230 kOfflinePagesBackgroundLoadingFeature.name, | |
| 1231 ""); | |
| 1232 EXPECT_TRUE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); | |
| 1233 } | |
| 1234 | |
| 1235 TEST(CommandLineFlagsTest, OfflinePagesSharing) { | 1216 TEST(CommandLineFlagsTest, OfflinePagesSharing) { |
| 1236 // Enable offline bookmarks feature first. | 1217 // Enable offline bookmarks feature first. |
| 1237 // TODO(dimich): once offline pages are enabled by default, remove this. | 1218 // TODO(dimich): once offline pages are enabled by default, remove this. |
| 1238 std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list( | 1219 std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list( |
| 1239 new base::test::ScopedFeatureList); | 1220 new base::test::ScopedFeatureList); |
| 1240 scoped_feature_list->InitAndEnableFeature(kOfflineBookmarksFeature); | 1221 scoped_feature_list->InitAndEnableFeature(kOfflineBookmarksFeature); |
| 1241 | 1222 |
| 1242 // This feature is still disabled by default. | 1223 // This feature is still disabled by default. |
| 1243 EXPECT_FALSE(offline_pages::IsOfflinePagesSharingEnabled()); | 1224 EXPECT_FALSE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1244 | 1225 |
| 1245 // Check if feature is correctly enabled by command-line flag. | 1226 // Check if feature is correctly enabled by command-line flag. |
| 1246 scoped_feature_list.reset(new base::test::ScopedFeatureList); | 1227 scoped_feature_list.reset(new base::test::ScopedFeatureList); |
| 1247 scoped_feature_list->InitFromCommandLine( | 1228 scoped_feature_list->InitFromCommandLine( |
| 1248 std::string(kOfflineBookmarksFeature.name) + "," + | 1229 std::string(kOfflineBookmarksFeature.name) + "," + |
| 1249 kOfflinePagesSharingFeature.name, | 1230 kOfflinePagesSharingFeature.name, |
| 1250 ""); | 1231 ""); |
| 1251 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); | 1232 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1252 } | 1233 } |
| 1253 | 1234 |
| 1254 } // namespace offline_pages | 1235 } // namespace offline_pages |
| OLD | NEW |