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

Unified Diff: components/offline_pages/offline_page_model_unittest.cc

Issue 1750883002: Add enable-offlining-recent-pages feature switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolve Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/offline_pages/offline_page_feature.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_model_unittest.cc
diff --git a/components/offline_pages/offline_page_model_unittest.cc b/components/offline_pages/offline_page_model_unittest.cc
index aea301e1f2063526b1cad7b947bb2dc08153546e..31b37237355138b503f4756cd47228d79a86edfd 100644
--- a/components/offline_pages/offline_page_model_unittest.cc
+++ b/components/offline_pages/offline_page_model_unittest.cc
@@ -9,6 +9,8 @@
#include <utility>
#include "base/bind.h"
+#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/run_loop.h"
@@ -25,7 +27,9 @@
#include "components/bookmarks/browser/bookmark_undo_delegate.h"
#include "components/bookmarks/browser/bookmark_undo_provider.h"
#include "components/bookmarks/test/test_bookmark_client.h"
+#include "components/offline_pages/offline_page_feature.h"
#include "components/offline_pages/offline_page_item.h"
+#include "components/offline_pages/offline_page_switches.h"
#include "components/offline_pages/offline_page_test_archiver.h"
#include "components/offline_pages/offline_page_test_store.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -989,4 +993,20 @@ TEST_F(OfflinePageModelTest, SaveRetrieveMultipleClientIds) {
EXPECT_TRUE(id_set.find(offline2) != id_set.end());
}
+TEST(CommandLineFlagsTest, OffliningRecentPages) {
+ // TODO(dimich): once offline pages are enabled by default, remove this.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableOfflinePages);
+ // Disabled by default.
+ EXPECT_FALSE(offline_pages::IsOffliningRecentPagesEnabled());
+
+ // Check if feature is correctly enabled by command-line flag.
+ base::FeatureList::ClearInstanceForTesting();
+ scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ feature_list->InitializeFromCommandLine(
+ offline_pages::kOffliningRecentPagesFeature.name, "");
+ base::FeatureList::SetInstance(std::move(feature_list));
+ EXPECT_TRUE(offline_pages::IsOffliningRecentPagesEnabled());
+}
+
} // namespace offline_pages
« no previous file with comments | « components/offline_pages/offline_page_feature.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698