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

Side by Side Diff: chrome/browser/chromeos/accessibility/select_to_speak_browsertest.cc

Issue 2764643002: Add interactive UI test for Select-to-Speak (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
David Tseng 2017/03/20 23:40:20 nit: (c) not needed?
dmazzoni 2017/03/21 22:40:14 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/common/system/tray/system_tray.h"
6 #include "ash/shell.h"
7 #include "base/strings/pattern.h"
8 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
9 #include "chrome/browser/chromeos/accessibility/speech_monitor.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/notification_details.h"
13 #include "content/public/browser/notification_service.h"
14 #include "extensions/browser/notification_types.h"
15 #include "ui/events/test/event_generator.h"
16 #include "url/url_constants.h"
17
18 namespace chromeos {
19
20 class SelectToSpeakTest : public InProcessBrowserTest {
21 protected:
22 SelectToSpeakTest() {}
23 ~SelectToSpeakTest() override {}
24
25 void SetUpOnMainThread() override {
26 InProcessBrowserTest::SetUpOnMainThread();
27
28 ASSERT_FALSE(AccessibilityManager::Get()->IsSelectToSpeakEnabled());
29
30 content::WindowedNotificationObserver extension_load_waiter(
31 extensions::NOTIFICATION_EXTENSION_HOST_DID_STOP_FIRST_LOAD,
32 content::NotificationService::AllSources());
33 AccessibilityManager::Get()->SetSelectToSpeakEnabled(true);
34 extension_load_waiter.Wait();
35
36 root_window_ = ash::Shell::GetInstance()->GetPrimaryRootWindow();
37 generator_.reset(new ui::test::EventGenerator(root_window_));
38
39 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL));
40 }
41
42 SpeechMonitor speech_monitor_;
43 aura::Window* root_window_;
David Tseng 2017/03/20 23:40:20 This need not be a class member.
dmazzoni 2017/03/21 22:40:14 Done.
44 std::unique_ptr<ui::test::EventGenerator> generator_;
45
46 DISALLOW_COPY_AND_ASSIGN(SelectToSpeakTest);
47 };
48
49 IN_PROC_BROWSER_TEST_F(SelectToSpeakTest, SpeakStatusTray) {
50 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
51 gfx::Rect tray_bounds = tray->GetBoundsInScreen();
52
53 // Hold down Search and click a few pixels into the status tray bounds.
54 generator_->PressKey(ui::VKEY_LWIN, 0);
David Tseng 2017/03/20 23:40:20 0 /* ??? */
dmazzoni 2017/03/21 22:40:14 Done (flags)
55 generator_->MoveMouseTo(tray_bounds.x() + 8, tray_bounds.y() + 8);
56 generator_->PressLeftButton();
57 generator_->ReleaseLeftButton();
58 generator_->ReleaseKey(ui::VKEY_LWIN, 0);
59
60 EXPECT_TRUE(
61 base::MatchPattern(speech_monitor_.GetNextUtterance(), "Status tray*"));
62 }
63
64 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698