| 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 url::Origin(GURL(kOrigin)))); | 689 url::Origin(GURL(kOrigin)))); |
| 690 EXPECT_TRUE(unrelated_sinks_observer->Init()); | 690 EXPECT_TRUE(unrelated_sinks_observer->Init()); |
| 691 ProcessEventLoop(); | 691 ProcessEventLoop(); |
| 692 | 692 |
| 693 std::vector<MediaSink> expected_sinks; | 693 std::vector<MediaSink> expected_sinks; |
| 694 expected_sinks.push_back( | 694 expected_sinks.push_back( |
| 695 MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST)); | 695 MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST)); |
| 696 expected_sinks.push_back( | 696 expected_sinks.push_back( |
| 697 MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST)); | 697 MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST)); |
| 698 | 698 |
| 699 std::vector<MediaSinkInternal> sinks; |
| 700 sinks.push_back(MediaSinkInternal(expected_sinks[0])); |
| 701 sinks.push_back(MediaSinkInternal(expected_sinks[1])); |
| 702 |
| 699 base::RunLoop run_loop; | 703 base::RunLoop run_loop; |
| 700 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks))); | 704 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks))); |
| 701 EXPECT_CALL(*extra_sinks_observer, | 705 EXPECT_CALL(*extra_sinks_observer, |
| 702 OnSinksReceived(SequenceEquals(expected_sinks))) | 706 OnSinksReceived(SequenceEquals(expected_sinks))) |
| 703 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); | 707 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); |
| 704 media_router_proxy_->OnSinksReceived( | 708 media_router_proxy_->OnSinksReceived( |
| 705 media_source.id(), expected_sinks, | 709 media_source.id(), sinks, |
| 706 std::vector<url::Origin>(1, url::Origin(GURL(kOrigin)))); | 710 std::vector<url::Origin>(1, url::Origin(GURL(kOrigin)))); |
| 707 run_loop.Run(); | 711 run_loop.Run(); |
| 708 | 712 |
| 709 // Since the MediaRouterMojoImpl has already received results for | 713 // Since the MediaRouterMojoImpl has already received results for |
| 710 // |media_source|, return cached results to observers that are subsequently | 714 // |media_source|, return cached results to observers that are subsequently |
| 711 // registered. | 715 // registered. |
| 712 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer( | 716 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer( |
| 713 new MockMediaSinksObserver(router(), media_source, | 717 new MockMediaSinksObserver(router(), media_source, |
| 714 url::Origin(GURL(kOrigin)))); | 718 url::Origin(GURL(kOrigin)))); |
| 715 EXPECT_CALL(*cached_sinks_observer, | 719 EXPECT_CALL(*cached_sinks_observer, |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 EXPECT_CALL(mock_media_route_provider_, | 1518 EXPECT_CALL(mock_media_route_provider_, |
| 1515 UpdateMediaSinks(MediaSourceForDesktop().id())) | 1519 UpdateMediaSinks(MediaSourceForDesktop().id())) |
| 1516 .WillOnce(InvokeWithoutArgs([&run_loop2]() { | 1520 .WillOnce(InvokeWithoutArgs([&run_loop2]() { |
| 1517 run_loop2.Quit(); | 1521 run_loop2.Quit(); |
| 1518 })); | 1522 })); |
| 1519 | 1523 |
| 1520 run_loop2.Run(); | 1524 run_loop2.Run(); |
| 1521 } | 1525 } |
| 1522 | 1526 |
| 1523 } // namespace media_router | 1527 } // namespace media_router |
| OLD | NEW |