diff options
author | flackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-30 20:46:43 +0000 |
---|---|---|
committer | flackr@chromium.org <flackr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-30 20:46:43 +0000 |
commit | bd73d79350252013a5cfe43f0d4b97253a738a06 (patch) | |
tree | 91d743090fc27313022395c907adf194bdb9b6e1 /ash/wm/toplevel_window_event_handler_unittest.cc | |
parent | a15e5c0eb46320473f816321b26d34ac3ab4670e (diff) | |
download | chromium_src-bd73d79350252013a5cfe43f0d4b97253a738a06.zip chromium_src-bd73d79350252013a5cfe43f0d4b97253a738a06.tar.gz chromium_src-bd73d79350252013a5cfe43f0d4b97253a738a06.tar.bz2 |
Only drag or maximize / restore when event has not yet been handled.
BUG=332295
TEST=ToplevelWindowEventHandlerTest.DontDragIfModalChild, WorkspaceEventHandlerTest.DoubleClickOrTapWithModalChildDoesntMaximize
TEST=Press Ctrl+O and then try to double click or drag the browser window. It should not move or maximize.
Review URL: https://codereview.chromium.org/144193002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@248022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/toplevel_window_event_handler_unittest.cc')
-rw-r--r-- | ash/wm/toplevel_window_event_handler_unittest.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ash/wm/toplevel_window_event_handler_unittest.cc b/ash/wm/toplevel_window_event_handler_unittest.cc index 91a6215..e3b443f 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)); |