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"), "sinkId",
22 "Description", false, "", false);
24 // Same as route1 with different sink ID.
25 MediaRoute
route2(kRouteId1
, MediaSourceForCastApp("DialApp"),
26 "differentSinkId", "Description", false, "", false);
27 EXPECT_TRUE(route1
.Equals(route2
));
29 // Same as route1 with different description.
30 MediaRoute
route3(kRouteId1
, MediaSourceForCastApp("DialApp"), "sinkId",
31 "differentDescription", false, "", false);
32 EXPECT_TRUE(route1
.Equals(route3
));
34 // Same as route1 with different is_local.
35 MediaRoute
route4(kRouteId1
, MediaSourceForCastApp("DialApp"), "sinkId",
36 "Description", true, "", false);
37 EXPECT_TRUE(route1
.Equals(route4
));
39 // The ID is different from route1's.
40 MediaRoute
route5(kRouteId2
, MediaSourceForCastApp("DialApp"), "sinkId",
41 "Description", false, "", false);
42 EXPECT_FALSE(route1
.Equals(route5
));
45 } // namespace media_router