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

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index fc691c720b85f8a3a78094c29239c2f774c57b8b..1787f66be29850bd589f60bacd96ddca97e8893c 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -5,8 +5,11 @@
#include "base/basictypes.h"
#include "base/bind.h"
#include "base/command_line.h"
+#include "base/location.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/shared_memory.h"
+#include "base/single_thread_task_runner.h"
+#include "base/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "content/browser/browser_thread_impl.h"
#include "content/browser/gpu/compositor_util.h"
@@ -979,9 +982,8 @@ TEST_F(RenderWidgetHostTest, DontPostponeHangMonitorTimeout) {
host_->StartHangMonitorTimeout(TimeDelta::FromSeconds(30));
// Wait long enough for first timeout and see if it fired.
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMilliseconds(10));
base::MessageLoop::current()->Run();
EXPECT_TRUE(host_->unresponsive_timer_fired());
@@ -999,9 +1001,8 @@ TEST_F(RenderWidgetHostTest, StopAndStartHangMonitorTimeout) {
host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
// Wait long enough for first timeout and see if it fired.
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMilliseconds(40));
base::MessageLoop::current()->Run();
EXPECT_TRUE(host_->unresponsive_timer_fired());
@@ -1018,9 +1019,8 @@ TEST_F(RenderWidgetHostTest, ShorterDelayHangMonitorTimeout) {
host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(20));
// Wait long enough for the second timeout and see if it fired.
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMilliseconds(25));
base::MessageLoop::current()->Run();
EXPECT_TRUE(host_->unresponsive_timer_fired());
@@ -1037,18 +1037,16 @@ TEST_F(RenderWidgetHostTest, HangMonitorTimeoutDisabledForInputWhenHidden) {
// The timeout should not fire.
EXPECT_FALSE(host_->unresponsive_timer_fired());
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMicroseconds(2));
base::MessageLoop::current()->Run();
EXPECT_FALSE(host_->unresponsive_timer_fired());
// The timeout should never reactivate while hidden.
SimulateMouseEvent(WebInputEvent::MouseMove, 10, 10, 0, false);
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMicroseconds(2));
base::MessageLoop::current()->Run();
EXPECT_FALSE(host_->unresponsive_timer_fired());
@@ -1056,9 +1054,8 @@ TEST_F(RenderWidgetHostTest, HangMonitorTimeoutDisabledForInputWhenHidden) {
// Showing the widget should restore the timeout, as the events have
// not yet been ack'ed.
host_->WasShown(ui::LatencyInfo());
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMicroseconds(2));
base::MessageLoop::current()->Run();
EXPECT_TRUE(host_->unresponsive_timer_fired());
@@ -1079,9 +1076,8 @@ TEST_F(RenderWidgetHostTest, MultipleInputEvents) {
INPUT_EVENT_ACK_STATE_CONSUMED);
// Wait long enough for first timeout and see if it fired.
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE,
- base::MessageLoop::QuitClosure(),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::MessageLoop::QuitClosure(),
TimeDelta::FromMicroseconds(20));
base::MessageLoop::current()->Run();
EXPECT_TRUE(host_->unresponsive_timer_fired());

Powered by Google App Engine
This is Rietveld 408576698