| 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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 base::RunLoop run_loop; | 619 base::RunLoop run_loop; |
| 620 EXPECT_CALL(mock_media_route_provider_, DetachRoute(kRouteId)) | 620 EXPECT_CALL(mock_media_route_provider_, DetachRoute(kRouteId)) |
| 621 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); | 621 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); |
| 622 router()->DetachRoute(kRouteId); | 622 router()->DetachRoute(kRouteId); |
| 623 run_loop.Run(); | 623 run_loop.Run(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 TEST_F(MediaRouterMojoImplTest, TerminateRoute) { | 626 TEST_F(MediaRouterMojoImplTest, TerminateRoute) { |
| 627 base::RunLoop run_loop; | 627 base::RunLoop run_loop; |
| 628 EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _)) | 628 EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _)) |
| 629 .WillOnce(Invoke([&run_loop]( | 629 .WillOnce(Invoke([]( |
| 630 const std::string& route_id, | 630 const std::string& route_id, |
| 631 const mojom::MediaRouteProvider::TerminateRouteCallback& cb) { | 631 const mojom::MediaRouteProvider::TerminateRouteCallback& cb) { |
| 632 cb.Run(base::nullopt, mojom::RouteRequestResultCode::OK); | 632 cb.Run(base::nullopt, mojom::RouteRequestResultCode::OK); |
| 633 })); | 633 })); |
| 634 router()->TerminateRoute(kRouteId); | 634 router()->TerminateRoute(kRouteId); |
| 635 run_loop.RunUntilIdle(); | 635 run_loop.RunUntilIdle(); |
| 636 ExpectResultBucketCount("TerminateRoute", | 636 ExpectResultBucketCount("TerminateRoute", |
| 637 RouteRequestResult::ResultCode::OK, | 637 RouteRequestResult::ResultCode::OK, |
| 638 1); | 638 1); |
| 639 } | 639 } |
| 640 | 640 |
| 641 TEST_F(MediaRouterMojoImplTest, TerminateRouteFails) { | 641 TEST_F(MediaRouterMojoImplTest, TerminateRouteFails) { |
| 642 base::RunLoop run_loop; | 642 base::RunLoop run_loop; |
| 643 EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _)) | 643 EXPECT_CALL(mock_media_route_provider_, TerminateRoute(kRouteId, _)) |
| 644 .WillOnce(Invoke([&run_loop]( | 644 .WillOnce(Invoke([]( |
| 645 const std::string& route_id, | 645 const std::string& route_id, |
| 646 const mojom::MediaRouteProvider::TerminateRouteCallback& cb) { | 646 const mojom::MediaRouteProvider::TerminateRouteCallback& cb) { |
| 647 cb.Run(std::string("timed out"), | 647 cb.Run(std::string("timed out"), |
| 648 mojom::RouteRequestResultCode::TIMED_OUT); | 648 mojom::RouteRequestResultCode::TIMED_OUT); |
| 649 })); | 649 })); |
| 650 router()->TerminateRoute(kRouteId); | 650 router()->TerminateRoute(kRouteId); |
| 651 run_loop.RunUntilIdle(); | 651 run_loop.RunUntilIdle(); |
| 652 ExpectResultBucketCount("TerminateRoute", | 652 ExpectResultBucketCount("TerminateRoute", |
| 653 RouteRequestResult::ResultCode::OK, | 653 RouteRequestResult::ResultCode::OK, |
| 654 0); | 654 0); |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 EXPECT_CALL(mock_media_route_provider_, | 1560 EXPECT_CALL(mock_media_route_provider_, |
| 1561 UpdateMediaSinks(MediaSourceForDesktop().id())) | 1561 UpdateMediaSinks(MediaSourceForDesktop().id())) |
| 1562 .WillOnce(InvokeWithoutArgs([&run_loop2]() { | 1562 .WillOnce(InvokeWithoutArgs([&run_loop2]() { |
| 1563 run_loop2.Quit(); | 1563 run_loop2.Quit(); |
| 1564 })); | 1564 })); |
| 1565 | 1565 |
| 1566 run_loop2.Run(); | 1566 run_loop2.Run(); |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 } // namespace media_router | 1569 } // namespace media_router |
| OLD | NEW |