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

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

Issue 949293004: Add media router common classes and unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Code review feedback 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 "testing/gtest/include/gtest/gtest.h"
7
8 namespace media_router {
Kevin M 2015/03/09 23:32:06 Please take a look at media_sources.h.
9
10 TEST(MediaSourceTest, IsMirroringMediaSource) {
11 EXPECT_TRUE(IsMirroringMediaSource(ForTabMediaSource(123)));
12 EXPECT_TRUE(IsMirroringMediaSource(ForDesktopMediaSource()));
13 EXPECT_FALSE(IsMirroringMediaSource(ForCastAppMediaSource("CastApp")));
14 EXPECT_FALSE(IsMirroringMediaSource(ForPresentationUrl("http://url")));
15 }
16
17 TEST(MediaSourceTest, CreateMediaSource) {
18 EXPECT_EQ("urn:x-org.chromium.media:source:tab:123",
19 ForTabMediaSource(123));
20 EXPECT_EQ("urn:x-org.chromium.media:source:desktop",
21 ForDesktopMediaSource());
22 EXPECT_EQ("urn:x-com.google.cast:application:DEADBEEF",
23 ForCastAppMediaSource("DEADBEEF"));
xhwang 2015/03/05 22:28:50 Does this has to be a hex string? What anout XYZ?
Kevin M 2015/03/06 23:12:45 Yes it does.
xhwang 2015/03/09 17:37:30 Add a test case for XYZ then?
Kevin M 2015/03/09 23:32:06 Protocol-specific ID syntax validation takes place
24 EXPECT_EQ("http://theoatmeal.com/",
25 ForPresentationUrl("http://theoatmeal.com/"));
26 }
27
28 TEST(MediaSourceTest, IsValidMediaSource) {
29 EXPECT_TRUE(IsValidMediaSource(ForTabMediaSource(123)));
xhwang 2015/03/05 22:28:50 How about urn:x-org.chromium.media:source:tab:foo?
Kevin M 2015/03/06 23:12:45 Done.
Kevin M 2015/03/09 23:32:06 Sorry, didn't mean to mark this as done. This is
30 EXPECT_TRUE(IsValidMediaSource(ForDesktopMediaSource()));
31 EXPECT_TRUE(IsValidMediaSource(ForCastAppMediaSource("DEADBEEF")));
32 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("http://theoatmeal.com/")));
xhwang 2015/03/05 22:28:50 Also test https?
Kevin M 2015/03/06 23:12:45 Done.
33
34 // Disallowed scheme
35 EXPECT_FALSE(
36 IsValidMediaSource(ForPresentationUrl("file:///some/local/path")));
37 // Not a URL
38 EXPECT_FALSE(IsValidMediaSource(ForPresentationUrl("exploding kittens")));
39 }
40
41 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698