| 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/night_light_controller.h" | 5 #include "ash/system/night_light/night_light_controller.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "ash/public/cpp/ash_pref_names.h" | 10 #include "ash/public/cpp/ash_pref_names.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 TestingPrefServiceSimple* user1_pref_service() { | 70 TestingPrefServiceSimple* user1_pref_service() { |
| 71 return &user1_pref_service_; | 71 return &user1_pref_service_; |
| 72 } | 72 } |
| 73 TestingPrefServiceSimple* user2_pref_service() { | 73 TestingPrefServiceSimple* user2_pref_service() { |
| 74 return &user2_pref_service_; | 74 return &user2_pref_service_; |
| 75 } | 75 } |
| 76 | 76 |
| 77 // ash::test::AshTestBase: | 77 // ash::test::AshTestBase: |
| 78 void SetUp() override { | 78 void SetUp() override { |
| 79 // Explicitly enable the NightLight feature for the tests. |
| 80 NightLightController::EnableFeatureForTesting(); |
| 81 |
| 79 test::AshTestBase::SetUp(); | 82 test::AshTestBase::SetUp(); |
| 80 CreateTestUserSessions(); | 83 CreateTestUserSessions(); |
| 81 Shell::RegisterPrefs(user1_pref_service_.registry()); | 84 Shell::RegisterPrefs(user1_pref_service_.registry()); |
| 82 Shell::RegisterPrefs(user2_pref_service_.registry()); | 85 Shell::RegisterPrefs(user2_pref_service_.registry()); |
| 83 | 86 |
| 84 // Simulate user 1 login. | 87 // Simulate user 1 login. |
| 85 InjectTestPrefService(&user1_pref_service_); | 88 InjectTestPrefService(&user1_pref_service_); |
| 86 SwitchActiveUser(kUser1Email); | 89 SwitchActiveUser(kUser1Email); |
| 87 } | 90 } |
| 88 | 91 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 user1_pref_service()->SetDouble(prefs::kNightLightTemperature, temperature2); | 244 user1_pref_service()->SetDouble(prefs::kNightLightTemperature, temperature2); |
| 242 EXPECT_EQ(temperature2, controller->GetColorTemperature()); | 245 EXPECT_EQ(temperature2, controller->GetColorTemperature()); |
| 243 EXPECT_TRUE(TestLayersTemperature(temperature2)); | 246 EXPECT_TRUE(TestLayersTemperature(temperature2)); |
| 244 user1_pref_service()->SetBoolean(prefs::kNightLightEnabled, false); | 247 user1_pref_service()->SetBoolean(prefs::kNightLightEnabled, false); |
| 245 EXPECT_FALSE(controller->GetEnabled()); | 248 EXPECT_FALSE(controller->GetEnabled()); |
| 246 } | 249 } |
| 247 | 250 |
| 248 } // namespace | 251 } // namespace |
| 249 | 252 |
| 250 } // namespace ash | 253 } // namespace ash |
| OLD | NEW |