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

Unified Diff: content/browser/loader/reload_cache_control_browsertest.cc

Issue 1993603003: Add a field study to use new reload behavior even on desktops (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #9 Created 4 years, 7 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 | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/public/common/content_features.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/reload_cache_control_browsertest.cc
diff --git a/content/browser/loader/reload_cache_control_browsertest.cc b/content/browser/loader/reload_cache_control_browsertest.cc
index 94ae06d08bf072a44834aac9913d39a8f57a4f74..38586762a6eea3fa9c68ce15ff2ad8a2b795f68e 100644
--- a/content/browser/loader/reload_cache_control_browsertest.cc
+++ b/content/browser/loader/reload_cache_control_browsertest.cc
@@ -6,7 +6,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
+#include "base/feature_list.h"
#include "base/files/file_path.h"
+#include "content/public/common/content_features.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
@@ -68,6 +70,25 @@ class ReloadCacheControlBrowserTest : public ContentBrowserTest {
DISALLOW_COPY_AND_ASSIGN(ReloadCacheControlBrowserTest);
};
+class ReloadCacheControlWithAnExperimentBrowserTest
+ : public ReloadCacheControlBrowserTest {
+ protected:
+ ReloadCacheControlWithAnExperimentBrowserTest() = default;
+ ~ReloadCacheControlWithAnExperimentBrowserTest() override = default;
+
+ void SetUpOnMainThread() override {
+ base::FeatureList::ClearInstanceForTesting();
+ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ feature_list->InitializeFromCommandLine(
+ features::kNonValidatingReloadOnNormalReload.name, std::string());
+ base::FeatureList::SetInstance(std::move(feature_list));
+
+ ReloadCacheControlBrowserTest::SetUpOnMainThread();
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(ReloadCacheControlWithAnExperimentBrowserTest);
+};
+
IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, NormalReload) {
GURL url(embedded_test_server()->GetURL(kReloadTestPath));
@@ -104,6 +125,27 @@ IN_PROC_BROWSER_TEST_F(ReloadCacheControlBrowserTest, BypassingReload) {
EXPECT_EQ(kNoCacheCacheControl, request_log_[3].cache_control);
}
+IN_PROC_BROWSER_TEST_F(ReloadCacheControlWithAnExperimentBrowserTest,
+ ReloadMainResource) {
+ GURL url(embedded_test_server()->GetURL(kReloadTestPath));
+
+ EXPECT_TRUE(NavigateToURL(shell(), url));
+ ReloadBlockUntilNavigationsComplete(shell(), 1);
+
+ ASSERT_EQ(4UL, request_log_.size());
+ EXPECT_EQ(kReloadTestPath, request_log_[0].relative_url);
+ EXPECT_EQ(kNoCacheControl, request_log_[0].cache_control);
+ EXPECT_EQ(kReloadImagePath, request_log_[1].relative_url);
+ EXPECT_EQ(kNoCacheControl, request_log_[1].cache_control);
+
+ EXPECT_EQ(kReloadTestPath, request_log_[2].relative_url);
+ EXPECT_EQ(kMaxAgeCacheControl, request_log_[2].cache_control);
+ EXPECT_EQ(kReloadImagePath, request_log_[3].relative_url);
+ EXPECT_EQ(kNoCacheControl, request_log_[3].cache_control);
+}
+
+// TODO(toyoshim): Add another set of reload tests with DevTools open.
+
} // namespace
} // namespace content
« no previous file with comments | « content/browser/frame_host/navigation_controller_impl.cc ('k') | content/public/common/content_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698