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

Side by Side Diff: content/browser/debugger/devtools_manager_unittest.cc

Issue 8801003: Make TestTabContents::TestDidNavigate not take a ViewHostMsg_FrameNavigate_Params, since that's a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Also get rid of content usage and remove the method Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "content/browser/debugger/devtools_manager_impl.h" 7 #include "content/browser/debugger/devtools_manager_impl.h"
8 #include "content/browser/debugger/render_view_devtools_agent_host.h" 8 #include "content/browser/debugger/render_view_devtools_agent_host.h"
9 #include "content/browser/mock_content_browser_client.h" 9 #include "content/browser/mock_content_browser_client.h"
10 #include "content/browser/renderer_host/test_render_view_host.h" 10 #include "content/browser/renderer_host/test_render_view_host.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 contents()->set_delegate(NULL); 212 contents()->set_delegate(NULL);
213 } 213 }
214 214
215 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { 215 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
216 contents()->transition_cross_site = true; 216 contents()->transition_cross_site = true;
217 // Navigate to URL. First URL should use first RenderViewHost. 217 // Navigate to URL. First URL should use first RenderViewHost.
218 const GURL url("http://www.google.com"); 218 const GURL url("http://www.google.com");
219 controller().LoadURL( 219 controller().LoadURL(
220 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); 220 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string());
221 ViewHostMsg_FrameNavigate_Params params1; 221 contents()->TestDidNavigate(rvh(), 1, url, content::PAGE_TRANSITION_TYPED);
222 InitNavigateParams(&params1, 1, url, content::PAGE_TRANSITION_TYPED);
223 TestRenderViewHost* orig_rvh = rvh();
224 contents()->TestDidNavigate(orig_rvh, params1);
225 EXPECT_FALSE(contents()->cross_navigation_pending()); 222 EXPECT_FALSE(contents()->cross_navigation_pending());
226 223
227 TestDevToolsClientHost client_host; 224 TestDevToolsClientHost client_host;
228 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); 225 DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
229 devtools_manager->RegisterDevToolsClientHostFor( 226 devtools_manager->RegisterDevToolsClientHostFor(
230 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh()), 227 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh()),
231 &client_host); 228 &client_host);
232 229
233 // Navigate to new site which should get a new RenderViewHost. 230 // Navigate to new site which should get a new RenderViewHost.
234 const GURL url2("http://www.yahoo.com"); 231 const GURL url2("http://www.yahoo.com");
235 controller().LoadURL( 232 controller().LoadURL(
236 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); 233 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string());
237 EXPECT_TRUE(contents()->cross_navigation_pending()); 234 EXPECT_TRUE(contents()->cross_navigation_pending());
238 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor( 235 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor(
239 DevToolsAgentHostRegistry::GetDevToolsAgentHost(pending_rvh()))); 236 DevToolsAgentHostRegistry::GetDevToolsAgentHost(pending_rvh())));
240 237
241 // Interrupt pending navigation and navigate back to the original site. 238 // Interrupt pending navigation and navigate back to the original site.
242 controller().LoadURL( 239 controller().LoadURL(
243 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); 240 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string());
244 contents()->TestDidNavigate(orig_rvh, params1); 241 contents()->TestDidNavigate(rvh(), 1, url, content::PAGE_TRANSITION_TYPED);
245 EXPECT_FALSE(contents()->cross_navigation_pending()); 242 EXPECT_FALSE(contents()->cross_navigation_pending());
246 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor( 243 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor(
247 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh()))); 244 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh())));
248 client_host.Close(DevToolsManager::GetInstance()); 245 client_host.Close(DevToolsManager::GetInstance());
249 } 246 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698