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

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

Issue 2208293002: [Offline Pages] Add new download namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update according to review comments Created 4 years, 4 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 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 1061
1062 TEST_F(OfflinePageModelImplTest, CustomTabsNamespace) { 1062 TEST_F(OfflinePageModelImplTest, CustomTabsNamespace) {
1063 SavePage(kTestUrl, ClientId(kCCTNamespace, "123")); 1063 SavePage(kTestUrl, ClientId(kCCTNamespace, "123"));
1064 std::string histogram_name = "OfflinePages.SavePageResult."; 1064 std::string histogram_name = "OfflinePages.SavePageResult.";
1065 histogram_name += kCCTNamespace; 1065 histogram_name += kCCTNamespace;
1066 1066
1067 histograms().ExpectUniqueSample(histogram_name, 1067 histograms().ExpectUniqueSample(histogram_name,
1068 static_cast<int>(SavePageResult::SUCCESS), 1); 1068 static_cast<int>(SavePageResult::SUCCESS), 1);
1069 } 1069 }
1070 1070
1071 TEST_F(OfflinePageModelImplTest, DownloadNamespace) {
1072 SavePage(kTestUrl, ClientId(kDownloadNamespace, "123"));
1073 std::string histogram_name = "OfflinePages.SavePageResult.";
1074 histogram_name += kDownloadNamespace;
1075
1076 histograms().ExpectUniqueSample(histogram_name,
1077 static_cast<int>(SavePageResult::SUCCESS), 1);
1078 }
1079
1071 TEST(CommandLineFlagsTest, OfflineBookmarks) { 1080 TEST(CommandLineFlagsTest, OfflineBookmarks) {
1072 // Disabled by default. 1081 // Disabled by default.
1073 EXPECT_FALSE(offline_pages::IsOfflineBookmarksEnabled()); 1082 EXPECT_FALSE(offline_pages::IsOfflineBookmarksEnabled());
1074 1083
1075 // Check if feature is correctly enabled by command-line flag. 1084 // Check if feature is correctly enabled by command-line flag.
1076 base::FeatureList::ClearInstanceForTesting(); 1085 base::FeatureList::ClearInstanceForTesting();
1077 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); 1086 std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
1078 feature_list->InitializeFromCommandLine( 1087 feature_list->InitializeFromCommandLine(
1079 offline_pages::kOfflineBookmarksFeature.name, ""); 1088 offline_pages::kOfflineBookmarksFeature.name, "");
1080 base::FeatureList::SetInstance(std::move(feature_list)); 1089 base::FeatureList::SetInstance(std::move(feature_list));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1144 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList); 1153 std::unique_ptr<base::FeatureList> feature_list2(new base::FeatureList);
1145 feature_list2->InitializeFromCommandLine( 1154 feature_list2->InitializeFromCommandLine(
1146 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," + 1155 std::string(offline_pages::kOfflineBookmarksFeature.name) + "," +
1147 offline_pages::kOfflinePagesSharingFeature.name, 1156 offline_pages::kOfflinePagesSharingFeature.name,
1148 ""); 1157 "");
1149 base::FeatureList::SetInstance(std::move(feature_list2)); 1158 base::FeatureList::SetInstance(std::move(feature_list2));
1150 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); 1159 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled());
1151 } 1160 }
1152 1161
1153 } // namespace offline_pages 1162 } // namespace offline_pages
OLDNEW
« no previous file with comments | « components/offline_pages/client_policy_controller_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698