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