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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/base/chromecast_switches_unittest.cc
diff --git a/chromecast/base/chromecast_switches_unittest.cc b/chromecast/base/chromecast_switches_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9b2c97c3586258c08a3e3b0e5bf77c39a9e527e0
--- /dev/null
+++ b/chromecast/base/chromecast_switches_unittest.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "chromecast/base/chromecast_switches.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace cast {
+
+TEST(ChromecastSwitchesTest, NoSwitch) {
+ if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
+ base::CommandLine::Reset();
+ base::CommandLine::Init(0, nullptr);
+ EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
+ EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
+}
+
+TEST(ChromecastSwitchesTest, NoSwitchValue) {
+ if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
+ base::CommandLine::Reset();
+ base::CommandLine::Init(0, nullptr);
+ base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+ cl->AppendSwitch(switches::kEnableCmaMediaPipeline);
+ EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
+ EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
+}
+
+TEST(ChromecastSwitchesTest, SwitchValueTrue) {
+ if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
+ base::CommandLine::Reset();
+ base::CommandLine::Init(0, nullptr);
+ base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+ cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, kSwitchValueTrue);
+ EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
+ EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
+}
+
+TEST(ChromecastSwitchesTest, SwitchValueFalse) {
+ if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
+ base::CommandLine::Reset();
+ base::CommandLine::Init(0, nullptr);
+ base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+ cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, kSwitchValueFalse);
+ EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
+ EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
+}
+
+TEST(ChromecastSwitchesTest, SwitchValueNonsense) {
+ if (base::CommandLine::CommandLine::InitializedForCurrentProcess())
+ base::CommandLine::Reset();
+ base::CommandLine::Init(0, nullptr);
+ base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+ cl->AppendSwitchASCII(switches::kEnableCmaMediaPipeline, "silverware");
+ EXPECT_TRUE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, true));
+ EXPECT_FALSE(GetSwitchValueBoolean(switches::kEnableCmaMediaPipeline, false));
+}
+
+} // namespace cast

Powered by Google App Engine
This is Rietveld 408576698