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

Side by Side Diff: chrome/browser/media/router/media_source_helper_unittest.cc

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bring GN files up to date. Created 5 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 "chrome/browser/media/router/media_source.h"
6 #include "chrome/browser/media/router/media_source_helper.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace media_router {
10
11 TEST(MediaSourcesTest, IsMirroringMediaSource) {
12 EXPECT_TRUE(IsMirroringMediaSource(ForTabMediaSource(123)));
13 EXPECT_TRUE(IsMirroringMediaSource(ForDesktopMediaSource()));
14 EXPECT_FALSE(IsMirroringMediaSource(ForCastAppMediaSource("CastApp")));
15 EXPECT_FALSE(IsMirroringMediaSource(ForPresentationUrl("http://url")));
16 }
17
18 TEST(MediaSourcesTest, CreateMediaSource) {
19 EXPECT_EQ("urn:x-org.chromium.media:source:tab:123",
20 ForTabMediaSource(123).id());
21 EXPECT_EQ("urn:x-org.chromium.media:source:desktop",
22 ForDesktopMediaSource().id());
23 EXPECT_EQ("urn:x-com.google.cast:application:DEADBEEF",
24 ForCastAppMediaSource("DEADBEEF").id());
25 EXPECT_EQ("http://example.com/",
26 ForPresentationUrl("http://example.com/").id());
27 }
28
29 TEST(MediaSourcesTest, IsValidMediaSource) {
30 EXPECT_TRUE(IsValidMediaSource(ForTabMediaSource(123)));
31 EXPECT_TRUE(IsValidMediaSource(ForDesktopMediaSource()));
32 EXPECT_TRUE(IsValidMediaSource(ForCastAppMediaSource("DEADBEEF")));
33 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("http://example.com/")));
34 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("https://example.com/")));
35
36 // Disallowed scheme
37 EXPECT_FALSE(
38 IsValidMediaSource(ForPresentationUrl("file:///some/local/path")));
39 // Not a URL
40 EXPECT_FALSE(IsValidMediaSource(ForPresentationUrl("totally not a url")));
41 }
42
43 } // namespace media_router
44
OLDNEW
« no previous file with comments | « chrome/browser/media/router/media_source_helper.cc ('k') | chrome/browser/media/router/media_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698