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

Unified Diff: chrome/browser/ui/browser_command_controller_unittest.cc

Issue 2698013004: Revert 3c7af99, but keep only IsReservedCommandOrKey change (Closed)
Patch Set: Resolve review comments Created 3 years, 10 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 | « chrome/browser/ui/browser_command_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_command_controller_unittest.cc
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index 22a62f7fa9311ca61ae57882003d026b6d767e54..ee63765fe5508834673edd0e6ad399b019dc081d 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -359,18 +359,34 @@ TEST_F(BrowserCommandControllerFullscreenTest,
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS));
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ABOUT));
EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU));
+ EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
// In fullscreen, only the exit fullscreen commands are reserved. All other
- // shortcuts are unreserved. See https://goo.gl/4tJ32G.
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_CLOSE_TAB));
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_CLOSE_WINDOW));
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_NEW_INCOGNITO_WINDOW));
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_NEW_TAB));
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_NEW_WINDOW));
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SELECT_NEXT_TAB));
- EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_SELECT_PREVIOUS_TAB));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_EXIT));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
+ // shortcuts should be delivered to the web page. See https://goo.gl/4tJ32G.
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_CLOSE_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_CLOSE_WINDOW,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_NEW_INCOGNITO_WINDOW,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_NEW_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_NEW_WINDOW,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_SELECT_NEXT_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_FALSE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_SELECT_PREVIOUS_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_EXIT,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
// Exit fullscreen.
chrome::ToggleFullscreenMode(browser());
@@ -395,16 +411,33 @@ TEST_F(BrowserCommandControllerFullscreenTest,
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_VIEW_PASSWORDS));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ABOUT));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SHOW_APP_MENU));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_CLOSE_TAB));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_CLOSE_WINDOW));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_NEW_INCOGNITO_WINDOW));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_NEW_TAB));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_NEW_WINDOW));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SELECT_NEXT_TAB));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_SELECT_PREVIOUS_TAB));
- EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_EXIT));
EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_CLOSE_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_CLOSE_WINDOW,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_NEW_INCOGNITO_WINDOW,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_NEW_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_NEW_WINDOW,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_SELECT_NEXT_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_SELECT_PREVIOUS_TAB,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+ EXPECT_TRUE(browser()->command_controller()->IsReservedCommandOrKey(
+ IDC_EXIT,
+ content::NativeWebKeyboardEvent(blink::WebInputEvent::TypeFirst, 0, 0)));
+
// Guest Profiles disallow some options.
TestingProfile* testprofile = browser()->profile()->AsTestingProfile();
EXPECT_TRUE(testprofile);
« no previous file with comments | « chrome/browser/ui/browser_command_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698