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/maximize_mode/maximize_mode_controller.h" | 13 #include "ash/wm/tablet_mode/tablet_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 MaximizeMode is active. | 47 // Tests the construction of the default view while TabletMode is active. |
48 // The BrightnessView should be visible. | 48 // The BrightnessView should be visible. |
49 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) { | 49 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringTabletMode) { |
50 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 50 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); |
51 true); | |
52 std::unique_ptr<views::View> tray(CreateDefaultView()); | 51 std::unique_ptr<views::View> tray(CreateDefaultView()); |
53 EXPECT_TRUE(tray->visible()); | 52 EXPECT_TRUE(tray->visible()); |
54 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 53 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); |
55 false); | |
56 } | 54 } |
57 | 55 |
58 // Tests that the enabling of MaximizeMode affects a previously created | 56 // Tests that the enabling of TabletMode affects a previously created |
59 // BrightnessView, changing the visibility. | 57 // BrightnessView, changing the visibility. |
60 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { | 58 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringTabletMode) { |
61 std::unique_ptr<views::View> tray(CreateDefaultView()); | 59 std::unique_ptr<views::View> tray(CreateDefaultView()); |
62 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 60 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); |
63 true); | |
64 EXPECT_TRUE(tray->visible()); | 61 EXPECT_TRUE(tray->visible()); |
65 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 62 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); |
66 false); | |
67 EXPECT_FALSE(tray->visible()); | 63 EXPECT_FALSE(tray->visible()); |
68 } | 64 } |
69 | 65 |
70 // Tests that when the detailed view is initially created that its | 66 // Tests that when the detailed view is initially created that its |
71 // BrightnessView is created as visible. | 67 // BrightnessView is created as visible. |
72 TEST_F(TrayBrightnessTest, CreateDetailedView) { | 68 TEST_F(TrayBrightnessTest, CreateDetailedView) { |
73 std::unique_ptr<views::View> tray(CreateDetailedView()); | 69 std::unique_ptr<views::View> tray(CreateDetailedView()); |
74 EXPECT_TRUE(tray->visible()); | 70 EXPECT_TRUE(tray->visible()); |
75 } | 71 } |
76 | 72 |
77 // Tests that when the detailed view is created during MaximizeMode that its | 73 // Tests that when the detailed view is created during TabletMode that its |
78 // BrightnessView is visible. | 74 // BrightnessView is visible. |
79 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { | 75 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringTabletMode) { |
80 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 76 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); |
81 true); | |
82 std::unique_ptr<views::View> tray(CreateDetailedView()); | 77 std::unique_ptr<views::View> tray(CreateDetailedView()); |
83 EXPECT_TRUE(tray->visible()); | 78 EXPECT_TRUE(tray->visible()); |
84 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 79 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); |
85 false); | |
86 } | 80 } |
87 | 81 |
88 // Tests that the enabling of MaximizeMode has no affect on the visibility of a | 82 // Tests that the enabling of TabletMode has no affect on the visibility of a |
89 // previously created BrightnessView that belongs to a detailed view. | 83 // previously created BrightnessView that belongs to a detailed view. |
90 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { | 84 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringTabletMode) { |
91 std::unique_ptr<views::View> tray(CreateDetailedView()); | 85 std::unique_ptr<views::View> tray(CreateDetailedView()); |
92 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 86 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(true); |
93 true); | |
94 EXPECT_TRUE(tray->visible()); | 87 EXPECT_TRUE(tray->visible()); |
95 Shell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 88 Shell::Get()->tablet_mode_controller()->EnableTabletModeWindowManager(false); |
96 false); | |
97 EXPECT_TRUE(tray->visible()); | 89 EXPECT_TRUE(tray->visible()); |
98 } | 90 } |
99 | 91 |
100 } // namespace ash | 92 } // namespace ash |
OLD | NEW |