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 "chrome/browser/media/router/media_source.h" | |
6 #include "testing/gtest/include/gtest/gtest.h" | |
7 | |
8 namespace media_router { | |
9 | |
10 TEST(MediaSourceTest, IsMirroringMediaSource) { | |
11 EXPECT_TRUE(MediaSource::ForTab(123).SupportsMirroring()); | |
12 EXPECT_TRUE(MediaSource::ForDesktop().SupportsMirroring()); | |
13 EXPECT_FALSE(MediaSource::ForCastApp("CastApp").SupportsMirroring()); | |
14 EXPECT_FALSE( | |
15 MediaSource::ForPresentationUrl("http://url").SupportsMirroring()); | |
16 } | |
17 | |
18 TEST(MediaSourceTest, CreateMediaSource) { | |
19 EXPECT_EQ("urn:x-org.chromium.media:source:tab:123", | |
20 MediaSource::ForTab(123).id()); | |
21 EXPECT_EQ("urn:x-org.chromium.media:source:desktop", | |
22 MediaSource::ForDesktop().id()); | |
23 EXPECT_EQ("urn:x-com.google.cast:application:DEADBEEF", | |
24 MediaSource::ForCastApp("DEADBEEF").id()); | |
25 EXPECT_EQ("http://theoatmeal.com/", | |
26 MediaSource::ForPresentationUrl("http://theoatmeal.com/").id()); | |
27 } | |
28 | |
29 TEST(MediaSourceTest, SourceParse) { | |
30 MediaSource source; | |
31 EXPECT_TRUE( | |
32 source.Parse("urn:x-org.chromium.media:source:tab888")); | |
33 EXPECT_TRUE(source.Parse(MediaSource::ForDesktop().id())); | |
34 EXPECT_TRUE(source.Parse(MediaSource::ForCastApp("DEADBEEF").id())); | |
35 EXPECT_TRUE(source.Parse( | |
36 MediaSource::ForPresentationUrl("http://theoatmeal.com/").id())); | |
xhwang
2015/03/09 17:37:31
hmm, http://theoatmeal.com is actually a real site
Kevin M
2015/03/09 23:32:06
Good point, but test code is removed anyway.
| |
37 EXPECT_TRUE(source.Parse(MediaSource::ForPresentationUrl( | |
38 "https://secure.theoatmeal.com/login").id())); | |
39 | |
40 // Disallowed scheme | |
41 EXPECT_FALSE(source.Parse( | |
42 MediaSource::ForPresentationUrl("file:///some/local/path").id())); | |
43 | |
44 // Not a URL | |
45 EXPECT_FALSE(source.Parse( | |
46 MediaSource::ForPresentationUrl("exploding kittens").id())); | |
47 } | |
48 | |
49 } // namespace media_router | |
OLD | NEW |