| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 chromecast { |
| 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, |
| 35 switches::kSwitchValueTrue); |
| 36 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true)); |
| 37 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false)); |
| 38 } |
| 39 |
| 40 TEST(ChromecastSwitchesTest, SwitchValueFalse) { |
| 41 if (base::CommandLine::CommandLine::InitializedForCurrentProcess()) |
| 42 base::CommandLine::Reset(); |
| 43 base::CommandLine::Init(0, nullptr); |
| 44 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 45 cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, |
| 46 switches::kSwitchValueFalse); |
| 47 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true)); |
| 48 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false)); |
| 49 } |
| 50 |
| 51 TEST(ChromecastSwitchesTest, SwitchValueNonsense) { |
| 52 if (base::CommandLine::CommandLine::InitializedForCurrentProcess()) |
| 53 base::CommandLine::Reset(); |
| 54 base::CommandLine::Init(0, nullptr); |
| 55 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 56 cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, "silverware"); |
| 57 EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true)); |
| 58 EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false)); |
| 59 } |
| 60 |
| 61 } // namespace chromecast |
| OLD | NEW |