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

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: 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 2015 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);
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 // Verify the current mode is reported as the default mode when no command line
85 // flag is added.
86 TEST_F(MaterialDesignControllerTest, NoCommandLineSwitchMapsToDefaultMode) {
87 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
88 switches::kAshEnableMaterialDesign));
89 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
90 switches::kAshDisableMaterialDesign));
91 EXPECT_EQ(test::MaterialDesignControllerTestAPI::DefaultMode(),
92 MaterialDesignController::IsMaterial());
93 }
94
95 // Verify that MaterialDesignController::IsModeMaterial() will be true when
96 // initialized with command line flag "ash-enable-md".
97 TEST_F(MaterialDesignControllerTestMaterial, CommandLineSwitch) {
98 EXPECT_TRUE(MaterialDesignController::IsMaterial());
99 }
100
101 // Verify that MaterialDesignController::IsModeMaterial() will be false when
102 // initialized with command line flag "ash-disable-md".
103 TEST_F(MaterialDesignControllerTestNonMaterial, CommandLineSwitch) {
104 EXPECT_FALSE(MaterialDesignController::IsMaterial());
105 }
106
107 // Verify that MaterialDesignController::IsModeMaterial() will be false when
108 // initialized with both command line flags "ash-enable-md --ash-disable-md".
109 TEST_F(MaterialDesignControllerTestBothEnabledAndDisabled, CommandLineSwitch) {
110 EXPECT_FALSE(MaterialDesignController::IsMaterial());
111 }
112
113 } // namespace
oshima 2016/04/25 23:01:43 Just define test bodies in ash namespace. Rational
varkha 2016/04/25 23:16:05 Done.
114 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698