| Index: chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc
|
| diff --git a/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc b/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc
|
| index ee08de0100989767045c1412c6782a9f5fdbf6a5..986be19774ffd96c3ba2d8a463f8f78a47a1eb65 100644
|
| --- a/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc
|
| +++ b/chrome/browser/chromeos/accessibility/sticky_keys_browsertest.cc
|
| @@ -5,9 +5,7 @@
|
| #include <stddef.h>
|
|
|
| #include "ash/common/system/tray/system_tray.h"
|
| -#include "ash/common/test/wm_shell_test_api.h"
|
| #include "ash/common/wm_shell.h"
|
| -#include "ash/public/interfaces/new_window.mojom.h"
|
| #include "ash/shell.h"
|
| #include "ash/sticky_keys/sticky_keys_controller.h"
|
| #include "ash/sticky_keys/sticky_keys_overlay.h"
|
| @@ -32,40 +30,12 @@
|
|
|
| namespace chromeos {
|
|
|
| -class CountingNewWindowClient : public ash::mojom::NewWindowClient {
|
| - public:
|
| - CountingNewWindowClient() {}
|
| - ~CountingNewWindowClient() override {}
|
| -
|
| - int new_tab_action_count() const { return new_tab_action_count_; }
|
| -
|
| - // ash::mojom::NewWindowClient:
|
| - void NewTab() override { new_tab_action_count_++; }
|
| - void NewWindow(bool incognito) override {}
|
| - void OpenFileManager() override {}
|
| - void OpenCrosh() override {}
|
| - void OpenGetHelp() override {}
|
| - void RestoreTab() override {}
|
| - void ShowKeyboardOverlay() override {}
|
| - void ShowTaskManager() override {}
|
| - void OpenFeedbackPage() override {}
|
| -
|
| - private:
|
| - int new_tab_action_count_ = 0;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(CountingNewWindowClient);
|
| -};
|
| -
|
| class StickyKeysBrowserTest : public InProcessBrowserTest {
|
| public:
|
| void SetUpOnMainThread() override {
|
| content::BrowserTestBase::SetUpOnMainThread();
|
| event_generator_.reset(
|
| new ui::test::EventGenerator(browser()->window()->GetNativeWindow()));
|
| -
|
| - new_window_client_ = new CountingNewWindowClient;
|
| - ash::WmShellTestApi().SetNewWindowClient(
|
| - base::WrapUnique(new_window_client_));
|
| }
|
|
|
| protected:
|
| @@ -86,12 +56,13 @@ class StickyKeysBrowserTest : public InProcessBrowserTest {
|
|
|
| void SendKeyPress(ui::KeyboardCode key) {
|
| event_generator_->PressKey(key, ui::EF_NONE);
|
| + content::RunAllPendingInMessageLoop();
|
| event_generator_->ReleaseKey(key, ui::EF_NONE);
|
| + content::RunAllPendingInMessageLoop();
|
| }
|
|
|
| content::NotificationRegistrar registrar_;
|
| std::unique_ptr<ui::test::EventGenerator> event_generator_;
|
| - CountingNewWindowClient* new_window_client_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(StickyKeysBrowserTest);
|
| };
|
| @@ -128,23 +99,24 @@ IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, OpenNewTabs) {
|
| SendKeyPress(ui::VKEY_CONTROL);
|
|
|
| // In the locked state, pressing 't' should open a new tab each time.
|
| - int tab_count = 0;
|
| - for (; tab_count < 4; ++tab_count) {
|
| - EXPECT_EQ(tab_count, new_window_client_->new_tab_action_count());
|
| + TabStripModel* tab_strip_model = browser()->tab_strip_model();
|
| + int tab_count = 1;
|
| + for (; tab_count < 5; ++tab_count) {
|
| + EXPECT_EQ(tab_count, tab_strip_model->count());
|
| SendKeyPress(ui::VKEY_T);
|
| }
|
|
|
| // Unlock the modifier key and shortcut should no longer activate.
|
| SendKeyPress(ui::VKEY_CONTROL);
|
| SendKeyPress(ui::VKEY_T);
|
| - EXPECT_EQ(tab_count, new_window_client_->new_tab_action_count());
|
| + EXPECT_EQ(tab_count, tab_strip_model->count());
|
|
|
| // Shortcut should not work after disabling sticky keys.
|
| DisableStickyKeys();
|
| SendKeyPress(ui::VKEY_CONTROL);
|
| SendKeyPress(ui::VKEY_CONTROL);
|
| SendKeyPress(ui::VKEY_T);
|
| - EXPECT_EQ(tab_count, new_window_client_->new_tab_action_count());
|
| + EXPECT_EQ(tab_count, tab_strip_model->count());
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(StickyKeysBrowserTest, CtrlClickHomeButton) {
|
|
|