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

Unified Diff: chrome/browser/ui/webui/media_router/media_cast_mode_unittest.cc

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 8 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: chrome/browser/ui/webui/media_router/media_cast_mode_unittest.cc
diff --git a/chrome/browser/ui/webui/media_router/media_cast_mode_unittest.cc b/chrome/browser/ui/webui/media_router/media_cast_mode_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a4950102e91617f9a56e85c6fa5b9ebd8a6e30b0
--- /dev/null
+++ b/chrome/browser/ui/webui/media_router/media_cast_mode_unittest.cc
@@ -0,0 +1,63 @@
+// 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 "chrome/browser/ui/webui/media_router/media_cast_mode.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace media_router {
+
+TEST(MediaCastModeTest, PreferredCastMode) {
+ CastModeSet cast_modes;
+
+ EXPECT_EQ(MediaCastMode::DEFAULT, GetPreferredCastMode(cast_modes));
+
+ cast_modes.insert(MediaCastMode::SOUND_OPTIMIZED_TAB_MIRROR);
+ EXPECT_EQ(MediaCastMode::SOUND_OPTIMIZED_TAB_MIRROR,
+ GetPreferredCastMode(cast_modes));
+
+ cast_modes.insert(MediaCastMode::DESKTOP_OR_WINDOW_MIRROR);
+ EXPECT_EQ(MediaCastMode::DESKTOP_OR_WINDOW_MIRROR,
+ GetPreferredCastMode(cast_modes));
+
+ cast_modes.insert(MediaCastMode::TAB_MIRROR);
+ EXPECT_EQ(MediaCastMode::TAB_MIRROR,
+ GetPreferredCastMode(cast_modes));
+
+ cast_modes.insert(MediaCastMode::DEFAULT);
+ EXPECT_EQ(MediaCastMode::DEFAULT,
+ GetPreferredCastMode(cast_modes));
+
+ cast_modes.erase(MediaCastMode::TAB_MIRROR);
+ EXPECT_EQ(MediaCastMode::DEFAULT,
+ GetPreferredCastMode(cast_modes));
+
+ cast_modes.erase(MediaCastMode::DESKTOP_OR_WINDOW_MIRROR);
+ EXPECT_EQ(MediaCastMode::DEFAULT,
+ GetPreferredCastMode(cast_modes));
+
+ cast_modes.erase(MediaCastMode::SOUND_OPTIMIZED_TAB_MIRROR);
+ EXPECT_EQ(MediaCastMode::DEFAULT,
+ GetPreferredCastMode(cast_modes));
+}
+
+TEST(MediaCastModeTest, MediaCastModeToTitleAndDescription) {
+ for (int cast_mode = MediaCastMode::DEFAULT;
+ cast_mode < MediaCastMode::NUM_CAST_MODES; cast_mode++) {
+ EXPECT_TRUE(!MediaCastModeToTitle(
+ static_cast<MediaCastMode>(cast_mode), "youtube.com").empty());
+ EXPECT_TRUE(!MediaCastModeToDescription(
+ static_cast<MediaCastMode>(cast_mode), "youtube.com").empty());
+ }
+}
+
+TEST(MediaCastModeTest, IsValidCastModeNum) {
+ for (int cast_mode = MediaCastMode::DEFAULT;
+ cast_mode < MediaCastMode::NUM_CAST_MODES; cast_mode++) {
+ EXPECT_TRUE(IsValidCastModeNum(cast_mode));
+ }
+ EXPECT_FALSE(IsValidCastModeNum(MediaCastMode::NUM_CAST_MODES));
+ EXPECT_FALSE(IsValidCastModeNum(-1));
+}
+
+} // namespace media_router

Powered by Google App Engine
This is Rietveld 408576698