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

Unified Diff: ash/wm/dock/docked_window_resizer_unittest.cc

Issue 46893003: Undock window when reverting a drag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undock window when reverting a drag Created 7 years, 1 month 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/wm/dock/docked_window_resizer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/dock/docked_window_resizer_unittest.cc
diff --git a/ash/wm/dock/docked_window_resizer_unittest.cc b/ash/wm/dock/docked_window_resizer_unittest.cc
index 3d2cd773f30a5e021edcc0324a41d7cdd1305fd9..d9ac13f5747e2d8efde083ab56a958e1e5a81158 100644
--- a/ash/wm/dock/docked_window_resizer_unittest.cc
+++ b/ash/wm/dock/docked_window_resizer_unittest.cc
@@ -563,7 +563,7 @@ TEST_P(DockedWindowResizerTest, AttachOnTwoSides) {
EXPECT_EQ(internal::kShellWindowId_DefaultContainer, w2->parent()->id());
}
-// Reverting drag
+// Tests that reverting a drag restores docked state if a window was docked.
TEST_P(DockedWindowResizerTest, RevertDragRestoresAttachment) {
if (!SupportsHostWindowResize())
return;
@@ -590,6 +590,20 @@ TEST_P(DockedWindowResizerTest, RevertDragRestoresAttachment) {
window->parent()->id());
}
+// Tests that reverting drag restores undocked state if a window was not docked.
+TEST_P(DockedWindowResizerTest, RevertDockedDragRevertsAttachment) {
+ if (!SupportsHostWindowResize())
+ return;
+ scoped_ptr<aura::Window> window(CreateTestWindow(gfx::Rect(0, 0, 201, 201)));
+ int previous_container_id = window->parent()->id();
+ // Drag the window out but revert the drag
+ ASSERT_NO_FATAL_FAILURE(DragStart(window.get()));
+ DragMove(-50 - window->bounds().x(), 50 - window->bounds().y());
+ EXPECT_EQ(CorrectContainerIdDuringDrag(), window->parent()->id());
+ DragRevert();
+ EXPECT_EQ(previous_container_id, window->parent()->id());
+}
+
// Move a docked window to the second display
TEST_P(DockedWindowResizerTest, DragAcrossDisplays) {
if (!SupportsMultipleDisplays())
« no previous file with comments | « ash/wm/dock/docked_window_resizer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698