Index: ash/system/night_light/tray_night_light_unittest.cc |
diff --git a/ash/system/night_light/tray_night_light_unittest.cc b/ash/system/night_light/tray_night_light_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bec8b6c72eb0b448f41e03b0917cf31f988c36da |
--- /dev/null |
+++ b/ash/system/night_light/tray_night_light_unittest.cc |
@@ -0,0 +1,34 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ash/system/night_light/tray_night_light.h" |
James Cook
2017/05/08 16:09:07
super nit: blank line below
afakhry
2017/05/08 17:36:26
Done.
|
+#include "ash/shell.h" |
+#include "ash/system/night_light/night_light_controller.h" |
+#include "ash/system/tray/system_tray.h" |
+#include "ash/test/ash_test_base.h" |
+ |
+using ash::Shell; |
James Cook
2017/05/08 16:09:07
not needed, since you have namespace ash below
afakhry
2017/05/08 17:36:26
Yes, I know. Eclipse adds these automatically with
|
+using ash::test::AshTestBase; |
James Cook
2017/05/08 16:09:07
ditto
afakhry
2017/05/08 17:36:26
Done.
|
+ |
+namespace ash { |
+ |
+namespace { |
+ |
+using TrayNightLightTest = test::AshTestBase; |
+ |
+// Tests that when NightLight is active, its tray icon in the System Tray is |
+// visible. |
+TEST_F(TrayNightLightTest, TestNightLightTrayVisibility) { |
+ SystemTray* tray = GetPrimarySystemTray(); |
+ TrayNightLight* tray_night_light = tray->tray_night_light(); |
+ NightLightController* controller = Shell::Get()->night_light_controller(); |
+ ASSERT_FALSE(controller->enabled()); |
+ EXPECT_FALSE(tray_night_light->tray_view()->visible()); |
+ controller->Toggle(); |
James Cook
2017/05/08 16:09:07
optional: ditto re: Toggle vs SetEnabled
afakhry
2017/05/08 17:36:26
Done.
|
+ EXPECT_TRUE(tray_night_light->tray_view()->visible()); |
+} |
+ |
+} // namespace |
+ |
+} // namespace ash |