| 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/common/system/chromeos/brightness/tray_brightness.h" | 5 #include "ash/common/system/chromeos/brightness/tray_brightness.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
| 10 #include "ash/common/system/tray/system_tray_item.h" | 10 #include "ash/common/system/tray/system_tray_item.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 TrayBrightness tray(NULL); | 32 TrayBrightness tray(NULL); |
| 33 return tray.CreateDetailedView( | 33 return tray.CreateDetailedView( |
| 34 StatusAreaWidgetTestHelper::GetUserLoginStatus()); | 34 StatusAreaWidgetTestHelper::GetUserLoginStatus()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(TrayBrightnessTest); | 38 DISALLOW_COPY_AND_ASSIGN(TrayBrightnessTest); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Tests that when the default view is initially created, that its | 41 // Tests that when the default view is initially created, that its |
| 42 // BrightnessView is created not visible. | 42 // BrightnessView is created not visible for non MD and visible for MD. |
| 43 TEST_F(TrayBrightnessTest, CreateDefaultView) { | 43 TEST_F(TrayBrightnessTest, CreateDefaultView) { |
| 44 std::unique_ptr<views::View> tray(CreateDefaultView()); | 44 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 45 EXPECT_FALSE(tray->visible()); | 45 if (ash::MaterialDesignController::IsSystemTrayMenuMaterial()) |
| 46 EXPECT_TRUE(tray->visible()); |
| 47 else |
| 48 EXPECT_FALSE(tray->visible()); |
| 46 } | 49 } |
| 47 | 50 |
| 48 // Tests the construction of the default view while MaximizeMode is active. | 51 // Tests the construction of the default view while MaximizeMode is active. |
| 49 // The BrightnessView should be visible. | 52 // The BrightnessView should be visible for both modes non MD and MD. |
| 50 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) { | 53 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) { |
| 51 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 54 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 52 true); | 55 true); |
| 53 std::unique_ptr<views::View> tray(CreateDefaultView()); | 56 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 54 EXPECT_TRUE(tray->visible()); | 57 EXPECT_TRUE(tray->visible()); |
| 55 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 58 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 56 false); | 59 false); |
| 57 } | 60 } |
| 58 | 61 |
| 59 // Tests that the enabling of MaximizeMode affects a previously created | 62 // Tests that, when MD is not enabled, then the enabling of MaximizeMode |
| 60 // BrightnessView, changing the visibility. | 63 // affects a previously created BrightnessView, changing the visibility; when MD |
| 64 // is enabled, then the BrightnessView is visible regardless of the mode change. |
| 61 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { | 65 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) { |
| 62 std::unique_ptr<views::View> tray(CreateDefaultView()); | 66 std::unique_ptr<views::View> tray(CreateDefaultView()); |
| 63 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 67 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 64 true); | 68 true); |
| 65 EXPECT_TRUE(tray->visible()); | 69 EXPECT_TRUE(tray->visible()); |
| 66 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 70 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 67 false); | 71 false); |
| 68 EXPECT_FALSE(tray->visible()); | 72 if (ash::MaterialDesignController::IsSystemTrayMenuMaterial()) |
| 73 EXPECT_TRUE(tray->visible()); |
| 74 else |
| 75 EXPECT_FALSE(tray->visible()); |
| 69 } | 76 } |
| 70 | 77 |
| 71 // Tests that when the detailed view is initially created that its | 78 // Tests that when the detailed view is initially created that its |
| 72 // BrightnessView is created as visible. | 79 // BrightnessView is created as visible for both MD and non MD modes. |
| 73 TEST_F(TrayBrightnessTest, CreateDetailedView) { | 80 TEST_F(TrayBrightnessTest, CreateDetailedView) { |
| 74 std::unique_ptr<views::View> tray(CreateDetailedView()); | 81 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 75 EXPECT_TRUE(tray->visible()); | 82 EXPECT_TRUE(tray->visible()); |
| 76 } | 83 } |
| 77 | 84 |
| 78 // Tests that when the detailed view is created during MaximizeMode that its | 85 // Tests that when the detailed view is created during MaximizeMode that its |
| 79 // BrightnessView is visible. | 86 // BrightnessView is visible for both MD and non MD modes. |
| 80 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { | 87 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) { |
| 81 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 88 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 82 true); | 89 true); |
| 83 std::unique_ptr<views::View> tray(CreateDetailedView()); | 90 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 84 EXPECT_TRUE(tray->visible()); | 91 EXPECT_TRUE(tray->visible()); |
| 85 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 92 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 86 false); | 93 false); |
| 87 } | 94 } |
| 88 | 95 |
| 89 // Tests that the enabling of MaximizeMode has no affect on the visibility of a | 96 // Tests that the enabling of MaximizeMode has no affect on the visibility of a |
| 90 // previously created BrightnessView that belongs to a detailed view. | 97 // previously created BrightnessView that belongs to a detailed view for both MD |
| 98 // and non MD modes. |
| 91 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { | 99 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) { |
| 92 std::unique_ptr<views::View> tray(CreateDetailedView()); | 100 std::unique_ptr<views::View> tray(CreateDetailedView()); |
| 93 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 101 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 94 true); | 102 true); |
| 95 EXPECT_TRUE(tray->visible()); | 103 EXPECT_TRUE(tray->visible()); |
| 96 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( | 104 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager( |
| 97 false); | 105 false); |
| 98 EXPECT_TRUE(tray->visible()); | 106 EXPECT_TRUE(tray->visible()); |
| 99 } | 107 } |
| 100 | 108 |
| 101 } // namespace ash | 109 } // namespace ash |
| OLD | NEW |