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

Unified Diff: components/offline_pages/core/offline_page_model_impl_unittest.cc

Issue 2602473004: Offline Page Cache uses user interaction triggers for saving pages. (Closed)
Patch Set: Rebased and added the other missing histogram.xml entry... Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/offline_page_model_impl_unittest.cc
diff --git a/components/offline_pages/core/offline_page_model_impl_unittest.cc b/components/offline_pages/core/offline_page_model_impl_unittest.cc
index 678cc7066e01e15627018ac6f0264948a00855f9..0ecf8283ffc15f3604ea43df04c3fc8861e98b32 100644
--- a/components/offline_pages/core/offline_page_model_impl_unittest.cc
+++ b/components/offline_pages/core/offline_page_model_impl_unittest.cc
@@ -1285,6 +1285,37 @@ TEST(CommandLineFlagsTest, OffliningRecentPages) {
EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled());
}
+TEST(CommandLineFlagsTest, OffliningUsesNavigationTriggers) {
+ // All disabled by default.
+ EXPECT_FALSE(offline_pages::IsOffliningRecentPagesEnabled());
+ EXPECT_FALSE(offline_pages::IsOffliningRecentPagesUsingNavigationTriggers());
+ EXPECT_FALSE(offline_pages::IsOffliningRecentPagesUsingInteractionTriggers());
+
+ // Enable Offline Page Cache.
+ std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list(
+ new base::test::ScopedFeatureList);
+ scoped_feature_list->InitFromCommandLine(
+ std::string(kOfflineBookmarksFeature.name) + "," +
+ kOffliningRecentPagesFeature.name,
+ "");
+
+ // By default navigation triggers should be used.
+ EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled());
+ EXPECT_TRUE(offline_pages::IsOffliningRecentPagesUsingNavigationTriggers());
+ EXPECT_FALSE(offline_pages::IsOffliningRecentPagesUsingInteractionTriggers());
+
+ // Check that when also disabling navigation triggers (and so enabling user
+ // interaction triggers), features are correctly reported.
+ scoped_feature_list.reset(new base::test::ScopedFeatureList);
+ scoped_feature_list->InitFromCommandLine(
+ std::string(kOfflineBookmarksFeature.name) + "," +
+ kOffliningRecentPagesFeature.name,
+ std::string(kOffliningUsesNavigationTriggersFeature.name));
+ EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled());
+ EXPECT_FALSE(offline_pages::IsOffliningRecentPagesUsingNavigationTriggers());
+ EXPECT_TRUE(offline_pages::IsOffliningRecentPagesUsingInteractionTriggers());
+}
+
TEST(CommandLineFlagsTest, OfflinePagesSharing) {
// Enable offline bookmarks feature first.
// TODO(dimich): once offline pages are enabled by default, remove this.

Powered by Google App Engine
This is Rietveld 408576698