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