diff options
author | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 00:58:49 +0000 |
---|---|---|
committer | skuhne@chromium.org <skuhne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-12 00:58:49 +0000 |
commit | 74b3538c259eab77b04036e89aa6f6a8cc718582 (patch) | |
tree | b83dc3da453b0de7ed3c8b8c53042aeb13fdd9b7 /ash | |
parent | c54e0e9c4c9e49e49c7d7f43b10459ff1a0666cd (diff) | |
download | chromium_src-74b3538c259eab77b04036e89aa6f6a8cc718582.zip chromium_src-74b3538c259eab77b04036e89aa6f6a8cc718582.tar.gz chromium_src-74b3538c259eab77b04036e89aa6f6a8cc718582.tar.bz2 |
Closing the maximizer bubble upon minimizer keystroke
BUG=147677
TEST=unit test
Review URL: https://chromiumcodereview.appspot.com/10908206
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156196 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash')
-rw-r--r-- | ash/wm/custom_frame_view_ash_unittest.cc | 27 | ||||
-rw-r--r-- | ash/wm/workspace/frame_maximize_button.cc | 6 | ||||
-rw-r--r-- | ash/wm/workspace/frame_maximize_button.h | 3 |
3 files changed, 36 insertions, 0 deletions
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc index d1ae80d..7686743 100644 --- a/ash/wm/custom_frame_view_ash_unittest.cc +++ b/ash/wm/custom_frame_view_ash_unittest.cc @@ -608,5 +608,32 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftMaximizeRestore) { EXPECT_EQ(NULL, window->GetProperty(aura::client::kRestoreBoundsKey)); } +// Test that minimizing the window per keyboard closes the maximize bubble. +TEST_F(CustomFrameViewAshTest, MinimizePerKeyClosesBubble) { + views::Widget* widget = CreateWidget(); + aura::Window* window = widget->GetNativeWindow(); + widget->SetBounds(gfx::Rect(10, 10, 100, 100)); + CustomFrameViewAsh* frame = custom_frame_view_ash(widget); + CustomFrameViewAsh::TestApi test(frame); + ash::FrameMaximizeButton* maximize_button = test.maximize_button(); + + gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); + gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100); + + aura::test::EventGenerator generator(window->GetRootWindow(), off_pos); + generator.MoveMouseTo(off_pos); + EXPECT_FALSE(maximize_button->maximizer()); + + // Move the mouse cursor over the maximize button. + generator.MoveMouseTo(button_pos); + EXPECT_TRUE(maximize_button->maximizer()); + + // We simulate the keystroke by calling minimizeWindow directly. + wm::MinimizeWindow(window); + + EXPECT_TRUE(ash::wm::IsWindowMinimized(window)); + EXPECT_FALSE(maximize_button->maximizer()); +} + } // namespace internal } // namespace ash diff --git a/ash/wm/workspace/frame_maximize_button.cc b/ash/wm/workspace/frame_maximize_button.cc index 735b1a6..1654068b 100644 --- a/ash/wm/workspace/frame_maximize_button.cc +++ b/ash/wm/workspace/frame_maximize_button.cc @@ -181,6 +181,12 @@ void FrameMaximizeButton::OnWindowBoundsChanged( Cancel(false); } +void FrameMaximizeButton::OnWindowPropertyChanged(aura::Window* window, + const void* key, + intptr_t old) { + Cancel(false); +} + void FrameMaximizeButton::OnWindowDestroying(aura::Window* window) { maximizer_.reset(); if (window_) { diff --git a/ash/wm/workspace/frame_maximize_button.h b/ash/wm/workspace/frame_maximize_button.h index a7f431c..819adc5 100644 --- a/ash/wm/workspace/frame_maximize_button.h +++ b/ash/wm/workspace/frame_maximize_button.h @@ -52,6 +52,9 @@ class ASH_EXPORT FrameMaximizeButton : public views::ImageButton, virtual void OnWindowBoundsChanged(aura::Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) OVERRIDE; + virtual void OnWindowPropertyChanged(aura::Window* window, + const void* key, + intptr_t old) OVERRIDE; virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; // ImageButton overrides: |