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

Side by Side Diff: chrome/browser/media/router/mojo/media_router_mojo_impl_unittest.cc

Issue 2679893002: [Media Router] Add ProvideSinks() Mojo API (Closed)
Patch Set: fix android compile error Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 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 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 EXPECT_CALL(sink_handler, Invoke(kSinkId2)).Times(1); 1197 EXPECT_CALL(sink_handler, Invoke(kSinkId2)).Times(1);
1198 MediaSinkSearchResponseCallback sink_callback = base::Bind( 1198 MediaSinkSearchResponseCallback sink_callback = base::Bind(
1199 &SinkResponseCallbackHandler::Invoke, base::Unretained(&sink_handler)); 1199 &SinkResponseCallbackHandler::Invoke, base::Unretained(&sink_handler));
1200 1200
1201 router()->SearchSinks(kSinkId, kSource, search_input, domain, sink_callback); 1201 router()->SearchSinks(kSinkId, kSource, search_input, domain, sink_callback);
1202 1202
1203 base::RunLoop run_loop; 1203 base::RunLoop run_loop;
1204 run_loop.RunUntilIdle(); 1204 run_loop.RunUntilIdle();
1205 } 1205 }
1206 1206
1207 TEST_F(MediaRouterMojoImplTest, ProvideSinks) {
1208 std::vector<MediaSinkInternal> sinks;
1209 MediaSink sink(kSinkId, kSinkName, MediaSink::IconType::CAST);
1210 CastSinkExtraData extra_data;
1211 EXPECT_TRUE(extra_data.ip_address.AssignFromIPLiteral("192.168.1.3"));
1212 extra_data.capabilities = 2;
1213 extra_data.cast_channel_id = 3;
1214 MediaSinkInternal expected_sink(sink, extra_data);
1215 sinks.push_back(expected_sink);
1216 std::string provider_name = "cast";
1217
1218 EXPECT_CALL(mock_media_route_provider_, ProvideSinks(provider_name, sinks));
1219
1220 router()->ProvideSinks(provider_name, sinks);
1221
1222 base::RunLoop run_loop;
1223 run_loop.RunUntilIdle();
1224 }
1225
1207 class MediaRouterMojoExtensionTest : public ::testing::Test { 1226 class MediaRouterMojoExtensionTest : public ::testing::Test {
1208 public: 1227 public:
1209 MediaRouterMojoExtensionTest() : process_manager_(nullptr) {} 1228 MediaRouterMojoExtensionTest() : process_manager_(nullptr) {}
1210 1229
1211 ~MediaRouterMojoExtensionTest() override {} 1230 ~MediaRouterMojoExtensionTest() override {}
1212 1231
1213 protected: 1232 protected:
1214 void SetUp() override { 1233 void SetUp() override {
1215 // Set the extension's version number to be identical to the browser's. 1234 // Set the extension's version number to be identical to the browser's.
1216 extension_ = 1235 extension_ =
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 EXPECT_CALL(mock_media_route_provider_, 1596 EXPECT_CALL(mock_media_route_provider_,
1578 UpdateMediaSinks(MediaSourceForDesktop().id())) 1597 UpdateMediaSinks(MediaSourceForDesktop().id()))
1579 .WillOnce(InvokeWithoutArgs([&run_loop2]() { 1598 .WillOnce(InvokeWithoutArgs([&run_loop2]() {
1580 run_loop2.Quit(); 1599 run_loop2.Quit();
1581 })); 1600 }));
1582 1601
1583 run_loop2.Run(); 1602 run_loop2.Run();
1584 } 1603 }
1585 1604
1586 } // namespace media_router 1605 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698