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..e3f03a58cd016906404a021d10b96b8375c6128e 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,47 @@ 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("/some_page.html")); |
+ ResourceDispatcherHost::Get()->SetDelegate(&delegate); |
+ |
+ NavigateToURL(shell(), |
Charlie Reis
2014/11/14 18:05:54
A client redirect will commit twice, right? Maybe
|
+ embedded_test_server()->GetURL("/client_redirect.html")); |
+ |
+ EXPECT_TRUE( |
+ delegate.page_transition() & ui::PAGE_TRANSITION_CLIENT_REDIRECT); |
+} |
+ |
} // namespace content |