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