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

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

Issue 626913004: Set the ui::PAGE_TRANSITION_CLIENT_REDIRECT flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test case flakiness Created 6 years, 1 month 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 | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_dispatcher_host_browsertest.cc
diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc
index 8673c07b086b691b3899b205068658d9ee88f05a..d07f903c3bf3c3fcc989331169d52f474bc120a6 100644
--- a/content/browser/loader/resource_dispatcher_host_browsertest.cc
+++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc
@@ -10,6 +10,9 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/resource_dispatcher_host.h"
+#include "content/public/browser/resource_dispatcher_host_delegate.h"
+#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/public/test/browser_test_utils.h"
@@ -472,4 +475,49 @@ IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, CookiePolicy) {
CheckTitleTest(url, "cookie set");
}
+class PageTransitionResourceDispatcherHostDelegate
+ : public ResourceDispatcherHostDelegate {
+ public:
+ PageTransitionResourceDispatcherHostDelegate(GURL watch_url)
+ : watch_url_(watch_url) {}
+
+ // ResourceDispatcherHostDelegate implementation:
+ void RequestBeginning(net::URLRequest* request,
+ ResourceContext* resource_context,
+ AppCacheService* appcache_service,
+ ResourceType resource_type,
+ ScopedVector<ResourceThrottle>* throttles) override {
+ if (request->url() == watch_url_) {
+ const ResourceRequestInfo* info =
+ ResourceRequestInfo::ForRequest(request);
+ page_transition_ = info->GetPageTransition();
+ }
+ }
+
+ ui::PageTransition page_transition() { return page_transition_; }
+
+ private:
+ GURL watch_url_;
+ ui::PageTransition page_transition_;
+};
+
+// Test that ui::PAGE_TRANSITION_CLIENT_REDIRECT is correctly set
+// when encountering a meta refresh tag.
+IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest,
+ PageTransitionClientRedirect) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ PageTransitionResourceDispatcherHostDelegate delegate(
+ embedded_test_server()->GetURL("/title1.html"));
+ ResourceDispatcherHost::Get()->SetDelegate(&delegate);
+
+ NavigateToURLBlockUntilNavigationsComplete(
+ shell(),
+ embedded_test_server()->GetURL("/client_redirect.html"),
+ 2);
+
+ EXPECT_TRUE(
+ delegate.page_transition() & ui::PAGE_TRANSITION_CLIENT_REDIRECT);
+}
+
} // namespace content
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698