| 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" |
| (...skipping 30 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 Shell::GetInstance()->maximize_mode_controller()-> | 51 Shell::GetInstance() |
| 52 EnableMaximizeModeWindowManager(true); | 52 ->maximize_mode_controller() |
| 53 ->EnableMaximizeModeWindowManager(true); |
| 53 std::unique_ptr<views::View> tray(CreateDefaultView()); | 54 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 54 EXPECT_TRUE(tray->visible()); | 55 EXPECT_TRUE(tray->visible()); |
| 55 Shell::GetInstance()->maximize_mode_controller()-> | 56 Shell::GetInstance() |
| 56 EnableMaximizeModeWindowManager(false); | 57 ->maximize_mode_controller() |
| 58 ->EnableMaximizeModeWindowManager(false); |
| 57 } | 59 } |
| 58 | 60 |
| 59 // Tests that the enabling of MaximizeMode affects a previously created | 61 // Tests that the enabling of MaximizeMode affects a previously created |
| 60 // BrightnessView, changing the visibility. | 62 // BrightnessView, changing the visibility. |
| 61 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { | 63 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { |
| 62 std::unique_ptr<views::View> tray(CreateDefaultView()); | 64 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 63 Shell::GetInstance()->maximize_mode_controller()-> | 65 Shell::GetInstance() |
| 64 EnableMaximizeModeWindowManager(true); | 66 ->maximize_mode_controller() |
| 67 ->EnableMaximizeModeWindowManager(true); |
| 65 EXPECT_TRUE(tray->visible()); | 68 EXPECT_TRUE(tray->visible()); |
| 66 Shell::GetInstance()->maximize_mode_controller()-> | 69 Shell::GetInstance() |
| 67 EnableMaximizeModeWindowManager(false); | 70 ->maximize_mode_controller() |
| 71 ->EnableMaximizeModeWindowManager(false); |
| 68 EXPECT_FALSE(tray->visible()); | 72 EXPECT_FALSE(tray->visible()); |
| 69 } | 73 } |
| 70 | 74 |
| 71 // Tests that when the detailed view is initially created that its | 75 // Tests that when the detailed view is initially created that its |
| 72 // BrightnessView is created as visible. | 76 // BrightnessView is created as visible. |
| 73 TEST_F(TrayBrightnessTest, CreateDetailedView) { | 77 TEST_F(TrayBrightnessTest, CreateDetailedView) { |
| 74 std::unique_ptr<views::View> tray(CreateDetailedView()); | 78 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 75 EXPECT_TRUE(tray->visible()); | 79 EXPECT_TRUE(tray->visible()); |
| 76 } | 80 } |
| 77 | 81 |
| 78 | |
| 79 // Tests that when the detailed view is created during MaximizeMode that its | 82 // Tests that when the detailed view is created during MaximizeMode that its |
| 80 // BrightnessView is visible. | 83 // BrightnessView is visible. |
| 81 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { | 84 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { |
| 82 Shell::GetInstance()->maximize_mode_controller()-> | 85 Shell::GetInstance() |
| 83 EnableMaximizeModeWindowManager(true); | 86 ->maximize_mode_controller() |
| 87 ->EnableMaximizeModeWindowManager(true); |
| 84 std::unique_ptr<views::View> tray(CreateDetailedView()); | 88 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 85 EXPECT_TRUE(tray->visible()); | 89 EXPECT_TRUE(tray->visible()); |
| 86 Shell::GetInstance()->maximize_mode_controller()-> | 90 Shell::GetInstance() |
| 87 EnableMaximizeModeWindowManager(false); | 91 ->maximize_mode_controller() |
| 92 ->EnableMaximizeModeWindowManager(false); |
| 88 } | 93 } |
| 89 | 94 |
| 90 // Tests that the enabling of MaximizeMode has no affect on the visibility of a | 95 // Tests that the enabling of MaximizeMode has no affect on the visibility of a |
| 91 // previously created BrightnessView that belongs to a detailed view. | 96 // previously created BrightnessView that belongs to a detailed view. |
| 92 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { | 97 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { |
| 93 std::unique_ptr<views::View> tray(CreateDetailedView()); | 98 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 94 Shell::GetInstance()->maximize_mode_controller()-> | 99 Shell::GetInstance() |
| 95 EnableMaximizeModeWindowManager(true); | 100 ->maximize_mode_controller() |
| 101 ->EnableMaximizeModeWindowManager(true); |
| 96 EXPECT_TRUE(tray->visible()); | 102 EXPECT_TRUE(tray->visible()); |
| 97 Shell::GetInstance()->maximize_mode_controller()-> | 103 Shell::GetInstance() |
| 98 EnableMaximizeModeWindowManager(false); | 104 ->maximize_mode_controller() |
| 105 ->EnableMaximizeModeWindowManager(false); |
| 99 EXPECT_TRUE(tray->visible()); | 106 EXPECT_TRUE(tray->visible()); |
| 100 } | 107 } |
| 101 | 108 |
| 102 } // namespace ash | 109 } // namespace ash |
| 103 | |
| OLD | NEW |