Index: chrome/browser/media/router/media_route_unittest.cc |
diff --git a/chrome/browser/media/router/media_route_unittest.cc b/chrome/browser/media/router/media_route_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ba6dca44c88ec59459b4f03036d17d54bf621929 |
--- /dev/null |
+++ b/chrome/browser/media/router/media_route_unittest.cc |
@@ -0,0 +1,36 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/media/router/media_route.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
+ |
+namespace media_router { |
+ |
+// Tests the == operator to ensure that only route ID equality is being checked. |
+TEST(MediaRouteTest, Equals) { |
+ MediaRoute route1("routeId1", MediaSource::ForCastApp("DialApp"), |
+ "sinkId", "Description", false); |
+ |
+ // Same as route1 with different sink ID. |
+ MediaRoute route2("routeId1", MediaSource::ForCastApp("DialApp"), |
+ "differentSinkId", "Description", false); |
+ EXPECT_TRUE(route1.Equals(route2)); |
+ |
+ // Same as route1 with different description. |
+ MediaRoute route3("routeId1", MediaSource::ForCastApp("DialApp"), |
+ "sinkId", "differentDescription", false); |
+ EXPECT_TRUE(route1.Equals(route3)); |
+ |
+ // Same as route1 with different is_local. |
+ MediaRoute route4("routeId1", MediaSource::ForCastApp("DialApp"), |
+ "sinkId", "Description", true); |
+ EXPECT_TRUE(route1.Equals(route4)); |
+ |
+ // The ID is different from route1's. |
+ MediaRoute route5("routeId2", MediaSource::ForCastApp("DialApp"), |
+ "sinkId", "Description", false); |
+ EXPECT_FALSE(route1.Equals(route5)); |
+} |
+ |
+} // namespace media_router |