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

Side by Side Diff: chrome/browser/ui/webui/chromeos/keyboard_overlay_ui_browsertest.cc

Issue 2898273002: Move Voice Interaction shortcut to accelerator_controller.cc (Closed)
Patch Set: Move Voice Interaction shortcut to accelerator_controller.cc Created 3 years, 6 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
« no previous file with comments | « chrome/browser/ui/ash/app_list/app_list_presenter_service.cc ('k') | components/arc/arc_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "ash/accelerators/accelerator_table.h" 5 #include "ash/accelerators/accelerator_table.h"
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/tabs/tab_strip_model.h" 7 #include "chrome/browser/ui/tabs/tab_strip_model.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return is_display_ui_scaling_enabled; 52 return is_display_ui_scaling_enabled;
53 } 53 }
54 54
55 // Skip some accelerators in the tests: 55 // Skip some accelerators in the tests:
56 // 1. If the accelerator has no modifier, i.e. ui::EF_NONE, or for "Caps 56 // 1. If the accelerator has no modifier, i.e. ui::EF_NONE, or for "Caps
57 // Lock", such as ui::VKEY_MENU and ui::VKEY_LWIN, the logic to show it on 57 // Lock", such as ui::VKEY_MENU and ui::VKEY_LWIN, the logic to show it on
58 // the keyboard overlay is not by the mapping of 58 // the keyboard overlay is not by the mapping of
59 // keyboardOverlayData['shortcut'], so it can not be tested by this test. 59 // keyboardOverlayData['shortcut'], so it can not be tested by this test.
60 // 2. If it has debug modifiers: ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | 60 // 2. If it has debug modifiers: ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN |
61 // ui::EF_SHIFT_DOWN 61 // ui::EF_SHIFT_DOWN
62 // 3. If the shortcut action is device specific so it should not be shown
63 // on the keyboard overlay, i.e. START_VOICE_INTERACTION.
62 bool ShouldSkip(const ash::AcceleratorData& accelerator) { 64 bool ShouldSkip(const ash::AcceleratorData& accelerator) {
63 return accelerator.keycode == ui::VKEY_MENU || 65 return accelerator.keycode == ui::VKEY_MENU ||
64 accelerator.keycode == ui::VKEY_LWIN || 66 accelerator.keycode == ui::VKEY_LWIN ||
65 accelerator.modifiers == ui::EF_NONE || 67 accelerator.modifiers == ui::EF_NONE ||
66 accelerator.modifiers == 68 accelerator.modifiers ==
67 (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN); 69 (ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN | ui::EF_SHIFT_DOWN) ||
70 accelerator.action == ash::START_VOICE_INTERACTION;
68 } 71 }
69 72
70 std::string KeyboardCodeToLabel(const ash::AcceleratorData& accelerator, 73 std::string KeyboardCodeToLabel(const ash::AcceleratorData& accelerator,
71 content::WebContents* web_contents) { 74 content::WebContents* web_contents) {
72 std::string label; 75 std::string label;
73 EXPECT_TRUE(content::ExecuteScriptAndExtractString( 76 EXPECT_TRUE(content::ExecuteScriptAndExtractString(
74 web_contents, 77 web_contents,
75 "domAutomationController.send(" 78 "domAutomationController.send("
76 " (function(number) {" 79 " (function(number) {"
77 " if (!!KEYCODE_TO_LABEL[number]) {" 80 " if (!!KEYCODE_TO_LABEL[number]) {"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 167
165 const std::string shortcut = GenerateShortcutKey(entry, web_contents); 168 const std::string shortcut = GenerateShortcutKey(entry, web_contents);
166 EXPECT_FALSE(ContainsShortcut(shortcut, web_contents)) 169 EXPECT_FALSE(ContainsShortcut(shortcut, web_contents))
167 << "Please remove the deprecated accelerator '" + shortcut + 170 << "Please remove the deprecated accelerator '" + shortcut +
168 "' from the 'shortcut' section" 171 "' from the 'shortcut' section"
169 " at the bottom of the file of " 172 " at the bottom of the file of "
170 "'/chrome/browser/resources/chromeos/" 173 "'/chrome/browser/resources/chromeos/"
171 "keyboard_overlay_data.js'."; 174 "keyboard_overlay_data.js'.";
172 } 175 }
173 } 176 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/app_list/app_list_presenter_service.cc ('k') | components/arc/arc_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698