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

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

Issue 2155383002: Add an histogram to differentiate between hang types of the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 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
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | 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) 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/location.h" 9 #include "base/location.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 TestWebContentsDelegate delegate; 137 TestWebContentsDelegate delegate;
138 contents()->SetDelegate(&delegate); 138 contents()->SetDelegate(&delegate);
139 139
140 TestDevToolsClientHost client_host; 140 TestDevToolsClientHost client_host;
141 scoped_refptr<DevToolsAgentHost> agent_host(DevToolsAgentHost::GetOrCreateFor( 141 scoped_refptr<DevToolsAgentHost> agent_host(DevToolsAgentHost::GetOrCreateFor(
142 WebContents::FromRenderViewHost(inspected_rvh))); 142 WebContents::FromRenderViewHost(inspected_rvh)));
143 client_host.InspectAgentHost(agent_host.get()); 143 client_host.InspectAgentHost(agent_host.get());
144 144
145 // Start with a short timeout. 145 // Start with a short timeout.
146 inspected_rvh->GetWidget()->StartHangMonitorTimeout( 146 inspected_rvh->GetWidget()->StartHangMonitorTimeout(
147 TimeDelta::FromMilliseconds(10)); 147 TimeDelta::FromMilliseconds(10),
148 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_UNKNOWN);
148 // Wait long enough for first timeout and see if it fired. 149 // Wait long enough for first timeout and see if it fired.
149 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 150 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
150 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 151 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
151 TimeDelta::FromMilliseconds(10)); 152 TimeDelta::FromMilliseconds(10));
152 base::MessageLoop::current()->Run(); 153 base::MessageLoop::current()->Run();
153 EXPECT_FALSE(delegate.renderer_unresponsive_received()); 154 EXPECT_FALSE(delegate.renderer_unresponsive_received());
154 155
155 // Now close devtools and check that the notification is delivered. 156 // Now close devtools and check that the notification is delivered.
156 client_host.Close(); 157 client_host.Close();
157 // Start with a short timeout. 158 // Start with a short timeout.
158 inspected_rvh->GetWidget()->StartHangMonitorTimeout( 159 inspected_rvh->GetWidget()->StartHangMonitorTimeout(
159 TimeDelta::FromMilliseconds(10)); 160 TimeDelta::FromMilliseconds(10),
161 RenderWidgetHostDelegate::RENDERER_UNRESPONSIVE_UNKNOWN);
160 // Wait long enough for first timeout and see if it fired. 162 // Wait long enough for first timeout and see if it fired.
161 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 163 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
162 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 164 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
163 TimeDelta::FromMilliseconds(10)); 165 TimeDelta::FromMilliseconds(10));
164 base::MessageLoop::current()->Run(); 166 base::MessageLoop::current()->Run();
165 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 167 EXPECT_TRUE(delegate.renderer_unresponsive_received());
166 168
167 contents()->SetDelegate(NULL); 169 contents()->SetDelegate(NULL);
168 } 170 }
169 171
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 TestDevToolsClientHost client_host; 250 TestDevToolsClientHost client_host;
249 client_host.InspectAgentHost(agent_host.get()); 251 client_host.InspectAgentHost(agent_host.get());
250 agent_host->DispatchProtocolMessage(&client_host, "message1"); 252 agent_host->DispatchProtocolMessage(&client_host, "message1");
251 agent_host->DispatchProtocolMessage(&client_host, "message2"); 253 agent_host->DispatchProtocolMessage(&client_host, "message2");
252 agent_host->DispatchProtocolMessage(&client_host, "message2"); 254 agent_host->DispatchProtocolMessage(&client_host, "message2");
253 255
254 client_host.Close(); 256 client_host.Close();
255 } 257 }
256 258
257 } // namespace content 259 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698