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