Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: components/offline_pages/offline_page_model_impl_unittest.cc

Issue 2068393002: Flag for Offline Page Sharing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 base::FeatureList::ClearInstanceForTesting(); 1070 base::FeatureList::ClearInstanceForTesting();
1071 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList); 1071 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList);
1072 feature_list2->InitializeFromCommandLine( 1072 feature_list2->InitializeFromCommandLine(
1073 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," + 1073 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," +
1074 offline_pages::kOfflinePagesBackgroundLoadingFeature.name, 1074 offline_pages::kOfflinePagesBackgroundLoadingFeature.name,
1075 ""); 1075 "");
1076 base::FeatureList::SetInstance(std::move(feature_list2)); 1076 base::FeatureList::SetInstance(std::move(feature_list2));
1077 EXPECT_TRUE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled()); 1077 EXPECT_TRUE(offline_pages::IsOfflinePagesBackgroundLoadingEnabled());
1078 } 1078 }
1079 1079
1080 TEST(CommandLineFlagsTest, OfflinePagesSharing) {
1081 // Enable offline bookmarks feature first.
1082 // TODO(dimich): once offline pages are enabled by default, remove this.
1083 base::FeatureList::ClearInstanceForTesting();
1084 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
1085 feature_list->InitializeFromCommandLine(
1086 offline_pages::kOfflineBookmarksFeature.name, "");
1087 base::FeatureList::SetInstance(std::move(feature_list));
1088
1089 // This feature is still disabled by default.
1090 EXPECT_FALSE(offline_pages::IsOfflinePagesSharingEnabled());
1091
1092 // Check if feature is correctly enabled by command-line flag.
1093 base::FeatureList::ClearInstanceForTesting();
1094 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList);
1095 feature_list2->InitializeFromCommandLine(
1096 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," +
1097 offline_pages::kOfflinePagesSharingFeature.name,
1098 "");
fgorski 2016/06/15 22:54:28 nit: I think git cl format might disagree with thi
Vivian 2016/06/16 00:47:27 Seems that git cl format didn't change the format
1099 base::FeatureList::SetInstance(std::move(feature_list2));
1100 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled());
1101 }
1102
1080 } // namespace offline_pages 1103 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698