OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/devtools/devtools_manager.h" | 5 #include "content/browser/devtools/devtools_manager.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 TestWebContentsDelegate delegate; | 141 TestWebContentsDelegate delegate; |
142 contents()->SetDelegate(&delegate); | 142 contents()->SetDelegate(&delegate); |
143 | 143 |
144 TestDevToolsClientHost client_host; | 144 TestDevToolsClientHost client_host; |
145 scoped_refptr<DevToolsAgentHost> agent_host(DevToolsAgentHost::GetOrCreateFor( | 145 scoped_refptr<DevToolsAgentHost> agent_host(DevToolsAgentHost::GetOrCreateFor( |
146 WebContents::FromRenderViewHost(inspected_rvh))); | 146 WebContents::FromRenderViewHost(inspected_rvh))); |
147 client_host.InspectAgentHost(agent_host.get()); | 147 client_host.InspectAgentHost(agent_host.get()); |
148 | 148 |
149 // Start with a short timeout. | 149 // Start with a short timeout. |
150 inspected_rvh->GetWidget()->StartHangMonitorTimeout( | 150 inspected_rvh->GetWidget()->StartHangMonitorTimeout( |
151 TimeDelta::FromMilliseconds(10), blink::WebInputEvent::Undefined, | 151 TimeDelta::FromMilliseconds(10), blink::WebInputEvent::Undefined); |
152 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN); | |
153 // Wait long enough for first timeout and see if it fired. | 152 // Wait long enough for first timeout and see if it fired. |
154 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 153 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
155 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 154 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
156 TimeDelta::FromMilliseconds(10)); | 155 TimeDelta::FromMilliseconds(10)); |
157 base::RunLoop().Run(); | 156 base::RunLoop().Run(); |
158 EXPECT_FALSE(delegate.renderer_unresponsive_received()); | 157 EXPECT_FALSE(delegate.renderer_unresponsive_received()); |
159 | 158 |
160 // Now close devtools and check that the notification is delivered. | 159 // Now close devtools and check that the notification is delivered. |
161 client_host.Close(); | 160 client_host.Close(); |
162 // Start with a short timeout. | 161 // Start with a short timeout. |
163 inspected_rvh->GetWidget()->StartHangMonitorTimeout( | 162 inspected_rvh->GetWidget()->StartHangMonitorTimeout( |
164 TimeDelta::FromMilliseconds(10), blink::WebInputEvent::Undefined, | 163 TimeDelta::FromMilliseconds(10), blink::WebInputEvent::Undefined); |
165 RendererUnresponsiveType::RENDERER_UNRESPONSIVE_UNKNOWN); | |
166 // Wait long enough for first timeout and see if it fired. | 164 // Wait long enough for first timeout and see if it fired. |
167 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 165 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
168 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 166 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
169 TimeDelta::FromMilliseconds(10)); | 167 TimeDelta::FromMilliseconds(10)); |
170 base::RunLoop().Run(); | 168 base::RunLoop().Run(); |
171 EXPECT_TRUE(delegate.renderer_unresponsive_received()); | 169 EXPECT_TRUE(delegate.renderer_unresponsive_received()); |
172 | 170 |
173 contents()->SetDelegate(NULL); | 171 contents()->SetDelegate(NULL); |
174 } | 172 } |
175 | 173 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 TestDevToolsClientHost client_host; | 268 TestDevToolsClientHost client_host; |
271 client_host.InspectAgentHost(agent_host.get()); | 269 client_host.InspectAgentHost(agent_host.get()); |
272 agent_host->DispatchProtocolMessage(&client_host, "message1"); | 270 agent_host->DispatchProtocolMessage(&client_host, "message1"); |
273 agent_host->DispatchProtocolMessage(&client_host, "message2"); | 271 agent_host->DispatchProtocolMessage(&client_host, "message2"); |
274 agent_host->DispatchProtocolMessage(&client_host, "message2"); | 272 agent_host->DispatchProtocolMessage(&client_host, "message2"); |
275 | 273 |
276 client_host.Close(); | 274 client_host.Close(); |
277 } | 275 } |
278 | 276 |
279 } // namespace content | 277 } // namespace content |
OLD | NEW |