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

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

Issue 1633733004: Use browser top chrome material design by default on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « ui/base/material_design/material_design_controller.cc ('k') | ui/base/ui_base_switches.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/material_design/material_design_controller.h" 10 #include "ui/base/material_design/material_design_controller.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // when the compile time flag is defined. 70 // when the compile time flag is defined.
71 TEST_F( 71 TEST_F(
72 MaterialDesignControllerTest, 72 MaterialDesignControllerTest,
73 EnabledHybridCommandLineValueMapsToMaterialHybridModeWhenCompileTimeFlagEnab led) { 73 EnabledHybridCommandLineValueMapsToMaterialHybridModeWhenCompileTimeFlagEnab led) {
74 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 74 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
75 switches::kTopChromeMD, "material-hybrid"); 75 switches::kTopChromeMD, "material-hybrid");
76 EXPECT_EQ(MaterialDesignController::Mode::MATERIAL_HYBRID, 76 EXPECT_EQ(MaterialDesignController::Mode::MATERIAL_HYBRID,
77 MaterialDesignController::GetMode()); 77 MaterialDesignController::GetMode());
78 } 78 }
79 79
80 // Verify command line value "" maps to Mode::NON_MATERIAL when the compile time 80 // Verify command line value "" maps to the default mode when the compile time
81 // flag is defined. 81 // flag is defined.
82 TEST_F( 82 TEST_F(
83 MaterialDesignControllerTest, 83 MaterialDesignControllerTest,
84 DisabledCommandLineValueMapsToNonMaterialModeWhenCompileTimeFlagEnabled) { 84 DisabledCommandLineValueMapsToNonMaterialModeWhenCompileTimeFlagEnabled) {
85 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 85 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
86 switches::kTopChromeMD, ""); 86 switches::kTopChromeMD, "");
87 EXPECT_EQ(MaterialDesignController::Mode::NON_MATERIAL, 87 EXPECT_EQ(MaterialDesignController::DefaultMode(),
88 MaterialDesignController::GetMode()); 88 MaterialDesignController::GetMode());
89 } 89 }
90 90
91 // Verify no command line value maps to Mode::NON_MATERIAL when the compile time 91 // Verify the current mode is reported as the default mode when no command line
92 // flag is defined. 92 // flag is defined.
93 TEST_F(MaterialDesignControllerTest, 93 TEST_F(MaterialDesignControllerTest,
94 NoCommandLineValueMapsToNonMaterialModeWhenCompileTimeFlagEnabled) { 94 NoCommandLineValueMapsToNonMaterialModeWhenCompileTimeFlagEnabled) {
95 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch( 95 ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
96 switches::kTopChromeMD)); 96 switches::kTopChromeMD));
97 EXPECT_EQ(MaterialDesignController::Mode::NON_MATERIAL, 97 EXPECT_EQ(MaterialDesignController::DefaultMode(),
98 MaterialDesignController::GetMode()); 98 MaterialDesignController::GetMode());
99 } 99 }
100 100
101 // Verify an invalid command line value uses the default NON_MATERIAL mode. 101 // Verify an invalid command line value uses the default mode.
102 TEST_F(MaterialDesignControllerTest, InvalidCommandLineValue) { 102 TEST_F(MaterialDesignControllerTest, InvalidCommandLineValue) {
103 const std::string kInvalidValue = "1nvalid-valu3"; 103 const std::string kInvalidValue = "1nvalid-valu3";
104 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 104 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
105 switches::kTopChromeMD, kInvalidValue); 105 switches::kTopChromeMD, kInvalidValue);
106 EXPECT_EQ(MaterialDesignController::Mode::NON_MATERIAL, 106 EXPECT_EQ(MaterialDesignController::DefaultMode(),
107 MaterialDesignController::GetMode()); 107 MaterialDesignController::GetMode());
108 } 108 }
109 109
110 // Verify that MaterialDesignController::IsModeMaterial() will initialize the 110 // Verify that MaterialDesignController::IsModeMaterial() will initialize the
111 // mode if it hasn't been initialized yet. 111 // mode if it hasn't been initialized yet.
112 TEST_F(MaterialDesignControllerTest, IsModeMaterialInitializesMode) { 112 TEST_F(MaterialDesignControllerTest, IsModeMaterialInitializesMode) {
113 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 113 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
114 switches::kTopChromeMD, "material"); 114 switches::kTopChromeMD, "material");
115 EXPECT_TRUE(MaterialDesignController::IsModeMaterial()); 115 EXPECT_TRUE(MaterialDesignController::IsModeMaterial());
116 } 116 }
117 117
118 #endif // !defined(ENABLE_TOPCHROME_MD) 118 #endif // !defined(ENABLE_TOPCHROME_MD)
119 119
120 } // namespace 120 } // namespace
121 } // namespace ui 121 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/material_design/material_design_controller.cc ('k') | ui/base/ui_base_switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698