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 media_router { | 10 namespace media_router { |
11 | 11 |
12 // Tests the == operator to ensure that only route ID equality is being checked. | 12 // Tests the == operator to ensure that only route ID equality is being checked. |
13 TEST(MediaRouteTest, Equals) { | 13 TEST(MediaRouteTest, Equals) { |
14 MediaRoute route1("routeId1", ForCastAppMediaSource("DialApp"), | 14 MediaRoute route1("routeId1", MediaSourceForCastApp("DialApp"), |
15 MediaSink("sinkId", "sinkName"), | 15 MediaSink("sinkId", "sinkName"), "Description", false); |
16 "Description", false); | |
17 | 16 |
18 // Same as route1 with different sink ID. | 17 // Same as route1 with different sink ID. |
19 MediaRoute route2("routeId1", ForCastAppMediaSource("DialApp"), | 18 MediaRoute route2("routeId1", MediaSourceForCastApp("DialApp"), |
20 MediaSink("differentSinkId", "different sink"), | 19 MediaSink("differentSinkId", "different sink"), |
21 "Description", false); | 20 "Description", false); |
22 EXPECT_TRUE(route1.Equals(route2)); | 21 EXPECT_TRUE(route1.Equals(route2)); |
23 | 22 |
24 // Same as route1 with different description. | 23 // Same as route1 with different description. |
25 MediaRoute route3("routeId1", ForCastAppMediaSource("DialApp"), | 24 MediaRoute route3("routeId1", MediaSourceForCastApp("DialApp"), |
26 MediaSink("sinkId", "sinkName"), | 25 MediaSink("sinkId", "sinkName"), "differentDescription", |
27 "differentDescription", false); | 26 false); |
28 EXPECT_TRUE(route1.Equals(route3)); | 27 EXPECT_TRUE(route1.Equals(route3)); |
29 | 28 |
30 // Same as route1 with different is_local. | 29 // Same as route1 with different is_local. |
31 MediaRoute route4("routeId1", ForCastAppMediaSource("DialApp"), | 30 MediaRoute route4("routeId1", MediaSourceForCastApp("DialApp"), |
32 MediaSink("sinkId", "sinkName"), | 31 MediaSink("sinkId", "sinkName"), "Description", true); |
33 "Description", true); | |
34 EXPECT_TRUE(route1.Equals(route4)); | 32 EXPECT_TRUE(route1.Equals(route4)); |
35 | 33 |
36 // The ID is different from route1's. | 34 // The ID is different from route1's. |
37 MediaRoute route5("routeId2", ForCastAppMediaSource("DialApp"), | 35 MediaRoute route5("routeId2", MediaSourceForCastApp("DialApp"), |
38 MediaSink("sinkId", "sinkName"), | 36 MediaSink("sinkId", "sinkName"), "Description", false); |
39 "Description", false); | |
40 EXPECT_FALSE(route1.Equals(route5)); | 37 EXPECT_FALSE(route1.Equals(route5)); |
41 } | 38 } |
42 | 39 |
43 } // namespace media_router | 40 } // namespace media_router |
OLD | NEW |