OLD | NEW |
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 TestDevToolsClientHost client_host; | 188 TestDevToolsClientHost client_host; |
189 DevToolsAgentHost* agent_host = | 189 DevToolsAgentHost* agent_host = |
190 DevToolsAgentHostRegistry::GetDevToolsAgentHost(inspected_rvh); | 190 DevToolsAgentHostRegistry::GetDevToolsAgentHost(inspected_rvh); |
191 DevToolsManager::GetInstance()-> | 191 DevToolsManager::GetInstance()-> |
192 RegisterDevToolsClientHostFor(agent_host, &client_host); | 192 RegisterDevToolsClientHostFor(agent_host, &client_host); |
193 | 193 |
194 // Start with a short timeout. | 194 // Start with a short timeout. |
195 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); | 195 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); |
196 // Wait long enough for first timeout and see if it fired. | 196 // Wait long enough for first timeout and see if it fired. |
197 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 197 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
198 new MessageLoop::QuitTask(), 10); | 198 MessageLoop::QuitClosure(), 10); |
199 MessageLoop::current()->Run(); | 199 MessageLoop::current()->Run(); |
200 EXPECT_FALSE(delegate.renderer_unresponsive_received()); | 200 EXPECT_FALSE(delegate.renderer_unresponsive_received()); |
201 | 201 |
202 // Now close devtools and check that the notification is delivered. | 202 // Now close devtools and check that the notification is delivered. |
203 client_host.Close(DevToolsManager::GetInstance()); | 203 client_host.Close(DevToolsManager::GetInstance()); |
204 // Start with a short timeout. | 204 // Start with a short timeout. |
205 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); | 205 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); |
206 // Wait long enough for first timeout and see if it fired. | 206 // Wait long enough for first timeout and see if it fired. |
207 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 207 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
208 new MessageLoop::QuitTask(), 10); | 208 MessageLoop::QuitClosure(), 10); |
209 MessageLoop::current()->Run(); | 209 MessageLoop::current()->Run(); |
210 EXPECT_TRUE(delegate.renderer_unresponsive_received()); | 210 EXPECT_TRUE(delegate.renderer_unresponsive_received()); |
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"); |
(...skipping 18 matching lines...) Expand all Loading... |
237 | 237 |
238 // Interrupt pending navigation and navigate back to the original site. | 238 // Interrupt pending navigation and navigate back to the original site. |
239 controller().LoadURL( | 239 controller().LoadURL( |
240 url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); | 240 url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); |
241 contents()->TestDidNavigate(rvh(), 1, url, content::PAGE_TRANSITION_TYPED); | 241 contents()->TestDidNavigate(rvh(), 1, url, content::PAGE_TRANSITION_TYPED); |
242 EXPECT_FALSE(contents()->cross_navigation_pending()); | 242 EXPECT_FALSE(contents()->cross_navigation_pending()); |
243 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor( | 243 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor( |
244 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh()))); | 244 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh()))); |
245 client_host.Close(DevToolsManager::GetInstance()); | 245 client_host.Close(DevToolsManager::GetInstance()); |
246 } | 246 } |
OLD | NEW |