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