| OLD | NEW |
| (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 |
| OLD | NEW |