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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/accessibility_delegate.h" 9 #include "ash/common/accessibility_delegate.h"
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
11 #include "ash/common/ash_switches.h" 11 #include "ash/common/ash_switches.h"
12 #include "ash/common/material_design/material_design_controller.h" 12 #include "ash/common/material_design/material_design_controller.h"
13 #include "ash/common/shelf/shelf.h" 13 #include "ash/common/shelf/shelf.h"
14 #include "ash/common/shelf/shelf_widget.h" 14 #include "ash/common/shelf/shelf_widget.h"
15 #include "ash/common/shell_window_ids.h" 15 #include "ash/common/shell_window_ids.h"
16 #include "ash/common/system/tray/system_tray.h"
16 #include "ash/common/test/material_design_controller_test_api.h" 17 #include "ash/common/test/material_design_controller_test_api.h"
17 #include "ash/common/wm/dock/docked_window_layout_manager.h" 18 #include "ash/common/wm/dock/docked_window_layout_manager.h"
18 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 19 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
19 #include "ash/common/wm/mru_window_tracker.h" 20 #include "ash/common/wm/mru_window_tracker.h"
20 #include "ash/common/wm/overview/scoped_transform_overview_window.h" 21 #include "ash/common/wm/overview/scoped_transform_overview_window.h"
21 #include "ash/common/wm/overview/window_grid.h" 22 #include "ash/common/wm/overview/window_grid.h"
22 #include "ash/common/wm/overview/window_selector.h" 23 #include "ash/common/wm/overview/window_selector.h"
23 #include "ash/common/wm/overview/window_selector_controller.h" 24 #include "ash/common/wm/overview/window_selector_controller.h"
24 #include "ash/common/wm/overview/window_selector_item.h" 25 #include "ash/common/wm/overview/window_selector_item.h"
25 #include "ash/common/wm/panels/panel_layout_manager.h" 26 #include "ash/common/wm/panels/panel_layout_manager.h"
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 1924
1924 // Dimming all the items should hide the selection widget. 1925 // Dimming all the items should hide the selection widget.
1925 FilterItems("Pop"); 1926 FilterItems("Pop");
1926 EXPECT_FALSE(selection_widget_active()); 1927 EXPECT_FALSE(selection_widget_active());
1927 1928
1928 // Undimming one window should automatically select it. 1929 // Undimming one window should automatically select it.
1929 FilterItems("Rock and roll"); 1930 FilterItems("Rock and roll");
1930 EXPECT_EQ(GetSelectedWindow(), window2.get()); 1931 EXPECT_EQ(GetSelectedWindow(), window2.get());
1931 } 1932 }
1932 1933
1934 // Tests that transferring focus from the text filter to a window that is not a
1935 // top level window does not cancel overview mode.
1936 TEST_P(WindowSelectorTest, ShowTextFilterMenu) {
1937 gfx::Rect bounds(0, 0, 100, 100);
1938 std::unique_ptr<aura::Window> window0(CreateWindow(bounds));
1939 base::string16 window0_title = base::UTF8ToUTF16("Test");
1940 window0->SetTitle(window0_title);
1941 wm::GetWindowState(window0.get())->Minimize();
1942 ToggleOverview();
1943
1944 EXPECT_FALSE(selection_widget_active());
1945 EXPECT_FALSE(showing_filter_widget());
1946 FilterItems("Test");
1947
1948 EXPECT_TRUE(selection_widget_active());
1949 EXPECT_TRUE(showing_filter_widget());
1950
1951 // Open system bubble shifting focus from the text filter.
tdanderson 2016/08/24 14:49:25 So what happens if you do the following? 1) Enter
varkha 2016/08/24 16:53:54 Activation of Settings WebUI window in step 4 will
tdanderson 2016/08/24 17:43:52 Acknowledged.
1952 SystemTray* tray = GetPrimarySystemTray();
1953 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
1954 RunAllPendingInMessageLoop();
1955
1956 // This should not cancel overview mode.
1957 ASSERT_TRUE(IsSelecting());
1958 EXPECT_TRUE(selection_widget_active());
1959 EXPECT_TRUE(showing_filter_widget());
1960
1961 // Click text filter to bring focus back.
1962 ui::test::EventGenerator& generator = GetEventGenerator();
1963 gfx::Point point_in_text_filter =
1964 text_filter_widget()->GetWindowBoundsInScreen().CenterPoint();
1965 generator.MoveMouseTo(point_in_text_filter);
1966 generator.ClickLeftButton();
1967 EXPECT_TRUE(IsSelecting());
1968
1969 // Cancel overview mode.
1970 ToggleOverview();
1971 ASSERT_FALSE(IsSelecting());
1972 }
1973
1933 // Tests clicking on the desktop itself to cancel overview mode. 1974 // Tests clicking on the desktop itself to cancel overview mode.
1934 TEST_P(WindowSelectorTest, CancelOverviewOnMouseClick) { 1975 TEST_P(WindowSelectorTest, CancelOverviewOnMouseClick) {
1935 // Overview disabled by default. 1976 // Overview disabled by default.
1936 EXPECT_FALSE(IsSelecting()); 1977 EXPECT_FALSE(IsSelecting());
1937 1978
1938 // Point and bounds selected so that they don't intersect. This causes 1979 // Point and bounds selected so that they don't intersect. This causes
1939 // events located at the point to be passed to DesktopBackgroundController, 1980 // events located at the point to be passed to DesktopBackgroundController,
1940 // and not the window. 1981 // and not the window.
1941 gfx::Point point_in_background_page(0, 0); 1982 gfx::Point point_in_background_page(0, 0);
1942 gfx::Rect bounds(10, 10, 100, 100); 1983 gfx::Rect bounds(10, 10, 100, 100);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2079 bounds.y()); 2120 bounds.y());
2080 EXPECT_LE(transformed_rect.bottom(), bounds.bottom()); 2121 EXPECT_LE(transformed_rect.bottom(), bounds.bottom());
2081 EXPECT_NEAR(transformed_rect.x() - bounds.x(), 2122 EXPECT_NEAR(transformed_rect.x() - bounds.x(),
2082 bounds.right() - transformed_rect.right(), 1); 2123 bounds.right() - transformed_rect.right(), 1);
2083 EXPECT_NEAR( 2124 EXPECT_NEAR(
2084 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(), 2125 transformed_rect.y() + (int)(scale * inset) - header_height - bounds.y(),
2085 bounds.bottom() - transformed_rect.bottom(), 1); 2126 bounds.bottom() - transformed_rect.bottom(), 1);
2086 } 2127 }
2087 2128
2088 } // namespace ash 2129 } // namespace ash
OLDNEW
« ash/common/wm/overview/window_selector.cc ('K') | « 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