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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_action_view_interactive_uitest.cc

Issue 1661673004: Enables hot-tracking for overflow extension buttons in the app menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Restores hot-tracking of extension buttons in app menu with MD (nit) Created 4 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "chrome/browser/extensions/extension_action_test_util.h" 8 #include "chrome/browser/extensions/extension_action_test_util.h"
9 #include "chrome/browser/extensions/extension_browsertest.h" 9 #include "chrome/browser/extensions/extension_browsertest.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 void ActivateOverflowedActionWithKeyboard(Browser* browser, 66 void ActivateOverflowedActionWithKeyboard(Browser* browser,
67 const base::Closure& closure) { 67 const base::Closure& closure) {
68 AppMenuButton* app_menu_button = GetAppButtonFromBrowser(browser); 68 AppMenuButton* app_menu_button = GetAppButtonFromBrowser(browser);
69 EXPECT_TRUE(app_menu_button->IsMenuShowing()); 69 EXPECT_TRUE(app_menu_button->IsMenuShowing());
70 // We need to dispatch key events to the menu's native window, rather than the 70 // We need to dispatch key events to the menu's native window, rather than the
71 // browser's. 71 // browser's.
72 gfx::NativeWindow native_window = 72 gfx::NativeWindow native_window =
73 views::MenuController::GetActiveInstance()->owner()->GetNativeWindow(); 73 views::MenuController::GetActiveInstance()->owner()->GetNativeWindow();
74 74
75 // Send two key down events followed by the return key. 75 // Send a key down event followed by the return key.
76 // The two key down events target the toolbar action in the app menu. 76 // The key down event targets the toolbar action in the app menu.
77 // TODO(devlin): Shouldn't this be one key down event?
78 ui_controls::SendKeyPress(native_window, 77 ui_controls::SendKeyPress(native_window,
79 ui::VKEY_DOWN, 78 ui::VKEY_DOWN,
80 false, false, false, false); 79 false, false, false, false);
81 ui_controls::SendKeyPress(native_window,
82 ui::VKEY_DOWN,
83 false, false, false, false);
84 ui_controls::SendKeyPressNotifyWhenDone(native_window, 80 ui_controls::SendKeyPressNotifyWhenDone(native_window,
85 ui::VKEY_RETURN, 81 ui::VKEY_RETURN,
86 false, false, false, false, closure); 82 false, false, false, false, closure);
87 } 83 }
88 84
89 // Tests the context menu of an overflowed action. 85 // Tests the context menu of an overflowed action.
90 void TestWhileContextMenuOpen(bool* did_test_while_menu_open, 86 void TestWhileContextMenuOpen(bool* did_test_while_menu_open,
91 Browser* browser, 87 Browser* browser,
92 ToolbarActionView* context_menu_action) { 88 ToolbarActionView* context_menu_action) {
93 *did_test_while_menu_open = true; 89 *did_test_while_menu_open = true;
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP, 390 ui_controls::LEFT, ui_controls::DOWN | ui_controls::UP,
395 base::Bind(&ActivateOverflowedActionWithKeyboard, 391 base::Bind(&ActivateOverflowedActionWithKeyboard,
396 browser(), loop.QuitClosure())); 392 browser(), loop.QuitClosure()));
397 loop.Run(); 393 loop.Run();
398 394
399 // The app menu should no longer be showing. 395 // The app menu should no longer be showing.
400 EXPECT_FALSE(app_menu_button->IsMenuShowing()); 396 EXPECT_FALSE(app_menu_button->IsMenuShowing());
401 // And the extension should have been activated. 397 // And the extension should have been activated.
402 EXPECT_TRUE(listener.WaitUntilSatisfied()); 398 EXPECT_TRUE(listener.WaitUntilSatisfied());
403 } 399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698