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

Unified Diff: ash/wm/overview/window_selector_unittest.cc

Issue 2276853002: [ash-md] Does not cancel overview when focus shifts from text fitler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Does not cancel overview when focus shifts from text fitler (comments) Created 4 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 | « ash/common/wm/overview/window_selector.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/overview/window_selector_unittest.cc
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc
index b5d7c6fc872f3fb6b54fc7891aed365a4042acd7..dae94166085709321c1155124e8863b853ae5e4d 100644
--- a/ash/wm/overview/window_selector_unittest.cc
+++ b/ash/wm/overview/window_selector_unittest.cc
@@ -13,6 +13,7 @@
#include "ash/common/shelf/shelf.h"
#include "ash/common/shelf/shelf_widget.h"
#include "ash/common/shell_window_ids.h"
+#include "ash/common/system/tray/system_tray.h"
#include "ash/common/test/material_design_controller_test_api.h"
#include "ash/common/wm/dock/docked_window_layout_manager.h"
#include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
@@ -1930,6 +1931,46 @@ TEST_P(WindowSelectorTest, TextFilteringSelection) {
EXPECT_EQ(GetSelectedWindow(), window2.get());
}
+// Tests that transferring focus from the text filter to a window that is not a
+// top level window does not cancel overview mode.
+TEST_P(WindowSelectorTest, ShowTextFilterMenu) {
+ gfx::Rect bounds(0, 0, 100, 100);
+ std::unique_ptr<aura::Window> window0(CreateWindow(bounds));
+ base::string16 window0_title = base::UTF8ToUTF16("Test");
+ window0->SetTitle(window0_title);
+ wm::GetWindowState(window0.get())->Minimize();
+ ToggleOverview();
+
+ EXPECT_FALSE(selection_widget_active());
+ EXPECT_FALSE(showing_filter_widget());
+ FilterItems("Test");
+
+ EXPECT_TRUE(selection_widget_active());
+ EXPECT_TRUE(showing_filter_widget());
+
+ // Open system bubble shifting focus from the text filter.
+ SystemTray* tray = GetPrimarySystemTray();
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
+ RunAllPendingInMessageLoop();
+
+ // This should not cancel overview mode.
+ ASSERT_TRUE(IsSelecting());
+ EXPECT_TRUE(selection_widget_active());
+ EXPECT_TRUE(showing_filter_widget());
+
+ // Click text filter to bring focus back.
+ ui::test::EventGenerator& generator = GetEventGenerator();
+ gfx::Point point_in_text_filter =
+ text_filter_widget()->GetWindowBoundsInScreen().CenterPoint();
+ generator.MoveMouseTo(point_in_text_filter);
+ generator.ClickLeftButton();
+ EXPECT_TRUE(IsSelecting());
+
+ // Cancel overview mode.
+ ToggleOverview();
+ ASSERT_FALSE(IsSelecting());
+}
+
// Tests clicking on the desktop itself to cancel overview mode.
TEST_P(WindowSelectorTest, CancelOverviewOnMouseClick) {
// Overview disabled by default.
« no previous file with comments | « ash/common/wm/overview/window_selector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698