| 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_route.h" | 5 #include "chrome/browser/media/router/media_route.h" |
| 6 #include "chrome/browser/media/router/media_sink.h" | 6 #include "chrome/browser/media/router/media_sink.h" |
| 7 #include "chrome/browser/media/router/media_source_helper.h" | 7 #include "chrome/browser/media/router/media_source_helper.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 MediaRoute route4(kRouteId1, MediaSourceForCastApp("DialApp"), | 37 MediaRoute route4(kRouteId1, MediaSourceForCastApp("DialApp"), |
| 38 MediaSink("sinkId", "sinkName"), "Description", true, ""); | 38 MediaSink("sinkId", "sinkName"), "Description", true, ""); |
| 39 EXPECT_TRUE(route1.Equals(route4)); | 39 EXPECT_TRUE(route1.Equals(route4)); |
| 40 | 40 |
| 41 // The ID is different from route1's. | 41 // The ID is different from route1's. |
| 42 MediaRoute route5(kRouteId2, MediaSourceForCastApp("DialApp"), | 42 MediaRoute route5(kRouteId2, MediaSourceForCastApp("DialApp"), |
| 43 MediaSink("sinkId", "sinkName"), "Description", false, ""); | 43 MediaSink("sinkId", "sinkName"), "Description", false, ""); |
| 44 EXPECT_FALSE(route1.Equals(route5)); | 44 EXPECT_FALSE(route1.Equals(route5)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 TEST(MediaRouteTest, ParseId) { | |
| 48 EXPECT_EQ("1", GetPresentationIdAndUrl(kRouteId1).first); | |
| 49 EXPECT_EQ("http://foo.com", GetPresentationIdAndUrl(kRouteId1).second); | |
| 50 auto invalid = std::make_pair(std::string(), std::string()); | |
| 51 EXPECT_EQ(invalid, GetPresentationIdAndUrl("invalid")); | |
| 52 EXPECT_EQ(invalid, GetPresentationIdAndUrl( | |
| 53 "urn:x-org.chromium:media:route:2")); | |
| 54 EXPECT_EQ(invalid, GetPresentationIdAndUrl( | |
| 55 "urn:x-org.chromium:media:route:2/")); | |
| 56 EXPECT_EQ(invalid, GetPresentationIdAndUrl( | |
| 57 "urn:x-org.chromium:media:route:2/cast-sink2/")); | |
| 58 EXPECT_EQ(invalid, GetPresentationIdAndUrl( | |
| 59 "urn:x-org.chromium:media:route:2//http://foo.com")); | |
| 60 } | |
| 61 | |
| 62 } // namespace media_router | 47 } // namespace media_router |
| OLD | NEW |