| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/night_light/tray_night_light.h" | 5 #include "ash/system/night_light/tray_night_light.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/system/night_light/night_light_controller.h" | 9 #include "ash/system/night_light/night_light_controller.h" |
| 10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "ash/test/ash_test_helper.h" | 12 #include "ash/test/ash_test_helper.h" |
| 13 #include "ash/test/test_shell_delegate.h" | 13 #include "ash/test/test_shell_delegate.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "components/prefs/testing_pref_service.h" | 15 #include "components/prefs/testing_pref_service.h" |
| 16 | 16 |
| 17 namespace ash { | 17 namespace ash { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 constexpr char kFakeUserEmail[] = "fake_user@nightlight"; | 21 constexpr char kFakeUserEmail[] = "fake_user@nightlight"; |
| 22 | 22 |
| 23 class TrayNightLightTest : public test::AshTestBase { | 23 class TrayNightLightTest : public test::AshTestBase { |
| 24 public: | 24 public: |
| 25 TrayNightLightTest() = default; | 25 TrayNightLightTest() = default; |
| 26 ~TrayNightLightTest() override = default; | 26 ~TrayNightLightTest() override = default; |
| 27 | 27 |
| 28 // ash::test::AshTestBase: | 28 // ash::test::AshTestBase: |
| 29 void SetUp() override { | 29 void SetUp() override { |
| 30 NightLightController::EnableFeatureForTesting(); |
| 30 test::AshTestBase::SetUp(); | 31 test::AshTestBase::SetUp(); |
| 31 GetSessionControllerClient()->Reset(); | 32 GetSessionControllerClient()->Reset(); |
| 32 GetSessionControllerClient()->AddUserSession(kFakeUserEmail); | 33 GetSessionControllerClient()->AddUserSession(kFakeUserEmail); |
| 33 Shell::RegisterPrefs(pref_service_.registry()); | 34 Shell::RegisterPrefs(pref_service_.registry()); |
| 34 | 35 |
| 35 ash_test_helper()->test_shell_delegate()->set_active_user_pref_service( | 36 ash_test_helper()->test_shell_delegate()->set_active_user_pref_service( |
| 36 &pref_service_); | 37 &pref_service_); |
| 37 GetSessionControllerClient()->SwitchActiveUser( | 38 GetSessionControllerClient()->SwitchActiveUser( |
| 38 AccountId::FromUserEmail(kFakeUserEmail)); | 39 AccountId::FromUserEmail(kFakeUserEmail)); |
| 39 } | 40 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 ASSERT_FALSE(controller->GetEnabled()); | 64 ASSERT_FALSE(controller->GetEnabled()); |
| 64 EXPECT_FALSE(tray_night_light->tray_view()->visible()); | 65 EXPECT_FALSE(tray_night_light->tray_view()->visible()); |
| 65 controller->Toggle(); | 66 controller->Toggle(); |
| 66 ASSERT_TRUE(controller->GetEnabled()); | 67 ASSERT_TRUE(controller->GetEnabled()); |
| 67 EXPECT_TRUE(tray_night_light->tray_view()->visible()); | 68 EXPECT_TRUE(tray_night_light->tray_view()->visible()); |
| 68 } | 69 } |
| 69 | 70 |
| 70 } // namespace | 71 } // namespace |
| 71 | 72 |
| 72 } // namespace ash | 73 } // namespace ash |
| OLD | NEW |