| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 url::Origin(GURL(kOrigin)))); | 690 url::Origin(GURL(kOrigin)))); |
| 691 EXPECT_TRUE(unrelated_sinks_observer->Init()); | 691 EXPECT_TRUE(unrelated_sinks_observer->Init()); |
| 692 ProcessEventLoop(); | 692 ProcessEventLoop(); |
| 693 | 693 |
| 694 std::vector<MediaSink> expected_sinks; | 694 std::vector<MediaSink> expected_sinks; |
| 695 expected_sinks.push_back( | 695 expected_sinks.push_back( |
| 696 MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST)); | 696 MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST)); |
| 697 expected_sinks.push_back( | 697 expected_sinks.push_back( |
| 698 MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST)); | 698 MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST)); |
| 699 | 699 |
| 700 std::vector<MediaSinkInternal> sinks; |
| 701 for (const auto& expected_sink : expected_sinks) { |
| 702 MediaSinkInternal sink_internal; |
| 703 sink_internal.set_sink(expected_sink); |
| 704 sinks.push_back(sink_internal); |
| 705 } |
| 706 |
| 700 base::RunLoop run_loop; | 707 base::RunLoop run_loop; |
| 701 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks))); | 708 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks))); |
| 702 EXPECT_CALL(*extra_sinks_observer, | 709 EXPECT_CALL(*extra_sinks_observer, |
| 703 OnSinksReceived(SequenceEquals(expected_sinks))) | 710 OnSinksReceived(SequenceEquals(expected_sinks))) |
| 704 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); | 711 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); |
| 705 media_router_proxy_->OnSinksReceived( | 712 media_router_proxy_->OnSinksReceived( |
| 706 media_source.id(), expected_sinks, | 713 media_source.id(), sinks, |
| 707 std::vector<url::Origin>(1, url::Origin(GURL(kOrigin)))); | 714 std::vector<url::Origin>(1, url::Origin(GURL(kOrigin)))); |
| 708 run_loop.Run(); | 715 run_loop.Run(); |
| 709 | 716 |
| 710 // Since the MediaRouterMojoImpl has already received results for | 717 // Since the MediaRouterMojoImpl has already received results for |
| 711 // |media_source|, return cached results to observers that are subsequently | 718 // |media_source|, return cached results to observers that are subsequently |
| 712 // registered. | 719 // registered. |
| 713 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer( | 720 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer( |
| 714 new MockMediaSinksObserver(router(), media_source, | 721 new MockMediaSinksObserver(router(), media_source, |
| 715 url::Origin(GURL(kOrigin)))); | 722 url::Origin(GURL(kOrigin)))); |
| 716 EXPECT_CALL(*cached_sinks_observer, | 723 EXPECT_CALL(*cached_sinks_observer, |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 EXPECT_CALL(mock_media_route_provider_, | 1578 EXPECT_CALL(mock_media_route_provider_, |
| 1572 UpdateMediaSinks(MediaSourceForDesktop().id())) | 1579 UpdateMediaSinks(MediaSourceForDesktop().id())) |
| 1573 .WillOnce(InvokeWithoutArgs([&run_loop2]() { | 1580 .WillOnce(InvokeWithoutArgs([&run_loop2]() { |
| 1574 run_loop2.Quit(); | 1581 run_loop2.Quit(); |
| 1575 })); | 1582 })); |
| 1576 | 1583 |
| 1577 run_loop2.Run(); | 1584 run_loop2.Run(); |
| 1578 } | 1585 } |
| 1579 | 1586 |
| 1580 } // namespace media_router | 1587 } // namespace media_router |
| OLD | NEW |