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

Side by Side Diff: ui/base/material_design/material_design_controller_unittest.cc

Issue 1188713007: Moved --top-chrome-md command line switch from chrome_switches to ui_base_switches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
(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 "base/command_line.h"
8 #include "base/macros.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/material_design/material_design_controller.h"
11 #include "ui/base/test/material_design_controller_test_api.h"
12 #include "ui/base/ui_base_switches.h"
13
14 namespace ui {
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 // testing::Test:
24 void TearDown() override;
25
26 private:
27 DISALLOW_COPY_AND_ASSIGN(MaterialDesignControllerTest);
28 };
29
30 MaterialDesignControllerTest::MaterialDesignControllerTest() {
31 }
32
33 MaterialDesignControllerTest::~MaterialDesignControllerTest() {
34 }
35
36 void MaterialDesignControllerTest::TearDown() {
37 testing::Test::TearDown();
38
39 // Ensure other tests aren't polluted by a look and feel set in these tests.
40 test::MaterialDesignControllerTestAPI::UninitializeLookAndFeel();
41 }
42
43 #if !defined(ENABLE_TOPCHROME_MD)
44
45 // Verify the look and feel maps to LookAndFeel::CLASSIC when the compile
46 // time flag is not defined.
47 TEST_F(MaterialDesignControllerTest,
48 ClassicLookAndFeelWhenCompileTimeFlagDisabled) {
49 EXPECT_EQ(MaterialDesignController::LookAndFeel::CLASSIC,
50 MaterialDesignController::GetLookAndFeel());
51 }
52
53 #else
54
55 // Verify command line value "enabled" maps to LookAndFeel::MATERIAL when the
56 // compile time flag is defined.
57 TEST_F(
58 MaterialDesignControllerTest,
59 EnabledCommandLineValueMapsToClassicLookAndFeelWhenCompileTimeFlagEnabled) {
60 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
61 switches::kTopChromeMD, "enabled");
62 EXPECT_EQ(MaterialDesignController::LookAndFeel::MATERIAL,
63 MaterialDesignController::GetLookAndFeel());
64 }
65
66 // Verify command line value "enabled-hybrid" maps to LookAndFeel::HYBRID when
67 // the compile time flag is defined.
68 TEST_F(
69 MaterialDesignControllerTest,
70 EnabledHybridCommandLineValueMapsToHybridLookAndFeelWhenCompileTimeFlagEnabl ed) {
71 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
72 switches::kTopChromeMD, "enabled-hybrid");
73 EXPECT_EQ(MaterialDesignController::LookAndFeel::HYBRID,
74 MaterialDesignController::GetLookAndFeel());
75 }
76
77 // Verify command line value "disabled" maps to LookAndFeel::CLASSIC when the
78 // compile time flag is defined.
79 TEST_F(
80 MaterialDesignControllerTest,
81 DisabledCommandLineValueMapsToClassicLookAndFeelWhenCompileTimeFlagEnabled) {
82 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
83 switches::kTopChromeMD, "disabled");
84 EXPECT_EQ(MaterialDesignController::LookAndFeel::CLASSIC,
85 MaterialDesignController::GetLookAndFeel());
86 }
87
88 // Verify no command line value maps to LookAndFeel::CLASSIC when the compile
89 // time flag is defined.
90 TEST_F(MaterialDesignControllerTest,
91 NoCommandLineValueMapsToClassicLookAndFeelWhenCompileTimeFlagEnabled) {
92 EXPECT_EQ(MaterialDesignController::LookAndFeel::CLASSIC,
93 MaterialDesignController::GetLookAndFeel());
94 }
95
96 // Verify an invalid command line value fails.
97 TEST_F(MaterialDesignControllerTest, InvalidCommandLineValueFails) {
98 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
99 switches::kTopChromeMD, "invalid-value");
100 EXPECT_DEATH(MaterialDesignController::GetLookAndFeel(), "");
101 }
102
103 #endif // !defined(ENABLE_TOPCHROME_MD)
104
105 } // namespace
106 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698