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

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

Issue 1398153002: Don't use base::MessageLoop::{Quit,QuitClosure} in content/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/location.h" 6 #include "base/location.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 TestDevToolsClientHost client_host; 138 TestDevToolsClientHost client_host;
139 scoped_refptr<DevToolsAgentHost> agent_host(DevToolsAgentHost::GetOrCreateFor( 139 scoped_refptr<DevToolsAgentHost> agent_host(DevToolsAgentHost::GetOrCreateFor(
140 WebContents::FromRenderViewHost(inspected_rvh))); 140 WebContents::FromRenderViewHost(inspected_rvh)));
141 client_host.InspectAgentHost(agent_host.get()); 141 client_host.InspectAgentHost(agent_host.get());
142 142
143 // Start with a short timeout. 143 // Start with a short timeout.
144 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 144 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
145 // Wait long enough for first timeout and see if it fired. 145 // Wait long enough for first timeout and see if it fired.
146 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 146 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
147 FROM_HERE, base::MessageLoop::QuitClosure(), 147 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
148 TimeDelta::FromMilliseconds(10)); 148 TimeDelta::FromMilliseconds(10));
149 base::MessageLoop::current()->Run(); 149 base::MessageLoop::current()->Run();
150 EXPECT_FALSE(delegate.renderer_unresponsive_received()); 150 EXPECT_FALSE(delegate.renderer_unresponsive_received());
151 151
152 // Now close devtools and check that the notification is delivered. 152 // Now close devtools and check that the notification is delivered.
153 client_host.Close(); 153 client_host.Close();
154 // Start with a short timeout. 154 // Start with a short timeout.
155 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 155 inspected_rvh->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
156 // Wait long enough for first timeout and see if it fired. 156 // Wait long enough for first timeout and see if it fired.
157 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 157 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
158 FROM_HERE, base::MessageLoop::QuitClosure(), 158 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
159 TimeDelta::FromMilliseconds(10)); 159 TimeDelta::FromMilliseconds(10));
160 base::MessageLoop::current()->Run(); 160 base::MessageLoop::current()->Run();
161 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 161 EXPECT_TRUE(delegate.renderer_unresponsive_received());
162 162
163 contents()->SetDelegate(NULL); 163 contents()->SetDelegate(NULL);
164 } 164 }
165 165
166 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { 166 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
167 // Navigate to URL. First URL should use first RenderViewHost. 167 // Navigate to URL. First URL should use first RenderViewHost.
168 const GURL url("http://www.google.com"); 168 const GURL url("http://www.google.com");
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 TestDevToolsClientHost client_host; 244 TestDevToolsClientHost client_host;
245 client_host.InspectAgentHost(agent_host.get()); 245 client_host.InspectAgentHost(agent_host.get());
246 agent_host->DispatchProtocolMessage("message1"); 246 agent_host->DispatchProtocolMessage("message1");
247 agent_host->DispatchProtocolMessage("message2"); 247 agent_host->DispatchProtocolMessage("message2");
248 agent_host->DispatchProtocolMessage("message2"); 248 agent_host->DispatchProtocolMessage("message2");
249 249
250 client_host.Close(); 250 client_host.Close();
251 } 251 }
252 252
253 } // namespace content 253 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_thread_unittest.cc ('k') | content/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698