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

Side by Side Diff: chromecast/base/chromecast_switches_unittest.cc

Issue 1767603003: [chromecast] Add cast_shell --accept-resource-provider switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: use kSwitchValue{True,False} and fix DONOTSUBMIT comment Created 4 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 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 "base/command_line.h"
6 #include "chromecast/base/chromecast_switches.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace cast {
10
11 TEST(ChromecastSwitchesTest, NoSwitch) {
12 if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
13 base::CommandLine::Reset();
14 base::CommandLine::Init(0, nullptr);
15 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
16 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
17 }
18
19 TEST(ChromecastSwitchesTest, NoSwitchValue) {
20 if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
21 base::CommandLine::Reset();
22 base::CommandLine::Init(0, nullptr);
23 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
24 cl->AppendSwitch(switches::kEnableCmaMediaPipeline);
25 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
26 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
27 }
28
29 TEST(ChromecastSwitchesTest, SwitchValueTrue) {
30 if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
31 base::CommandLine::Reset();
32 base::CommandLine::Init(0, nullptr);
33 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
34 cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, kSwitchValueTrue);
35 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
36 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
37 }
38
39 TEST(ChromecastSwitchesTest, SwitchValueFalse) {
40 if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
41 base::CommandLine::Reset();
42 base::CommandLine::Init(0, nullptr);
43 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
44 cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, kSwitchValueFalse);
45 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
46 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
47 }
48
49 TEST(ChromecastSwitchesTest, SwitchValueNonsense) {
50 if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
51 base::CommandLine::Reset();
52 base::CommandLine::Init(0, nullptr);
53 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
54 cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, "silverware");
55 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
56 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
57 }
58
59 } // namespace cast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698