| 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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 | 1071 |
| 1072 TEST_F(OfflinePageModelImplTest, DownloadNamespace) { | 1072 TEST_F(OfflinePageModelImplTest, DownloadNamespace) { |
| 1073 SavePage(kTestUrl, ClientId(kDownloadNamespace, "123")); | 1073 SavePage(kTestUrl, ClientId(kDownloadNamespace, "123")); |
| 1074 std::string histogram_name = "OfflinePages.SavePageResult."; | 1074 std::string histogram_name = "OfflinePages.SavePageResult."; |
| 1075 histogram_name += kDownloadNamespace; | 1075 histogram_name += kDownloadNamespace; |
| 1076 | 1076 |
| 1077 histograms().ExpectUniqueSample(histogram_name, | 1077 histograms().ExpectUniqueSample(histogram_name, |
| 1078 static_cast<int>(SavePageResult::SUCCESS), 1); | 1078 static_cast<int>(SavePageResult::SUCCESS), 1); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 TEST_F(OfflinePageModelImplTest, NewTabPageNamespace) { |
| 1082 SavePage(kTestUrl, ClientId(kNTPSuggestionsNamespace, "123")); |
| 1083 std::string histogram_name = "OfflinePages.SavePageResult."; |
| 1084 histogram_name += kNTPSuggestionsNamespace; |
| 1085 |
| 1086 histograms().ExpectUniqueSample(histogram_name, |
| 1087 static_cast<int>(SavePageResult::SUCCESS), 1); |
| 1088 } |
| 1089 |
| 1081 TEST(CommandLineFlagsTest, OfflineBookmarks) { | 1090 TEST(CommandLineFlagsTest, OfflineBookmarks) { |
| 1082 // Disabled by default. | 1091 // Disabled by default. |
| 1083 EXPECT_FALSE(offline_pages::IsOfflineBookmarksEnabled()); | 1092 EXPECT_FALSE(offline_pages::IsOfflineBookmarksEnabled()); |
| 1084 | 1093 |
| 1085 // Check if feature is correctly enabled by command-line flag. | 1094 // Check if feature is correctly enabled by command-line flag. |
| 1086 base::test::ScopedFeatureList scoped_feature_list; | 1095 base::test::ScopedFeatureList scoped_feature_list; |
| 1087 scoped_feature_list.InitAndEnableFeature(kOfflineBookmarksFeature); | 1096 scoped_feature_list.InitAndEnableFeature(kOfflineBookmarksFeature); |
| 1088 EXPECT_TRUE(offline_pages::IsOfflineBookmarksEnabled()); | 1097 EXPECT_TRUE(offline_pages::IsOfflineBookmarksEnabled()); |
| 1089 } | 1098 } |
| 1090 | 1099 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 // Check if feature is correctly enabled by command-line flag. | 1148 // Check if feature is correctly enabled by command-line flag. |
| 1140 scoped_feature_list.reset(new base::test::ScopedFeatureList); | 1149 scoped_feature_list.reset(new base::test::ScopedFeatureList); |
| 1141 scoped_feature_list->InitFromCommandLine( | 1150 scoped_feature_list->InitFromCommandLine( |
| 1142 std::string(kOfflineBookmarksFeature.name) + "," + | 1151 std::string(kOfflineBookmarksFeature.name) + "," + |
| 1143 kOfflinePagesSharingFeature.name, | 1152 kOfflinePagesSharingFeature.name, |
| 1144 ""); | 1153 ""); |
| 1145 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); | 1154 EXPECT_TRUE(offline_pages::IsOfflinePagesSharingEnabled()); |
| 1146 } | 1155 } |
| 1147 | 1156 |
| 1148 } // namespace offline_pages | 1157 } // namespace offline_pages |
| OLD | NEW |