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

Side by Side Diff: ash/common/system/chromeos/brightness/tray_brightness_unittest.cc

Issue 2732813002: chromeos: Move files in //ash/common to //ash, part 1 (Closed)
Patch Set: rebase Created 3 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ash/common/system/chromeos/brightness/tray_brightness.h"
6
7 #include <memory>
8
9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/system/tray/system_tray_delegate.h"
11 #include "ash/common/system/tray/system_tray_item.h"
12 #include "ash/common/test/ash_test.h"
13 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
14 #include "ash/common/wm_shell.h"
15 #include "ui/views/view.h"
16
17 namespace ash {
18
19 class TrayBrightnessTest : public AshTest {
20 public:
21 TrayBrightnessTest() {}
22 ~TrayBrightnessTest() override {}
23
24 protected:
25 views::View* CreateDefaultView() {
26 TrayBrightness tray(NULL);
27 // The login status doesn't matter here; supply any random value.
28 return tray.CreateDefaultView(LoginStatus::USER);
29 }
30
31 views::View* CreateDetailedView() {
32 TrayBrightness tray(NULL);
33 // The login status doesn't matter here; supply any random value.
34 return tray.CreateDetailedView(LoginStatus::USER);
35 }
36
37 private:
38 DISALLOW_COPY_AND_ASSIGN(TrayBrightnessTest);
39 };
40
41 // Tests that when the default view is initially created, that its
42 // BrightnessView is created not visible.
43 TEST_F(TrayBrightnessTest, CreateDefaultView) {
44 std::unique_ptr<views::View> tray(CreateDefaultView());
45 EXPECT_FALSE(tray->visible());
46 }
47
48 // Tests the construction of the default view while MaximizeMode is active.
49 // The BrightnessView should be visible.
50 TEST_F(TrayBrightnessTest, CreateDefaultViewDuringMaximizeMode) {
51 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
52 true);
53 std::unique_ptr<views::View> tray(CreateDefaultView());
54 EXPECT_TRUE(tray->visible());
55 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
56 false);
57 }
58
59 // Tests that the enabling of MaximizeMode affects a previously created
60 // BrightnessView, changing the visibility.
61 TEST_F(TrayBrightnessTest, DefaultViewVisibilityChangesDuringMaximizeMode) {
62 std::unique_ptr<views::View> tray(CreateDefaultView());
63 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
64 true);
65 EXPECT_TRUE(tray->visible());
66 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
67 false);
68 EXPECT_FALSE(tray->visible());
69 }
70
71 // Tests that when the detailed view is initially created that its
72 // BrightnessView is created as visible for both MD and non MD modes.
73 TEST_F(TrayBrightnessTest, CreateDetailedView) {
74 std::unique_ptr<views::View> tray(CreateDetailedView());
75 EXPECT_TRUE(tray->visible());
76 }
77
78 // Tests that when the detailed view is created during MaximizeMode that its
79 // BrightnessView is visible.
80 TEST_F(TrayBrightnessTest, CreateDetailedViewDuringMaximizeMode) {
81 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
82 true);
83 std::unique_ptr<views::View> tray(CreateDetailedView());
84 EXPECT_TRUE(tray->visible());
85 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
86 false);
87 }
88
89 // Tests that the enabling of MaximizeMode has no affect on the visibility of a
90 // previously created BrightnessView that belongs to a detailed view.
91 TEST_F(TrayBrightnessTest, DetailedViewVisibilityChangesDuringMaximizeMode) {
92 std::unique_ptr<views::View> tray(CreateDetailedView());
93 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
94 true);
95 EXPECT_TRUE(tray->visible());
96 WmShell::Get()->maximize_mode_controller()->EnableMaximizeModeWindowManager(
97 false);
98 EXPECT_TRUE(tray->visible());
99 }
100
101 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/brightness/tray_brightness.cc ('k') | ash/common/system/chromeos/cast/tray_cast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698