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