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"
11 const char kRouteId1
[] =
12 "urn:x-org.chromium:media:route:1/cast-sink1/http://foo.com";
13 const char kRouteId2
[] =
14 "urn:x-org.chromium:media:route:2/cast-sink2/http://foo.com";
17 namespace media_router
{
19 // Tests the == operator to ensure that only route ID equality is being checked.
20 TEST(MediaRouteTest
, Equals
) {
21 MediaRoute
route1(kRouteId1
, MediaSourceForCastApp("DialApp"),
22 MediaSink("sinkId", "sinkName"), "Description", false, "");
24 // Same as route1 with different sink ID.
25 MediaRoute
route2(kRouteId1
, MediaSourceForCastApp("DialApp"),
26 MediaSink("differentSinkId", "different sink"),
27 "Description", false, "");
28 EXPECT_TRUE(route1
.Equals(route2
));
30 // Same as route1 with different description.
31 MediaRoute
route3(kRouteId1
, MediaSourceForCastApp("DialApp"),
32 MediaSink("sinkId", "sinkName"), "differentDescription",
34 EXPECT_TRUE(route1
.Equals(route3
));
36 // Same as route1 with different is_local.
37 MediaRoute
route4(kRouteId1
, MediaSourceForCastApp("DialApp"),
38 MediaSink("sinkId", "sinkName"), "Description", true, "");
39 EXPECT_TRUE(route1
.Equals(route4
));
41 // The ID is different from route1's.
42 MediaRoute
route5(kRouteId2
, MediaSourceForCastApp("DialApp"),
43 MediaSink("sinkId", "sinkName"), "Description", false, "");
44 EXPECT_FALSE(route1
.Equals(route5
));
47 } // namespace media_router