OLD | NEW |
---|---|
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/browser/media/router/media_source.h" | 5 #include "chrome/browser/media/router/media_source.h" |
6 #include "chrome/browser/media/router/media_source_helper.h" | 6 #include "chrome/browser/media/router/media_source_helper.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 namespace media_router { | 9 namespace media_router { |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... | |
33 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("http://example.com/"))); | 33 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("http://example.com/"))); |
34 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("https://example.com/"))); | 34 EXPECT_TRUE(IsValidMediaSource(ForPresentationUrl("https://example.com/"))); |
35 | 35 |
36 // Disallowed scheme | 36 // Disallowed scheme |
37 EXPECT_FALSE( | 37 EXPECT_FALSE( |
38 IsValidMediaSource(ForPresentationUrl("file:///some/local/path"))); | 38 IsValidMediaSource(ForPresentationUrl("file:///some/local/path"))); |
39 // Not a URL | 39 // Not a URL |
40 EXPECT_FALSE(IsValidMediaSource(ForPresentationUrl("totally not a url"))); | 40 EXPECT_FALSE(IsValidMediaSource(ForPresentationUrl("totally not a url"))); |
41 } | 41 } |
42 | 42 |
43 TEST(MediaSourcesTest, GetPresentationUrl) { | |
44 EXPECT_EQ("", GetPresentationUrl(ForTabMediaSource(123))); | |
45 EXPECT_EQ("", GetPresentationUrl(ForDesktopMediaSource())); | |
46 EXPECT_EQ("http://example.com/", | |
47 GetPresentationUrl(ForPresentationUrl("http://example.com/"))); | |
Wez
2015/05/27 22:37:49
nit: Test the invalid-source case as well.
haibinlu
2015/05/28 21:44:02
the first 2 cases are invalid ones.
| |
48 } | |
49 | |
43 } // namespace media_router | 50 } // namespace media_router |
44 | 51 |
OLD | NEW |