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

Unified Diff: ash/wm/custom_frame_view_ash_unittest.cc

Issue 10825343: Fixing focussing issue when bubble opens (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | « no previous file | ash/wm/maximize_bubble_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/custom_frame_view_ash_unittest.cc
diff --git a/ash/wm/custom_frame_view_ash_unittest.cc b/ash/wm/custom_frame_view_ash_unittest.cc
index ae1d9464449b31e73a40c2dc02a461aefe88238c..ff303bf45abb099f4e94e5bb3c1bbdbf1a370325 100644
--- a/ash/wm/custom_frame_view_ash_unittest.cc
+++ b/ash/wm/custom_frame_view_ash_unittest.cc
@@ -12,6 +12,7 @@
#include "ash/wm/workspace/snap_sizer.h"
#include "base/command_line.h"
#include "ui/aura/aura_switches.h"
+#include "ui/aura/focus_manager.h"
#include "ui/aura/test/event_generator.h"
#include "ui/aura/window.h"
#include "ui/views/controls/button/image_button.h"
@@ -371,5 +372,30 @@ TEST_F(CustomFrameViewAshTest, MaximizeLeftByButton) {
EXPECT_EQ(sizer.target_bounds().ToString(), window->bounds().ToString());
}
+// Test that the activation focus does not change when the bubble gets shown.
+TEST_F(CustomFrameViewAshTest, MaximizeKeepFocus) {
+ views::Widget* widget = CreateWidget();
+ aura::Window* window = widget->GetNativeWindow();
+ CustomFrameViewAsh* frame = custom_frame_view_ash(widget);
+ CustomFrameViewAsh::TestApi test(frame);
+ ash::FrameMaximizeButton* maximize_button = test.maximize_button();
+ maximize_button->set_bubble_appearance_delay_ms(0);
+ 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);
+ EXPECT_FALSE(maximize_button->maximizer());
+ EXPECT_TRUE(ash::wm::IsWindowNormal(window));
+
+ aura::Window* active = window->GetFocusManager()->GetFocusedWindow();
+
+ // Move the mouse cursor over the button to bring up the maximizer bubble.
+ generator.MoveMouseTo(button_pos);
+ EXPECT_TRUE(maximize_button->maximizer());
+
+ // Check that the focused window is still the same.
+ EXPECT_EQ(active, window->GetFocusManager()->GetFocusedWindow());
+}
+
} // namespace internal
} // namespace ash
« no previous file with comments | « no previous file | ash/wm/maximize_bubble_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698