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

Unified Diff: ash/drag_drop/drag_drop_controller_unittest.cc

Issue 2206033002: mash: Migrate ash::DragImageView to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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 | « ash/drag_drop/drag_drop_controller.cc ('k') | ash/drag_drop/drag_image_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/drag_drop/drag_drop_controller_unittest.cc
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index 4d2911de55d5fe4c25c80c3a01883ac00310762c..1d18c7762b68303f6c23f02f43c3c24873744083 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -4,8 +4,8 @@
#include "ash/drag_drop/drag_drop_controller.h"
+#include "ash/common/drag_drop/drag_image_view.h"
#include "ash/drag_drop/drag_drop_tracker.h"
-#include "ash/drag_drop/drag_image_view.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/command_line.h"
@@ -1054,6 +1054,47 @@ TEST_F(DragDropControllerTest, DragCancelAcrossDisplays) {
}
}
+// Verifies that a drag is aborted if a display is disconnected during the drag.
+TEST_F(DragDropControllerTest, DragCancelOnDisplayDisconnect) {
+ if (!SupportsMultipleDisplays())
+ return;
+
+ UpdateDisplay("400x400,400x400");
+ for (aura::Window* root : Shell::GetInstance()->GetAllRootWindows()) {
+ aura::client::SetDragDropClient(root, drag_drop_controller_.get());
+ }
+
+ ui::OSExchangeData data;
+ data.SetString(base::UTF8ToUTF16("I am being dragged"));
+ std::unique_ptr<views::Widget> widget(CreateNewWidget());
+ aura::Window* window = widget->GetNativeWindow();
+ drag_drop_controller_->StartDragAndDrop(
+ data, window->GetRootWindow(), window, gfx::Point(5, 5),
+ ui::DragDropTypes::DRAG_MOVE, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+
+ // Start dragging.
+ ui::MouseEvent e1(ui::ET_MOUSE_DRAGGED, gfx::Point(200, 0),
+ gfx::Point(200, 0), ui::EventTimeForNow(), ui::EF_NONE,
+ ui::EF_NONE);
+ drag_drop_controller_->DragUpdate(window, e1);
+ EXPECT_TRUE(drag_drop_controller_->drag_start_received_);
+ EXPECT_TRUE(drag_drop_controller_->IsDragDropInProgress());
+
+ // Drag onto the secondary display.
+ ui::MouseEvent e2(ui::ET_MOUSE_DRAGGED, gfx::Point(600, 0),
+ gfx::Point(600, 0), ui::EventTimeForNow(), ui::EF_NONE,
+ ui::EF_NONE);
+ drag_drop_controller_->DragUpdate(window, e2);
+ EXPECT_TRUE(drag_drop_controller_->IsDragDropInProgress());
+
+ // Disconnect the secondary display.
+ UpdateDisplay("800x600");
+
+ // The drag is canceled.
+ EXPECT_TRUE(drag_drop_controller_->drag_canceled_);
+ EXPECT_FALSE(drag_drop_controller_->IsDragDropInProgress());
+}
+
TEST_F(DragDropControllerTest, TouchDragDropCompletesOnFling) {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableTouchDragDrop);
« no previous file with comments | « ash/drag_drop/drag_drop_controller.cc ('k') | ash/drag_drop/drag_image_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698