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

Side by Side Diff: chrome/common/media_router/media_source_helper_unittest.cc

Issue 2927503002: [Presentation API / Media Router] Relax PresentationRequest URL check. (Closed)
Patch Set: Really add #include Created 3 years, 6 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/media_router/media_source_helper.h" 5 #include "chrome/common/media_router/media_source_helper.h"
6 6
7 #include "chrome/common/media_router/media_source.h" 7 #include "chrome/common/media_router/media_source.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 28 matching lines...) Expand all
39 MediaSourceForPresentationUrl(GURL(kPresentationUrl)))); 39 MediaSourceForPresentationUrl(GURL(kPresentationUrl))));
40 40
41 // Disallowed scheme 41 // Disallowed scheme
42 EXPECT_FALSE(IsValidMediaSource( 42 EXPECT_FALSE(IsValidMediaSource(
43 MediaSourceForPresentationUrl(GURL("file:///some/local/path")))); 43 MediaSourceForPresentationUrl(GURL("file:///some/local/path"))));
44 // Not a URL 44 // Not a URL
45 EXPECT_FALSE(IsValidMediaSource( 45 EXPECT_FALSE(IsValidMediaSource(
46 MediaSourceForPresentationUrl(GURL("totally not a url")))); 46 MediaSourceForPresentationUrl(GURL("totally not a url"))));
47 } 47 }
48 48
49 TEST(MediaSourcesTest, IsValidPresentationUrl) {
50 EXPECT_FALSE(IsValidPresentationUrl(GURL()));
51 EXPECT_FALSE(IsValidPresentationUrl(GURL("unsupported-scheme://foo")));
52
53 EXPECT_TRUE(IsValidPresentationUrl(GURL("https://google.com")));
54 EXPECT_TRUE(IsValidPresentationUrl(GURL("cast://foo")));
55 EXPECT_TRUE(IsValidPresentationUrl(GURL("cast:foo")));
56 }
57
49 TEST(MediaSourcesTest, CanConnectToMediaSource) { 58 TEST(MediaSourcesTest, CanConnectToMediaSource) {
50 EXPECT_TRUE(CanConnectToMediaSource( 59 EXPECT_TRUE(CanConnectToMediaSource(
51 MediaSource(GURL("https://google.com/cast#__castAppId__=233637DE")))); 60 MediaSource(GURL("https://google.com/cast#__castAppId__=233637DE"))));
52 // false scheme 61 // false scheme
53 EXPECT_FALSE(CanConnectToMediaSource( 62 EXPECT_FALSE(CanConnectToMediaSource(
54 MediaSource(GURL("http://google.com/cast#__castAppId__=233637DE")))); 63 MediaSource(GURL("http://google.com/cast#__castAppId__=233637DE"))));
55 // false domain 64 // false domain
56 EXPECT_FALSE(CanConnectToMediaSource( 65 EXPECT_FALSE(CanConnectToMediaSource(
57 MediaSource(GURL("https://google2.com/cast#__castAppId__=233637DE")))); 66 MediaSource(GURL("https://google2.com/cast#__castAppId__=233637DE"))));
58 // empty path 67 // empty path
59 EXPECT_FALSE( 68 EXPECT_FALSE(
60 CanConnectToMediaSource(MediaSource(GURL("https://www.google.com")))); 69 CanConnectToMediaSource(MediaSource(GURL("https://www.google.com"))));
61 // false path 70 // false path
62 EXPECT_FALSE(CanConnectToMediaSource( 71 EXPECT_FALSE(CanConnectToMediaSource(
63 MediaSource(GURL("https://www.google.com/path")))); 72 MediaSource(GURL("https://www.google.com/path"))));
64 73
65 EXPECT_FALSE(CanConnectToMediaSource(MediaSource(GURL("")))); 74 EXPECT_FALSE(CanConnectToMediaSource(MediaSource(GURL(""))));
66 } 75 }
67 76
68 } // namespace media_router 77 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/common/media_router/media_source_helper.cc ('k') | chrome/test/media_router/resources/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698