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

Side by Side Diff: content/browser/transition_browsertest.cc

Issue 378743002: Navigation transitions: Place transition page in same process as destination page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "content/browser/loader/cross_site_resource_handler.h" 6 #include "content/browser/loader/cross_site_resource_handler.h"
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 #include "content/browser/loader/resource_request_info_impl.h" 8 #include "content/browser/loader/resource_request_info_impl.h"
9 #include "content/browser/transition_request_manager.h" 9 #include "content/browser/transition_request_manager.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
12 #include "content/public/test/browser_test_utils.h"
12 #include "content/public/test/content_browser_test.h" 13 #include "content/public/test/content_browser_test.h"
13 #include "content/public/test/content_browser_test_utils.h" 14 #include "content/public/test/content_browser_test_utils.h"
14 #include "content/public/test/test_utils.h" 15 #include "content/public/test/test_utils.h"
15 #include "content/shell/browser/shell.h" 16 #include "content/shell/browser/shell.h"
16 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" 17 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h"
17 #include "net/test/embedded_test_server/embedded_test_server.h" 18 #include "net/test/embedded_test_server/embedded_test_server.h"
18 #include "net/url_request/url_request.h" 19 #include "net/url_request/url_request.h"
19 20
20 namespace content { 21 namespace content {
21 22
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 new TransitionBrowserTestObserver(shell()->web_contents())); 110 new TransitionBrowserTestObserver(shell()->web_contents()));
110 111
111 ResourceDispatcherHost::Get()->SetDelegate(observer.get()); 112 ResourceDispatcherHost::Get()->SetDelegate(observer.get());
112 observer->set_pending_transition_request(true); 113 observer->set_pending_transition_request(true);
113 114
114 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); 115 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
115 116
116 ASSERT_TRUE(observer->did_defer_response()); 117 ASSERT_TRUE(observer->did_defer_response());
117 } 118 }
118 119
120 // This tests that the renderer is reused between the outgoing and transition.
121 IN_PROC_BROWSER_TEST_F(TransitionBrowserTest,
122 TransitionNavigationSharesRenderer) {
123 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
124
125 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
126
127 GURL transition_url =
128 TransitionRequestManager::GetInstance()->CreateTransitionURL();
129
130 int outgoing_process_id =
131 shell()->web_contents()->GetRenderProcessHost()->GetID();
132
133 TransitionRequestManager::GetInstance()->AddPendingTransitionProcessID(
134 transition_url, outgoing_process_id);
135
136 Shell* shell2 =
137 Shell::CreateNewWindow(shell()->web_contents()->GetBrowserContext(),
138 GURL(),
139 NULL,
140 MSG_ROUTING_NONE,
141 gfx::Size());
142
143 NavigationController::LoadURLParams params(
144 embedded_test_server()->GetURL("/title2.html"));
145 params.transition_type = PageTransitionFromInt(
146 PAGE_TRANSITION_TYPED | PAGE_TRANSITION_FROM_ADDRESS_BAR);
147 params.virtual_url_for_transition = transition_url;
148 shell2->web_contents()->GetController().LoadURLWithParams(params);
149 shell2->web_contents()->Focus();
150
151 WaitForLoadStop(shell2->web_contents());
152
153 ASSERT_EQ(outgoing_process_id,
154 shell2->web_contents()->GetRenderProcessHost()->GetID());
155 }
156
119 } // namespace content 157 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698