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

Side by Side Diff: ash/material_design/material_design_controller_unittest.cc

Issue 1921133002: Adds ash::MaterialDesignController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds ash::MaterialDesignController (doc) Created 4 years, 8 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 2016 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 <string>
6
7 #include "ash/ash_switches.h"
8 #include "ash/material_design/material_design_controller.h"
9 #include "ash/test/material_design_controller_test_api.h"
10 #include "base/command_line.h"
11 #include "base/macros.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace ash {
15 namespace {
16
17 // Test fixture for the MaterialDesignController class.
18 class MaterialDesignControllerTest : public testing::Test {
19 public:
20 MaterialDesignControllerTest();
21 ~MaterialDesignControllerTest() override;
22
23 protected:
24 // testing::Test:
25 void SetUp() override;
26 void TearDown() override;
27
28 private:
29 DISALLOW_COPY_AND_ASSIGN(MaterialDesignControllerTest);
30 };
31
32 MaterialDesignControllerTest::MaterialDesignControllerTest() {}
33
34 MaterialDesignControllerTest::~MaterialDesignControllerTest() {}
35
36 void MaterialDesignControllerTest::SetUp() {
37 testing::Test::SetUp();
38 MaterialDesignController::Initialize();
39 }
40
41 void MaterialDesignControllerTest::TearDown() {
42 test::MaterialDesignControllerTestAPI::Uninitialize();
43 testing::Test::TearDown();
44 }
45
46 class MaterialDesignControllerTestMaterial
47 : public MaterialDesignControllerTest {
48 public:
49 MaterialDesignControllerTestMaterial() {
50 base::CommandLine::ForCurrentProcess()->AppendSwitch(
51 switches::kAshEnableMaterialDesign);
oshima 2016/04/26 16:06:58 These additional flags will be carried over to oth
varkha 2016/04/27 21:00:09 Done.
52 }
53
54 private:
55 DISALLOW_COPY_AND_ASSIGN(MaterialDesignControllerTestMaterial);
56 };
57
58 class MaterialDesignControllerTestNonMaterial
59 : public MaterialDesignControllerTest {
60 public:
61 MaterialDesignControllerTestNonMaterial() {
62 base::CommandLine::ForCurrentProcess()->AppendSwitch(
63 switches::kAshDisableMaterialDesign);
64 }
65
66 private:
67 DISALLOW_COPY_AND_ASSIGN(MaterialDesignControllerTestNonMaterial);
68 };
69
70 class MaterialDesignControllerTestBothEnabledAndDisabled
71 : public MaterialDesignControllerTest {
72 public:
73 MaterialDesignControllerTestBothEnabledAndDisabled() {
74 base::CommandLine::ForCurrentProcess()->AppendSwitch(
75 switches::kAshEnableMaterialDesign);
76 base::CommandLine::ForCurrentProcess()->AppendSwitch(
77 switches::kAshDisableMaterialDesign);
78 }
79
80 private:
81 DISALLOW_COPY_AND_ASSIGN(MaterialDesignControllerTestBothEnabledAndDisabled);
82 };
83
84 } // namespace
85
86 // Verify the current mode is reported as the default mode when no command line
87 // flag is added.
88 TEST_F(MaterialDesignControllerTest, NoCommandLineSwitchMapsToDefaultMode) {
89 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
90 switches::kAshEnableMaterialDesign));
91 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
92 switches::kAshDisableMaterialDesign));
93 EXPECT_EQ(test::MaterialDesignControllerTestAPI::DefaultMode(),
94 MaterialDesignController::IsMaterial());
95 }
96
97 // Verify that MaterialDesignController::IsModeMaterial() will be true when
98 // initialized with command line flag "ash-enable-md".
99 TEST_F(MaterialDesignControllerTestMaterial, CommandLineSwitch) {
100 EXPECT_TRUE(MaterialDesignController::IsMaterial());
101 }
102
103 // Verify that MaterialDesignController::IsModeMaterial() will be false when
104 // initialized with command line flag "ash-disable-md".
105 TEST_F(MaterialDesignControllerTestNonMaterial, CommandLineSwitch) {
106 EXPECT_FALSE(MaterialDesignController::IsMaterial());
107 }
108
109 // Verify that MaterialDesignController::IsModeMaterial() will be false when
110 // initialized with both command line flags "ash-enable-md --ash-disable-md".
111 TEST_F(MaterialDesignControllerTestBothEnabledAndDisabled, CommandLineSwitch) {
112 EXPECT_FALSE(MaterialDesignController::IsMaterial());
113 }
114
115 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698