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.h" | 5 #include "components/offline_pages/offline_page_model.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 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 | 1004 |
1005 // Check if feature is correctly enabled by command-line flag. | 1005 // Check if feature is correctly enabled by command-line flag. |
1006 base::FeatureList::ClearInstanceForTesting(); | 1006 base::FeatureList::ClearInstanceForTesting(); |
1007 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); | 1007 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); |
1008 feature_list->InitializeFromCommandLine( | 1008 feature_list->InitializeFromCommandLine( |
1009 offline_pages::kOffliningRecentPagesFeature.name, ""); | 1009 offline_pages::kOffliningRecentPagesFeature.name, ""); |
1010 base::FeatureList::SetInstance(std::move(feature_list)); | 1010 base::FeatureList::SetInstance(std::move(feature_list)); |
1011 EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled()); | 1011 EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled()); |
1012 } | 1012 } |
1013 | 1013 |
| 1014 TEST(CommandLineFlagsTest, OfflinePagesBackgroundLoading) { |
| 1015 // TODO(dimich): once offline pages are enabled by default, remove this. |
| 1016 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 1017 switches::kEnableOfflinePages); |
| 1018 // Disabled by default. |
| 1019 EXPECT_FALSE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); |
| 1020 |
| 1021 // Check if feature is correctly enabled by command-line flag. |
| 1022 base::FeatureList::ClearInstanceForTesting(); |
| 1023 scoped_ptr<base::FeatureList> feature_list(new base::FeatureList); |
| 1024 feature_list->InitializeFromCommandLine( |
| 1025 offline_pages::kOfflinePagesBackgroundLoadingFeature.name, ""); |
| 1026 base::FeatureList::SetInstance(std::move(feature_list)); |
| 1027 EXPECT_TRUE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); |
| 1028 } |
| 1029 |
1014 } // namespace offline_pages | 1030 } // namespace offline_pages |
OLD | NEW |