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