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

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

Issue 2082343002: Remove calls to deprecated MessageLoop methods in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR 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
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"
11 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 14 #include "base/time/time.h"
14 #include "content/browser/devtools/shared_worker_devtools_manager.h" 15 #include "content/browser/devtools/shared_worker_devtools_manager.h"
15 #include "content/browser/shared_worker/shared_worker_instance.h" 16 #include "content/browser/shared_worker/shared_worker_instance.h"
16 #include "content/browser/shared_worker/worker_storage_partition.h" 17 #include "content/browser/shared_worker/worker_storage_partition.h"
17 #include "content/common/view_messages.h" 18 #include "content/common/view_messages.h"
18 #include "content/public/browser/browser_context.h" 19 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/content_browser_client.h" 20 #include "content/public/browser/content_browser_client.h"
20 #include "content/public/browser/devtools_agent_host.h" 21 #include "content/public/browser/devtools_agent_host.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 WebContents::FromRenderViewHost(inspected_rvh))); 143 WebContents::FromRenderViewHost(inspected_rvh)));
143 client_host.InspectAgentHost(agent_host.get()); 144 client_host.InspectAgentHost(agent_host.get());
144 145
145 // Start with a short timeout. 146 // Start with a short timeout.
146 inspected_rvh->GetWidget()->StartHangMonitorTimeout( 147 inspected_rvh->GetWidget()->StartHangMonitorTimeout(
147 TimeDelta::FromMilliseconds(10)); 148 TimeDelta::FromMilliseconds(10));
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::RunLoop().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));
160 // Wait long enough for first timeout and see if it fired. 161 // Wait long enough for first timeout and see if it fired.
161 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 162 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
162 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 163 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
163 TimeDelta::FromMilliseconds(10)); 164 TimeDelta::FromMilliseconds(10));
164 base::MessageLoop::current()->Run(); 165 base::RunLoop().Run();
165 EXPECT_TRUE(delegate.renderer_unresponsive_received()); 166 EXPECT_TRUE(delegate.renderer_unresponsive_received());
166 167
167 contents()->SetDelegate(NULL); 168 contents()->SetDelegate(NULL);
168 } 169 }
169 170
170 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) { 171 TEST_F(DevToolsManagerTest, ReattachOnCancelPendingNavigation) {
171 // Navigate to URL. First URL should use first RenderViewHost. 172 // Navigate to URL. First URL should use first RenderViewHost.
172 const GURL url("http://www.google.com"); 173 const GURL url("http://www.google.com");
173 controller().LoadURL( 174 controller().LoadURL(
174 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 175 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 TestDevToolsClientHost client_host; 249 TestDevToolsClientHost client_host;
249 client_host.InspectAgentHost(agent_host.get()); 250 client_host.InspectAgentHost(agent_host.get());
250 agent_host->DispatchProtocolMessage(&client_host, "message1"); 251 agent_host->DispatchProtocolMessage(&client_host, "message1");
251 agent_host->DispatchProtocolMessage(&client_host, "message2"); 252 agent_host->DispatchProtocolMessage(&client_host, "message2");
252 agent_host->DispatchProtocolMessage(&client_host, "message2"); 253 agent_host->DispatchProtocolMessage(&client_host, "message2");
253 254
254 client_host.Close(); 255 client_host.Close();
255 } 256 }
256 257
257 } // namespace content 258 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/byte_stream_unittest.cc ('k') | content/browser/devtools/protocol/devtools_protocol_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698