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

Side by Side Diff: ash/system/status_area_widget_unittest.cc

Issue 2825383003: Fix stylus tools palette. (Closed)
Patch Set: Fix nits. Created 3 years, 7 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 | « ash/system/status_area_widget.cc ('k') | chrome/browser/about_flags.cc » ('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/system/status_area_widget.h" 5 #include "ash/system/status_area_widget.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/system/ime_menu/ime_menu_tray.h" 8 #include "ash/system/ime_menu/ime_menu_tray.h"
9 #include "ash/system/overview/overview_button_tray.h" 9 #include "ash/system/overview/overview_button_tray.h"
10 #include "ash/system/palette/palette_tray.h" 10 #include "ash/system/palette/palette_tray.h"
(...skipping 23 matching lines...) Expand all
34 // Auto-hidden shelf would not be forced to be visible. 34 // Auto-hidden shelf would not be forced to be visible.
35 EXPECT_FALSE(status->ShouldShowShelf()); 35 EXPECT_FALSE(status->ShouldShowShelf());
36 36
37 // Default trays are constructed. 37 // Default trays are constructed.
38 EXPECT_TRUE(status->overview_button_tray()); 38 EXPECT_TRUE(status->overview_button_tray());
39 EXPECT_TRUE(status->system_tray()); 39 EXPECT_TRUE(status->system_tray());
40 EXPECT_TRUE(status->web_notification_tray()); 40 EXPECT_TRUE(status->web_notification_tray());
41 EXPECT_TRUE(status->logout_button_tray_for_testing()); 41 EXPECT_TRUE(status->logout_button_tray_for_testing());
42 EXPECT_TRUE(status->ime_menu_tray()); 42 EXPECT_TRUE(status->ime_menu_tray());
43 EXPECT_TRUE(status->virtual_keyboard_tray_for_testing()); 43 EXPECT_TRUE(status->virtual_keyboard_tray_for_testing());
44 44 EXPECT_TRUE(status->palette_tray());
45 // Stylus palette is only constructed if hardware supports it.
46 EXPECT_FALSE(status->palette_tray());
47 45
48 // Needed because WebNotificationTray updates its initial visibility 46 // Needed because WebNotificationTray updates its initial visibility
49 // asynchronously. 47 // asynchronously.
50 RunAllPendingInMessageLoop(); 48 RunAllPendingInMessageLoop();
51 49
52 // Default trays are visible. 50 // Default trays are visible.
53 EXPECT_FALSE(status->overview_button_tray()->visible()); 51 EXPECT_FALSE(status->overview_button_tray()->visible());
54 EXPECT_TRUE(status->system_tray()->visible()); 52 EXPECT_TRUE(status->system_tray()->visible());
55 EXPECT_TRUE(status->web_notification_tray()->visible()); 53 EXPECT_TRUE(status->web_notification_tray()->visible());
56 EXPECT_FALSE(status->logout_button_tray_for_testing()->visible()); 54 EXPECT_FALSE(status->logout_button_tray_for_testing()->visible());
57 EXPECT_FALSE(status->ime_menu_tray()->visible()); 55 EXPECT_FALSE(status->ime_menu_tray()->visible());
58 EXPECT_FALSE(status->virtual_keyboard_tray_for_testing()->visible()); 56 EXPECT_FALSE(status->virtual_keyboard_tray_for_testing()->visible());
59 } 57 }
60 58
61 class StatusAreaWidgetPaletteTest : public test::AshTestBase { 59 class StatusAreaWidgetPaletteTest : public test::AshTestBase {
62 public: 60 public:
63 StatusAreaWidgetPaletteTest() {} 61 StatusAreaWidgetPaletteTest() {}
64 ~StatusAreaWidgetPaletteTest() override {} 62 ~StatusAreaWidgetPaletteTest() override {}
65 63
66 // testing::Test: 64 // testing::Test:
67 void SetUp() override { 65 void SetUp() override {
68 // TODO(erg): The implementation of PaletteTray assumes it can talk directly 66 // TODO(erg): The implementation of PaletteTray assumes it can talk directly
69 // to ui::InputDeviceManager in a mus environment, which it can't. 67 // to ui::InputDeviceManager in a mus environment, which it can't.
70 if (aura::Env::GetInstance()->mode() != aura::Env::Mode::MUS) { 68 if (aura::Env::GetInstance()->mode() != aura::Env::Mode::MUS) {
71 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); 69 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess();
72 cmd->AppendSwitch(switches::kAshForceEnablePalette); 70 cmd->AppendSwitch(switches::kAshForceEnableStylusTools);
73 // It's difficult to write a test that marks the primary display as 71 // It's difficult to write a test that marks the primary display as
74 // internal before the status area is constructed. Just force the palette 72 // internal before the status area is constructed. Just force the palette
75 // for all displays. 73 // for all displays.
76 cmd->AppendSwitch(switches::kAshEnablePaletteOnAllDisplays); 74 cmd->AppendSwitch(switches::kAshEnablePaletteOnAllDisplays);
77 } 75 }
78 AshTestBase::SetUp(); 76 AshTestBase::SetUp();
79 } 77 }
80 }; 78 };
81 79
82 // Tests that the stylus palette tray is constructed. 80 // Tests that the stylus palette tray is constructed.
83 TEST_F(StatusAreaWidgetPaletteTest, Basics) { 81 TEST_F(StatusAreaWidgetPaletteTest, Basics) {
84 // TODO(erg): The implementation of PaletteTray assumes it can talk directly 82 // TODO(erg): The implementation of PaletteTray assumes it can talk directly
85 // to ui::InputDeviceManager in a mus environment, which it can't. 83 // to ui::InputDeviceManager in a mus environment, which it can't.
86 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) 84 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS)
87 return; 85 return;
88 86
89 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); 87 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget();
90 EXPECT_TRUE(status->palette_tray()); 88 EXPECT_TRUE(status->palette_tray());
91 89
92 // Auto-hidden shelf would not be forced to be visible. 90 // Auto-hidden shelf would not be forced to be visible.
93 EXPECT_FALSE(status->ShouldShowShelf()); 91 EXPECT_FALSE(status->ShouldShowShelf());
94 } 92 }
95 93
96 } // namespace ash 94 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/status_area_widget.cc ('k') | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698