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

Unified Diff: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc

Issue 2049493004: Remove use of deprecated MessageLoop methods in ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « ui/views/mouse_watcher.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
index 81e70381e15dab72db83f3bbd42b6c73c6de91ae..bd1e5e8e47464a816a965830b2b331f366a4077e 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11_unittest.cc
@@ -10,10 +10,13 @@
// conflicts with the definition of None in gtest-type-util.h
#include "ui/views/test/views_test_base.h"
+#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "ui/aura/test/test_screen.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
@@ -533,19 +536,15 @@ void BasicStep3(TestDragDropClient* client, XID toplevel) {
TEST_F(DesktopDragDropClientAuraX11Test, Basic) {
XID toplevel = 1;
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&BasicStep2,
- client(),
- toplevel));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&BasicStep2, client(), toplevel));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result);
// Do another drag and drop to test that the data is properly cleaned up as a
// result of the XdndFinished message.
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&BasicStep3,
- client(),
- toplevel));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&BasicStep3, client(), toplevel));
result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result);
}
@@ -576,8 +575,8 @@ TEST_F(DesktopDragDropClientAuraX11Test, HighDPI200) {
static_cast<aura::TestScreen*>(display::Screen::GetScreen());
screen->SetDeviceScaleFactor(2.0f);
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&HighDPIStep, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&HighDPIStep, client()));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result);
}
@@ -587,8 +586,8 @@ TEST_F(DesktopDragDropClientAuraX11Test, HighDPI150) {
static_cast<aura::TestScreen*>(display::Screen::GetScreen());
screen->SetDeviceScaleFactor(1.5f);
- base::MessageLoop::current()->PostTask(FROM_HERE,
- base::Bind(&HighDPIStep, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&HighDPIStep, client()));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result);
}
@@ -621,9 +620,8 @@ void TargetDoesNotRespondStep2(TestDragDropClient* client) {
// DNDCollectionWindow is an example of an XdndAware target which does not
// respond to XdndPosition messages at all.
TEST_F(DesktopDragDropClientAuraX11Test, TargetDoesNotRespond) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&TargetDoesNotRespondStep2, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&TargetDoesNotRespondStep2, client()));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result);
}
@@ -667,9 +665,8 @@ void QueuePositionStep2(TestDragDropClient* client) {
// Test that XdndPosition messages are queued till the pending XdndPosition
// message is acked via an XdndStatus message.
TEST_F(DesktopDragDropClientAuraX11Test, QueuePosition) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&QueuePositionStep2, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&QueuePositionStep2, client()));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result);
}
@@ -720,9 +717,8 @@ void TargetChangesStep2(TestDragDropClient* client) {
// Test the behavior when the target changes during a drag.
TEST_F(DesktopDragDropClientAuraX11Test, TargetChanges) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&TargetChangesStep2, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&TargetChangesStep2, client()));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result);
}
@@ -790,16 +786,14 @@ void RejectAfterMouseReleaseStep3(TestDragDropClient* client) {
// Test that the source sends XdndLeave instead of XdndDrop if the drag
// operation is rejected after the mouse is released.
TEST_F(DesktopDragDropClientAuraX11Test, RejectAfterMouseRelease) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&RejectAfterMouseReleaseStep2, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&RejectAfterMouseReleaseStep2, client()));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result);
// Repeat the test but reject the drop in the XdndFinished message instead.
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&RejectAfterMouseReleaseStep3, client()));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&RejectAfterMouseReleaseStep3, client()));
result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_NONE, result);
}
@@ -998,9 +992,8 @@ void ChromeSourceTargetStep2(SimpleTestDragDropClient* client,
} // namespace
TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, Basic) {
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_NONE));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_NONE));
int result = StartDragAndDrop();
EXPECT_EQ(ui::DragDropTypes::DRAG_COPY, result);
}
@@ -1008,7 +1001,7 @@ TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, Basic) {
// Test that if 'Ctrl' is pressed during a drag and drop operation, that
// the aura::client::DragDropDelegate is properly notified.
TEST_F(DesktopDragDropClientAuraX11ChromeSourceTargetTest, CtrlPressed) {
- base::MessageLoop::current()->PostTask(
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::Bind(&ChromeSourceTargetStep2, client(), ui::EF_CONTROL_DOWN));
int result = StartDragAndDrop();
« no previous file with comments | « ui/views/mouse_watcher.cc ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698