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

Unified Diff: ash/wm/toplevel_window_event_handler_unittest.cc

Issue 144193002: Only drag or maximize / restore when event has not yet been handled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Always ignore handled events. Created 6 years, 11 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: ash/wm/toplevel_window_event_handler_unittest.cc
diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc
index b677b76fe874a200157dc6d1515f499e06b847ee..1a5e53bf0ba107fa8bedbc44c68067341a425060 100644
--- a/ash/wm/toplevel_window_event_handler_unittest.cc
+++ b/ash/wm/toplevel_window_event_handler_unittest.cc
@@ -27,6 +27,7 @@
#include "ui/base/hit_test.h"
#include "ui/events/event.h"
#include "ui/gfx/screen.h"
+#include "ui/views/corewm/window_util.h"
#if defined(OS_WIN)
// Windows headers define macros for these function names which screw with us.
@@ -352,6 +353,25 @@ TEST_F(ToplevelWindowEventHandlerTest, BottomWorkArea) {
target->bounds().size().ToString());
}
+TEST_F(ToplevelWindowEventHandlerTest, DontDragIfModalChild) {
+ scoped_ptr<aura::Window> w1(CreateWindow(HTCAPTION));
+ scoped_ptr<aura::Window> w2(CreateWindow(HTCAPTION));
+ w2->SetBounds(gfx::Rect(100, 0, 100, 100));
+ w2->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW);
+ views::corewm::AddTransientChild(w1.get(), w2.get());
+ gfx::Size size = w1->bounds().size();
+
+ // Attempt to drag w1, position and size should not change because w1 has a
+ // modal child.
+ DragFromCenterBy(w1.get(), 100, 100);
+ EXPECT_EQ("0,0", w1->bounds().origin().ToString());
+ EXPECT_EQ(size.ToString(), w1->bounds().size().ToString());
+
+ TouchDragFromCenterBy(w1.get(), 100, 100);
+ EXPECT_EQ("0,0", w1->bounds().origin().ToString());
+ EXPECT_EQ(size.ToString(), w1->bounds().size().ToString());
+}
+
// Verifies we don't let windows drag to a -y location.
TEST_F(ToplevelWindowEventHandlerTest, DontDragToNegativeY) {
scoped_ptr<aura::Window> target(CreateWindow(HTTOP));

Powered by Google App Engine
This is Rietveld 408576698