| OLD | NEW |
| 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 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1174 EXPECT_CALL(sink_handler, Invoke(kSinkId2)).Times(1); | 1174 EXPECT_CALL(sink_handler, Invoke(kSinkId2)).Times(1); |
| 1175 MediaSinkSearchResponseCallback sink_callback = base::Bind( | 1175 MediaSinkSearchResponseCallback sink_callback = base::Bind( |
| 1176 &SinkResponseCallbackHandler::Invoke, base::Unretained(&sink_handler)); | 1176 &SinkResponseCallbackHandler::Invoke, base::Unretained(&sink_handler)); |
| 1177 | 1177 |
| 1178 router()->SearchSinks(kSinkId, kSource, search_input, domain, sink_callback); | 1178 router()->SearchSinks(kSinkId, kSource, search_input, domain, sink_callback); |
| 1179 | 1179 |
| 1180 base::RunLoop run_loop; | 1180 base::RunLoop run_loop; |
| 1181 run_loop.RunUntilIdle(); | 1181 run_loop.RunUntilIdle(); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 TEST_F(MediaRouterMojoImplTest, OnSinksDiscovered) { |
| 1185 MediaRouter::MediaSinkList* sinks = new MediaRouter::MediaSinkList(); |
| 1186 MediaSink* expected_sink = |
| 1187 new MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST); |
| 1188 sinks->push_back(base::WrapUnique(expected_sink)); |
| 1189 EXPECT_EQ(expected_sink, sinks->at(0).get()); |
| 1190 |
| 1191 EXPECT_CALL(mock_media_route_provider_, OnSinksDiscovered_(_)) |
| 1192 .WillOnce(Invoke([](const MediaRouter::MediaSinkList& actual_sinks) { |
| 1193 EXPECT_EQ(size_t(1), actual_sinks.size()); |
| 1194 MediaSink* actual_sink = actual_sinks[0].get(); |
| 1195 EXPECT_EQ(kSinkId, actual_sink->id()); |
| 1196 EXPECT_EQ(kSinkName, actual_sink->name()); |
| 1197 EXPECT_EQ(MediaSink::IconType::CAST, actual_sink->icon_type()); |
| 1198 EXPECT_FALSE(actual_sink->description()); |
| 1199 EXPECT_FALSE(actual_sink->domain()); |
| 1200 EXPECT_FALSE(actual_sink->model_name()); |
| 1201 })); |
| 1202 |
| 1203 router()->OnSinksDiscovered(base::WrapUnique(sinks)); |
| 1204 |
| 1205 base::RunLoop run_loop; |
| 1206 run_loop.RunUntilIdle(); |
| 1207 } |
| 1208 |
| 1184 class MediaRouterMojoExtensionTest : public ::testing::Test { | 1209 class MediaRouterMojoExtensionTest : public ::testing::Test { |
| 1185 public: | 1210 public: |
| 1186 MediaRouterMojoExtensionTest() : process_manager_(nullptr) {} | 1211 MediaRouterMojoExtensionTest() : process_manager_(nullptr) {} |
| 1187 | 1212 |
| 1188 ~MediaRouterMojoExtensionTest() override {} | 1213 ~MediaRouterMojoExtensionTest() override {} |
| 1189 | 1214 |
| 1190 protected: | 1215 protected: |
| 1191 void SetUp() override { | 1216 void SetUp() override { |
| 1192 // Set the extension's version number to be identical to the browser's. | 1217 // Set the extension's version number to be identical to the browser's. |
| 1193 extension_ = | 1218 extension_ = |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 EXPECT_CALL(mock_media_route_provider_, | 1579 EXPECT_CALL(mock_media_route_provider_, |
| 1555 UpdateMediaSinks(MediaSourceForDesktop().id())) | 1580 UpdateMediaSinks(MediaSourceForDesktop().id())) |
| 1556 .WillOnce(InvokeWithoutArgs([&run_loop2]() { | 1581 .WillOnce(InvokeWithoutArgs([&run_loop2]() { |
| 1557 run_loop2.Quit(); | 1582 run_loop2.Quit(); |
| 1558 })); | 1583 })); |
| 1559 | 1584 |
| 1560 run_loop2.Run(); | 1585 run_loop2.Run(); |
| 1561 } | 1586 } |
| 1562 | 1587 |
| 1563 } // namespace media_router | 1588 } // namespace media_router |
| OLD | NEW |