| OLD | NEW |
| 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" |
| 11 #include "ash/system/session/logout_button_tray.h" | 11 #include "ash/system/session/logout_button_tray.h" |
| 12 #include "ash/system/tray/system_tray.h" | 12 #include "ash/system/tray/system_tray.h" |
| 13 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" | 13 #include "ash/system/virtual_keyboard/virtual_keyboard_tray.h" |
| 14 #include "ash/system/web_notification/web_notification_tray.h" | 14 #include "ash/system/web_notification/web_notification_tray.h" |
| 15 #include "ash/test/ash_test_base.h" | 15 #include "ash/test/ash_test_base.h" |
| 16 #include "ash/test/status_area_widget_test_helper.h" | 16 #include "ash/test/status_area_widget_test_helper.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "ui/aura/env.h" |
| 18 | 19 |
| 19 namespace ash { | 20 namespace ash { |
| 20 | 21 |
| 21 using StatusAreaWidgetTest = test::AshTestBase; | 22 using StatusAreaWidgetTest = test::AshTestBase; |
| 22 | 23 |
| 23 // Tests that status area trays are constructed. | 24 // Tests that status area trays are constructed. |
| 24 TEST_F(StatusAreaWidgetTest, Basics) { | 25 TEST_F(StatusAreaWidgetTest, Basics) { |
| 25 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); | 26 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); |
| 26 | 27 |
| 27 // Status area is visible by default. | 28 // Status area is visible by default. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 57 EXPECT_FALSE(status->virtual_keyboard_tray_for_testing()->visible()); | 58 EXPECT_FALSE(status->virtual_keyboard_tray_for_testing()->visible()); |
| 58 } | 59 } |
| 59 | 60 |
| 60 class StatusAreaWidgetPaletteTest : public test::AshTestBase { | 61 class StatusAreaWidgetPaletteTest : public test::AshTestBase { |
| 61 public: | 62 public: |
| 62 StatusAreaWidgetPaletteTest() {} | 63 StatusAreaWidgetPaletteTest() {} |
| 63 ~StatusAreaWidgetPaletteTest() override {} | 64 ~StatusAreaWidgetPaletteTest() override {} |
| 64 | 65 |
| 65 // testing::Test: | 66 // testing::Test: |
| 66 void SetUp() override { | 67 void SetUp() override { |
| 67 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 68 // TODO(erg): The implementation of PaletteTray assumes it can talk directly |
| 68 cmd->AppendSwitch(switches::kAshForceEnablePalette); | 69 // to ui::InputDeviceManager in a mus environment, which it can't. |
| 69 // It's difficult to write a test that marks the primary display as | 70 if (aura::Env::GetInstance()->mode() != aura::Env::Mode::MUS) { |
| 70 // internal before the status area is constructed. Just force the palette | 71 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 71 // for all displays. | 72 cmd->AppendSwitch(switches::kAshForceEnablePalette); |
| 72 cmd->AppendSwitch(switches::kAshEnablePaletteOnAllDisplays); | 73 // 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 |
| 75 // for all displays. |
| 76 cmd->AppendSwitch(switches::kAshEnablePaletteOnAllDisplays); |
| 77 } |
| 73 AshTestBase::SetUp(); | 78 AshTestBase::SetUp(); |
| 74 } | 79 } |
| 75 }; | 80 }; |
| 76 | 81 |
| 77 // Tests that the stylus palette tray is constructed. | 82 // Tests that the stylus palette tray is constructed. |
| 78 TEST_F(StatusAreaWidgetPaletteTest, Basics) { | 83 TEST_F(StatusAreaWidgetPaletteTest, Basics) { |
| 84 // TODO(erg): The implementation of PaletteTray assumes it can talk directly |
| 85 // to ui::InputDeviceManager in a mus environment, which it can't. |
| 86 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) |
| 87 return; |
| 88 |
| 79 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); | 89 StatusAreaWidget* status = StatusAreaWidgetTestHelper::GetStatusAreaWidget(); |
| 80 EXPECT_TRUE(status->palette_tray()); | 90 EXPECT_TRUE(status->palette_tray()); |
| 81 | 91 |
| 82 // Auto-hidden shelf would not be forced to be visible. | 92 // Auto-hidden shelf would not be forced to be visible. |
| 83 EXPECT_FALSE(status->ShouldShowShelf()); | 93 EXPECT_FALSE(status->ShouldShowShelf()); |
| 84 } | 94 } |
| 85 | 95 |
| 86 } // namespace ash | 96 } // namespace ash |
| OLD | NEW |