| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/brightness/tray_brightness.h" | 5 #include "ash/system/chromeos/brightness/tray_brightness.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
| 10 #include "ash/common/system/tray/system_tray_item.h" | 10 #include "ash/common/system/tray/system_tray_item.h" |
| 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 11 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 12 #include "ash/common/wm_shell.h" |
| 12 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 13 #include "ash/test/ash_test_base.h" | 14 #include "ash/test/ash_test_base.h" |
| 14 #include "ash/test/status_area_widget_test_helper.h" | 15 #include "ash/test/status_area_widget_test_helper.h" |
| 15 #include "ui/views/view.h" | 16 #include "ui/views/view.h" |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 class TrayBrightnessTest : public test::AshTestBase { | 20 class TrayBrightnessTest : public test::AshTestBase { |
| 20 public: | 21 public: |
| 21 TrayBrightnessTest() {} | 22 TrayBrightnessTest() {} |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 // Tests that when the default view is initially created, that its | 42 // Tests that when the default view is initially created, that its |
| 42 // BrightnessView is created not visible. | 43 // BrightnessView is created not visible. |
| 43 TEST_F(TrayBrightnessTest, CreateDefaultView) { | 44 TEST_F(TrayBrightnessTest, CreateDefaultView) { |
| 44 std::unique_ptr<views::View> tray(CreateDefaultView()); | 45 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 45 EXPECT_FALSE(tray->visible()); | 46 EXPECT_FALSE(tray->visible()); |
| 46 } | 47 } |
| 47 | 48 |
| 48 // Tests the construction of the default view while MaximizeMode is active. | 49 // Tests the construction of the default view while MaximizeMode is active. |
| 49 // The BrightnessView should be visible. | 50 // The BrightnessView should be visible. |
| 50 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) { | 51 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) { |
| 51 Shell::GetInstance() | 52 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 52 ->maximize_mode_controller() | 53 true); |
| 53 ->EnableMaximizeModeWindowManager(true); | |
| 54 std::unique_ptr<views::View> tray(CreateDefaultView()); | 54 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 55 EXPECT_TRUE(tray->visible()); | 55 EXPECT_TRUE(tray->visible()); |
| 56 Shell::GetInstance() | 56 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 57 ->maximize_mode_controller() | 57 false); |
| 58 ->EnableMaximizeModeWindowManager(false); | |
| 59 } | 58 } |
| 60 | 59 |
| 61 // Tests that the enabling of MaximizeMode affects a previously created | 60 // Tests that the enabling of MaximizeMode affects a previously created |
| 62 // BrightnessView, changing the visibility. | 61 // BrightnessView, changing the visibility. |
| 63 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { | 62 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { |
| 64 std::unique_ptr<views::View> tray(CreateDefaultView()); | 63 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 65 Shell::GetInstance() | 64 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 66 ->maximize_mode_controller() | 65 true); |
| 67 ->EnableMaximizeModeWindowManager(true); | |
| 68 EXPECT_TRUE(tray->visible()); | 66 EXPECT_TRUE(tray->visible()); |
| 69 Shell::GetInstance() | 67 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 70 ->maximize_mode_controller() | 68 false); |
| 71 ->EnableMaximizeModeWindowManager(false); | |
| 72 EXPECT_FALSE(tray->visible()); | 69 EXPECT_FALSE(tray->visible()); |
| 73 } | 70 } |
| 74 | 71 |
| 75 // Tests that when the detailed view is initially created that its | 72 // Tests that when the detailed view is initially created that its |
| 76 // BrightnessView is created as visible. | 73 // BrightnessView is created as visible. |
| 77 TEST_F(TrayBrightnessTest, CreateDetailedView) { | 74 TEST_F(TrayBrightnessTest, CreateDetailedView) { |
| 78 std::unique_ptr<views::View> tray(CreateDetailedView()); | 75 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 79 EXPECT_TRUE(tray->visible()); | 76 EXPECT_TRUE(tray->visible()); |
| 80 } | 77 } |
| 81 | 78 |
| 82 // Tests that when the detailed view is created during MaximizeMode that its | 79 // Tests that when the detailed view is created during MaximizeMode that its |
| 83 // BrightnessView is visible. | 80 // BrightnessView is visible. |
| 84 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { | 81 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { |
| 85 Shell::GetInstance() | 82 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 86 ->maximize_mode_controller() | 83 true); |
| 87 ->EnableMaximizeModeWindowManager(true); | |
| 88 std::unique_ptr<views::View> tray(CreateDetailedView()); | 84 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 89 EXPECT_TRUE(tray->visible()); | 85 EXPECT_TRUE(tray->visible()); |
| 90 Shell::GetInstance() | 86 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 91 ->maximize_mode_controller() | 87 false); |
| 92 ->EnableMaximizeModeWindowManager(false); | |
| 93 } | 88 } |
| 94 | 89 |
| 95 // Tests that the enabling of MaximizeMode has no affect on the visibility of a | 90 // Tests that the enabling of MaximizeMode has no affect on the visibility of a |
| 96 // previously created BrightnessView that belongs to a detailed view. | 91 // previously created BrightnessView that belongs to a detailed view. |
| 97 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { | 92 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { |
| 98 std::unique_ptr<views::View> tray(CreateDetailedView()); | 93 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 99 Shell::GetInstance() | 94 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 100 ->maximize_mode_controller() | 95 true); |
| 101 ->EnableMaximizeModeWindowManager(true); | |
| 102 EXPECT_TRUE(tray->visible()); | 96 EXPECT_TRUE(tray->visible()); |
| 103 Shell::GetInstance() | 97 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 104 ->maximize_mode_controller() | 98 false); |
| 105 ->EnableMaximizeModeWindowManager(false); | |
| 106 EXPECT_TRUE(tray->visible()); | 99 EXPECT_TRUE(tray->visible()); |
| 107 } | 100 } |
| 108 | 101 |
| 109 } // namespace ash | 102 } // namespace ash |
| OLD | NEW |