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

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

Issue 8468033: Fix DevToolsManagerTest.ReattachOnCancelPendingNavigation assert failure in debug mode (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_client_host.h" 7 #include "content/browser/debugger/devtools_client_host.h"
8 #include "content/browser/debugger/devtools_manager.h" 8 #include "content/browser/debugger/devtools_manager.h"
9 #include "content/browser/debugger/render_view_devtools_agent_host.h" 9 #include "content/browser/debugger/render_view_devtools_agent_host.h"
10 #include "content/browser/mock_content_browser_client.h" 10 #include "content/browser/mock_content_browser_client.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 MessageLoop::current()->PostDelayedTask(FROM_HERE, 201 MessageLoop::current()->PostDelayedTask(FROM_HERE,
202 new MessageLoop::QuitTask(), 10); 202 new MessageLoop::QuitTask(), 10);
203 MessageLoop::current()->Run(); 203 MessageLoop::current()->Run();
204 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 204 EXPECT_TRUE(delegate.renderer_unresponsive_received());
205 205
206 contents()->set_delegate(NULL); 206 contents()->set_delegate(NULL);
207 } 207 }
208 208
209 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { 209 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
210 contents()->transition_cross_site = true; 210 contents()->transition_cross_site = true;
211 TestRenderViewHost* orig_rvh = rvh();
212 // Navigate to URL. First URL should use first RenderViewHost. 211 // Navigate to URL. First URL should use first RenderViewHost.
213 const GURL url("http://www.google.com"); 212 const GURL url("http://www.google.com");
214 controller().LoadURL( 213 controller().LoadURL(
215 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); 214 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string());
216 ViewHostMsg_FrameNavigate_Params params1; 215 ViewHostMsg_FrameNavigate_Params params1;
217 InitNavigateParams(&params1, 1, url, content::PAGE_TRANSITION_TYPED); 216 InitNavigateParams(&params1, 1, url, content::PAGE_TRANSITION_TYPED);
217 TestRenderViewHost* orig_rvh = rvh();
218 contents()->TestDidNavigate(orig_rvh, params1); 218 contents()->TestDidNavigate(orig_rvh, params1);
219 EXPECT_FALSE(contents()->cross_navigation_pending()); 219 EXPECT_FALSE(contents()->cross_navigation_pending());
220 220
221 TestDevToolsClientHost client_host; 221 TestDevToolsClientHost client_host;
222 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); 222 DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
223 devtools_manager->RegisterDevToolsClientHostFor(rvh(), &client_host); 223 devtools_manager->RegisterDevToolsClientHostFor(rvh(), &client_host);
224 224
225 // Navigate to new site which should get a new RenderViewHost. 225 // Navigate to new site which should get a new RenderViewHost.
226 const GURL url2("http://www.yahoo.com"); 226 const GURL url2("http://www.yahoo.com");
227 controller().LoadURL( 227 controller().LoadURL(
228 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); 228 url2, GURL(), content::PAGE_TRANSITION_TYPED, std::string());
229 EXPECT_TRUE(contents()->cross_navigation_pending()); 229 EXPECT_TRUE(contents()->cross_navigation_pending());
230 EXPECT_EQ(&client_host, 230 EXPECT_EQ(&client_host,
231 devtools_manager->GetDevToolsClientHostFor(pending_rvh())); 231 devtools_manager->GetDevToolsClientHostFor(pending_rvh()));
232 232
233 // Interrupt pending navigation and navigate back to the original site. 233 // Interrupt pending navigation and navigate back to the original site.
234 controller().LoadURL( 234 controller().LoadURL(
235 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string()); 235 url, GURL(), content::PAGE_TRANSITION_TYPED, std::string());
236 contents()->TestDidNavigate(orig_rvh, params1); 236 contents()->TestDidNavigate(orig_rvh, params1);
237 EXPECT_FALSE(contents()->cross_navigation_pending()); 237 EXPECT_FALSE(contents()->cross_navigation_pending());
238 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor(rvh())); 238 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor(rvh()));
239 client_host.Close(); 239 client_host.Close();
240 } 240 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698