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

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

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