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

Unified Diff: ash/system/overview/overview_button_tray_unittest.cc

Issue 2882073004: wm: Allow double tap on overview button to quick switch. (Closed)
Patch Set: Use tap_count(). Created 3 years, 7 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/system/overview/overview_button_tray.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/overview/overview_button_tray_unittest.cc
diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc
index a752f13e02b80941c0b312f7aa142f2b47eb34e0..fad6c047215d3ae13c3250385c8a8049ca8348ef 100644
--- a/ash/system/overview/overview_button_tray_unittest.cc
+++ b/ash/system/overview/overview_button_tray_unittest.cc
@@ -18,6 +18,7 @@
#include "ash/test/status_area_widget_test_helper.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/wm/overview/window_selector_controller.h"
+#include "ash/wm/window_util.h"
#include "base/command_line.h"
#include "base/test/user_action_tester.h"
#include "base/time/time.h"
@@ -108,6 +109,45 @@ TEST_F(OverviewButtonTrayTest, PerformAction) {
ui::GestureEventDetails(ui::ET_GESTURE_TAP));
GetTray()->PerformAction(tap);
EXPECT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting());
+
+ // Verify tapping on the button again closes overview mode.
+ GetTray()->PerformAction(tap);
+ EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting());
+}
+
+TEST_F(OverviewButtonTrayTest, PerformDoubleTapAction) {
+ ASSERT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting());
+
+ // Verify that when we only have one active window, a double tap will act as a
+ // two single taps and open then close overview mode.
sadrul 2017/05/18 13:41:38 I don't think this case is actually tested. Can yo
sammiequon 2017/05/18 16:19:06 Done.
+ std::unique_ptr<aura::Window> window1(
+ CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
+ wm::ActivateWindow(window1.get());
James Cook 2017/05/18 15:10:54 Do you have to activate this one?
sammiequon 2017/05/18 16:19:06 Nope. Removed.
+
+ // Add a secondary active window to test quick switch.
+ std::unique_ptr<aura::Window> window2(
+ CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
+ wm::ActivateWindow(window2.get());
+ EXPECT_TRUE(wm::IsActiveWindow(window2.get()));
+
+ // Verify that after double tapping, we have switched to window 1.
+ ui::GestureEventDetails double_tap_details(ui::ET_GESTURE_TAP);
+ double_tap_details.set_tap_count(2);
+ ui::GestureEvent double_tap(0, 0, 0, base::TimeTicks(), double_tap_details);
+ GetTray()->PerformAction(double_tap);
+ EXPECT_TRUE(wm::IsActiveWindow(window1.get()));
+ EXPECT_FALSE(Shell::Get()->window_selector_controller()->IsSelecting());
+
+ // Verify that if we double tap on the window selection page, nothing happens
+ // and both windows are not the active window.
+ ui::GestureEvent tap(0, 0, 0, base::TimeTicks(),
+ ui::GestureEventDetails(ui::ET_GESTURE_TAP));
+ GetTray()->PerformAction(tap);
+ ASSERT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting());
+ GetTray()->PerformAction(double_tap);
+ EXPECT_FALSE(wm::IsActiveWindow(window1.get()));
+ EXPECT_FALSE(wm::IsActiveWindow(window2.get()));
+ EXPECT_TRUE(Shell::Get()->window_selector_controller()->IsSelecting());
James Cook 2017/05/18 15:10:54 Nice test - easy to read. I like the style of bloc
sammiequon 2017/05/18 16:19:06 Thanks :-).
}
// Tests that tapping on the control will record the user action Tray_Overview.
« no previous file with comments | « ash/system/overview/overview_button_tray.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698