Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: ash/system/night_light/tray_night_light_unittest.cc

Issue 2921973002: Hide Night Light behind a flag (Closed)
Patch Set: James' comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ash_switches.h"
7 #include "ash/public/cpp/config.h" 8 #include "ash/public/cpp/config.h"
8 #include "ash/shell.h" 9 #include "ash/shell.h"
9 #include "ash/system/night_light/night_light_controller.h" 10 #include "ash/system/night_light/night_light_controller.h"
10 #include "ash/system/tray/system_tray.h" 11 #include "ash/system/tray/system_tray.h"
11 #include "ash/test/ash_test_base.h" 12 #include "ash/test/ash_test_base.h"
12 #include "ash/test/ash_test_helper.h" 13 #include "ash/test/ash_test_helper.h"
13 #include "ash/test/test_shell_delegate.h" 14 #include "ash/test/test_shell_delegate.h"
15 #include "base/command_line.h"
14 #include "base/macros.h" 16 #include "base/macros.h"
15 #include "components/prefs/testing_pref_service.h" 17 #include "components/prefs/testing_pref_service.h"
16 18
17 namespace ash { 19 namespace ash {
18 20
19 namespace { 21 namespace {
20 22
21 constexpr char kFakeUserEmail[] = "fake_user@nightlight"; 23 constexpr char kFakeUserEmail[] = "fake_user@nightlight";
22 24
23 class TrayNightLightTest : public test::AshTestBase { 25 class TrayNightLightTest : public test::AshTestBase {
24 public: 26 public:
25 TrayNightLightTest() = default; 27 TrayNightLightTest() = default;
26 ~TrayNightLightTest() override = default; 28 ~TrayNightLightTest() override = default;
27 29
28 // ash::test::AshTestBase: 30 // ash::test::AshTestBase:
29 void SetUp() override { 31 void SetUp() override {
32 // Explicitly enable the NightLight feature for the tests.
33 base::CommandLine::ForCurrentProcess()->AppendSwitch(
34 ash::switches::kAshEnableNightLight);
35
30 test::AshTestBase::SetUp(); 36 test::AshTestBase::SetUp();
31 GetSessionControllerClient()->Reset(); 37 GetSessionControllerClient()->Reset();
32 GetSessionControllerClient()->AddUserSession(kFakeUserEmail); 38 GetSessionControllerClient()->AddUserSession(kFakeUserEmail);
33 Shell::RegisterPrefs(pref_service_.registry()); 39 Shell::RegisterPrefs(pref_service_.registry());
34 40
35 ash_test_helper()->test_shell_delegate()->set_active_user_pref_service( 41 ash_test_helper()->test_shell_delegate()->set_active_user_pref_service(
36 &pref_service_); 42 &pref_service_);
37 GetSessionControllerClient()->SwitchActiveUser( 43 GetSessionControllerClient()->SwitchActiveUser(
38 AccountId::FromUserEmail(kFakeUserEmail)); 44 AccountId::FromUserEmail(kFakeUserEmail));
39 } 45 }
(...skipping 23 matching lines...) Expand all
63 ASSERT_FALSE(controller->GetEnabled()); 69 ASSERT_FALSE(controller->GetEnabled());
64 EXPECT_FALSE(tray_night_light->tray_view()->visible()); 70 EXPECT_FALSE(tray_night_light->tray_view()->visible());
65 controller->Toggle(); 71 controller->Toggle();
66 ASSERT_TRUE(controller->GetEnabled()); 72 ASSERT_TRUE(controller->GetEnabled());
67 EXPECT_TRUE(tray_night_light->tray_view()->visible()); 73 EXPECT_TRUE(tray_night_light->tray_view()->visible());
68 } 74 }
69 75
70 } // namespace 76 } // namespace
71 77
72 } // namespace ash 78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/night_light/night_light_controller_unittest.cc ('k') | ash/system/tiles/tiles_default_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698