Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/media/router/media_router_base_unittest.cc

Issue 2731043002: [Media Router] Add a presentation id to MediaRoute mapping in the MR (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/test/mock_callback.h" 6 #include "base/test/mock_callback.h"
7 #include "chrome/browser/media/router/mock_media_router.h" 7 #include "chrome/browser/media/router/mock_media_router.h"
8 #include "chrome/browser/media/router/test_helper.h" 8 #include "chrome/browser/media/router/test_helper.h"
9 #include "content/public/common/presentation_session.h" 9 #include "content/public/common/presentation_session.h"
10 #include "content/public/test/test_browser_thread_bundle.h" 10 #include "content/public/test/test_browser_thread_bundle.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 std::vector<MediaRoute> current_routes = router_.GetCurrentRoutes(); 129 std::vector<MediaRoute> current_routes = router_.GetCurrentRoutes();
130 ASSERT_EQ(current_routes.size(), 2u); 130 ASSERT_EQ(current_routes.size(), 2u);
131 EXPECT_TRUE(current_routes[0].Equals(route1)); 131 EXPECT_TRUE(current_routes[0].Equals(route1));
132 EXPECT_TRUE(current_routes[1].Equals(route2)); 132 EXPECT_TRUE(current_routes[1].Equals(route2));
133 133
134 routes_observer_->OnRoutesUpdated(std::vector<MediaRoute>(), 134 routes_observer_->OnRoutesUpdated(std::vector<MediaRoute>(),
135 std::vector<MediaRoute::Id>()); 135 std::vector<MediaRoute::Id>());
136 EXPECT_TRUE(router_.GetCurrentRoutes().empty()); 136 EXPECT_TRUE(router_.GetCurrentRoutes().empty());
137 } 137 }
138 138
139 TEST_F(MediaRouterBaseTest, GetPresentationRoute) {
140 MediaSource source1("source_1");
141 MediaSource source2("source_1");
142 MediaRoute route1("route_1", source1, "sink_1", "", false, "", false);
143 MediaRoute route2("route_2", source2, "sink_2", "", true, "", false);
144
145 std::string presentation_id1("presentation_id1");
146 std::string presentation_id2("presentation_id2");
147 std::string presentation_id3("presentation_id3");
148
149 EXPECT_FALSE(router_.GetPresentationRoute(presentation_id1));
150
151 router_.RegisterPresentationRoute(presentation_id1, route1);
152 router_.RegisterPresentationRoute(presentation_id2, route2);
153
154 auto* actual_route1 = router_.GetPresentationRoute(presentation_id1);
155 auto* actual_route2 = router_.GetPresentationRoute(presentation_id2);
156
157 EXPECT_TRUE(actual_route1 && actual_route1->Equals(route1));
158 EXPECT_TRUE(actual_route2 && actual_route2->Equals(route2));
159 EXPECT_FALSE(router_.GetPresentationRoute(presentation_id3));
160
161 router_.UnregisterPresentationRoute(presentation_id1);
162
163 EXPECT_FALSE(router_.GetPresentationRoute(presentation_id1));
164 }
165
139 } // namespace media_router 166 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698