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

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

Issue 2675033002: [Media Router] Add MediaSink subtypes (Closed)
Patch Set: add TypedMediaSink class Created 3 years, 10 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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 new MockMediaSinksObserver(router(), MediaSource(kSource2), origin)); 713 new MockMediaSinksObserver(router(), MediaSource(kSource2), origin));
714 EXPECT_TRUE(unrelated_sinks_observer->Init()); 714 EXPECT_TRUE(unrelated_sinks_observer->Init());
715 ProcessEventLoop(); 715 ProcessEventLoop();
716 716
717 std::vector<MediaSink> expected_sinks; 717 std::vector<MediaSink> expected_sinks;
718 expected_sinks.push_back( 718 expected_sinks.push_back(
719 MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST)); 719 MediaSink(kSinkId, kSinkName, MediaSink::IconType::CAST));
720 expected_sinks.push_back( 720 expected_sinks.push_back(
721 MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST)); 721 MediaSink(kSinkId2, kSinkName, MediaSink::IconType::CAST));
722 722
723 std::vector<mojom::MediaSinkPtr> mojo_sinks(2);
724 mojo_sinks[0] = mojom::MediaSink::New();
725 mojo_sinks[0]->sink_id = kSinkId;
726 mojo_sinks[0]->name = kSinkName;
727 mojo_sinks[0]->icon_type =
728 media_router::mojom::MediaSink::IconType::CAST;
729 mojo_sinks[1] = mojom::MediaSink::New();
730 mojo_sinks[1]->sink_id = kSinkId2;
731 mojo_sinks[1]->name = kSinkName;
732 mojo_sinks[1]->icon_type =
733 media_router::mojom::MediaSink::IconType::CAST;
734
735 base::RunLoop run_loop; 723 base::RunLoop run_loop;
736 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks))); 724 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks)));
737 EXPECT_CALL(*extra_sinks_observer, 725 EXPECT_CALL(*extra_sinks_observer,
738 OnSinksReceived(SequenceEquals(expected_sinks))) 726 OnSinksReceived(SequenceEquals(expected_sinks)))
739 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); 727 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
740 media_router_proxy_->OnSinksReceived( 728 media_router_proxy_->OnSinksReceived(
741 media_source.id(), std::move(mojo_sinks), 729 media_source.id(), expected_sinks,
742 std::vector<std::string>(1, origin.spec())); 730 std::vector<std::string>(1, origin.spec()));
743 run_loop.Run(); 731 run_loop.Run();
744 732
745 // Since the MediaRouterMojoImpl has already received results for 733 // Since the MediaRouterMojoImpl has already received results for
746 // |media_source|, return cached results to observers that are subsequently 734 // |media_source|, return cached results to observers that are subsequently
747 // registered. 735 // registered.
748 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer( 736 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer(
749 new MockMediaSinksObserver(router(), media_source, origin)); 737 new MockMediaSinksObserver(router(), media_source, origin));
750 EXPECT_CALL(*cached_sinks_observer, 738 EXPECT_CALL(*cached_sinks_observer,
751 OnSinksReceived(SequenceEquals(expected_sinks))); 739 OnSinksReceived(SequenceEquals(expected_sinks)));
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 EXPECT_CALL(mock_media_route_provider_, 1548 EXPECT_CALL(mock_media_route_provider_,
1561 UpdateMediaSinks(MediaSourceForDesktop().id())) 1549 UpdateMediaSinks(MediaSourceForDesktop().id()))
1562 .WillOnce(InvokeWithoutArgs([&run_loop2]() { 1550 .WillOnce(InvokeWithoutArgs([&run_loop2]() {
1563 run_loop2.Quit(); 1551 run_loop2.Quit();
1564 })); 1552 }));
1565 1553
1566 run_loop2.Run(); 1554 run_loop2.Run();
1567 } 1555 }
1568 1556
1569 } // namespace media_router 1557 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698