| 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" | |
| 10 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
| 11 #include "ash/common/system/tray/system_tray_item.h" | 10 #include "ash/common/system/tray/system_tray_item.h" |
| 12 #include "ash/common/test/ash_test.h" | 11 #include "ash/common/test/ash_test.h" |
| 13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 12 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 14 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 15 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 16 | 15 |
| 17 namespace ash { | 16 namespace ash { |
| 18 | 17 |
| 19 class TrayBrightnessTest : public AshTest { | 18 class TrayBrightnessTest : public AshTest { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 std::unique_ptr<views::View> tray(CreateDefaultView()); | 61 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 63 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 62 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 64 true); | 63 true); |
| 65 EXPECT_TRUE(tray->visible()); | 64 EXPECT_TRUE(tray->visible()); |
| 66 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 65 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 67 false); | 66 false); |
| 68 EXPECT_FALSE(tray->visible()); | 67 EXPECT_FALSE(tray->visible()); |
| 69 } | 68 } |
| 70 | 69 |
| 71 // Tests that when the detailed view is initially created that its | 70 // Tests that when the detailed view is initially created that its |
| 72 // BrightnessView is created as visible for both MD and non MD modes. | 71 // BrightnessView is created as visible. |
| 73 TEST_F(TrayBrightnessTest, CreateDetailedView) { | 72 TEST_F(TrayBrightnessTest, CreateDetailedView) { |
| 74 std::unique_ptr<views::View> tray(CreateDetailedView()); | 73 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 75 EXPECT_TRUE(tray->visible()); | 74 EXPECT_TRUE(tray->visible()); |
| 76 } | 75 } |
| 77 | 76 |
| 78 // Tests that when the detailed view is created during MaximizeMode that its | 77 // Tests that when the detailed view is created during MaximizeMode that its |
| 79 // BrightnessView is visible. | 78 // BrightnessView is visible. |
| 80 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { | 79 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { |
| 81 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 80 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 82 true); | 81 true); |
| 83 std::unique_ptr<views::View> tray(CreateDetailedView()); | 82 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 84 EXPECT_TRUE(tray->visible()); | 83 EXPECT_TRUE(tray->visible()); |
| 85 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 84 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 86 false); | 85 false); |
| 87 } | 86 } |
| 88 | 87 |
| 89 // Tests that the enabling of MaximizeMode has no affect on the visibility of a | 88 // Tests that the enabling of MaximizeMode has no affect on the visibility of a |
| 90 // previously created BrightnessView that belongs to a detailed view. | 89 // previously created BrightnessView that belongs to a detailed view. |
| 91 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { | 90 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { |
| 92 std::unique_ptr<views::View> tray(CreateDetailedView()); | 91 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 93 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 92 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 94 true); | 93 true); |
| 95 EXPECT_TRUE(tray->visible()); | 94 EXPECT_TRUE(tray->visible()); |
| 96 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 95 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 97 false); | 96 false); |
| 98 EXPECT_TRUE(tray->visible()); | 97 EXPECT_TRUE(tray->visible()); |
| 99 } | 98 } |
| 100 | 99 |
| 101 } // namespace ash | 100 } // namespace ash |
| OLD | NEW |