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_route.h" | |
6 #include "chrome/browser/media/router/media_sink.h" | |
7 #include "chrome/browser/media/router/media_source_helper.h" | |
8 #include "testing/gmock/include/gmock/gmock.h" | |
9 | |
10 namespace { | |
11 constexpr char kRouteId1[] = | |
12 "urn:x-org.chromium:media:route:1/cast-sink1/http://foo.com"; | |
13 constexpr char kRouteId2[] = | |
14 "urn:x-org.chromium:media:route:2/cast-sink2/http://foo.com"; | |
15 constexpr char kPresentationUrl[] = "http://www.example.com/presentation.html"; | |
16 } // namespace | |
17 | |
18 namespace media_router { | |
19 | |
20 // Tests the == operator to ensure that only route ID equality is being checked. | |
21 TEST(MediaRouteTest, Equals) { | |
22 const MediaSource& media_source = | |
23 MediaSourceForPresentationUrl(GURL(kPresentationUrl)); | |
24 MediaRoute route1(kRouteId1, media_source, "sinkId", "Description", false, "", | |
25 false); | |
26 | |
27 // Same as route1 with different sink ID. | |
28 MediaRoute route2(kRouteId1, media_source, "differentSinkId", "Description", | |
29 false, "", false); | |
30 EXPECT_TRUE(route1.Equals(route2)); | |
31 | |
32 // Same as route1 with different description. | |
33 MediaRoute route3(kRouteId1, media_source, "sinkId", "differentDescription", | |
34 false, "", false); | |
35 EXPECT_TRUE(route1.Equals(route3)); | |
36 | |
37 // Same as route1 with different is_local. | |
38 MediaRoute route4(kRouteId1, media_source, "sinkId", "Description", true, "", | |
39 false); | |
40 EXPECT_TRUE(route1.Equals(route4)); | |
41 | |
42 // The ID is different from route1's. | |
43 MediaRoute route5(kRouteId2, media_source, "sinkId", "Description", false, "", | |
44 false); | |
45 EXPECT_FALSE(route1.Equals(route5)); | |
46 | |
47 // Same as route1 with different incognito. | |
48 MediaRoute route6(kRouteId1, media_source, "sinkId", "Description", true, "", | |
49 false); | |
50 route6.set_incognito(true); | |
51 EXPECT_TRUE(route1.Equals(route6)); | |
52 } | |
53 | |
54 } // namespace media_router | |
OLD | NEW |