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

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: 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); 723 std::vector<std::unique_ptr<MediaSink>> media_sinks;
724 mojo_sinks[0] = mojom::MediaSink::New(); 724 media_sinks.push_back(base::MakeUnique<MediaSink>(kSinkId, kSinkName,
725 mojo_sinks[0]->sink_id = kSinkId; 725 MediaSink::IconType::CAST));
726 mojo_sinks[0]->name = kSinkName; 726 media_sinks.push_back(base::MakeUnique<MediaSink>(kSinkId2, kSinkName,
727 mojo_sinks[0]->icon_type = 727 MediaSink::IconType::CAST));
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 728
735 base::RunLoop run_loop; 729 base::RunLoop run_loop;
736 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks))); 730 EXPECT_CALL(*sinks_observer, OnSinksReceived(SequenceEquals(expected_sinks)));
737 EXPECT_CALL(*extra_sinks_observer, 731 EXPECT_CALL(*extra_sinks_observer,
738 OnSinksReceived(SequenceEquals(expected_sinks))) 732 OnSinksReceived(SequenceEquals(expected_sinks)))
739 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); })); 733 .WillOnce(InvokeWithoutArgs([&run_loop]() { run_loop.Quit(); }));
740 media_router_proxy_->OnSinksReceived( 734 media_router_proxy_->OnSinksReceived(
741 media_source.id(), std::move(mojo_sinks), 735 media_source.id(), std::move(media_sinks),
742 std::vector<std::string>(1, origin.spec())); 736 std::vector<std::string>(1, origin.spec()));
743 run_loop.Run(); 737 run_loop.Run();
744 738
745 // Since the MediaRouterMojoImpl has already received results for 739 // Since the MediaRouterMojoImpl has already received results for
746 // |media_source|, return cached results to observers that are subsequently 740 // |media_source|, return cached results to observers that are subsequently
747 // registered. 741 // registered.
748 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer( 742 std::unique_ptr<MockMediaSinksObserver> cached_sinks_observer(
749 new MockMediaSinksObserver(router(), media_source, origin)); 743 new MockMediaSinksObserver(router(), media_source, origin));
750 EXPECT_CALL(*cached_sinks_observer, 744 EXPECT_CALL(*cached_sinks_observer,
751 OnSinksReceived(SequenceEquals(expected_sinks))); 745 OnSinksReceived(SequenceEquals(expected_sinks)));
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 EXPECT_CALL(mock_media_route_provider_, 1554 EXPECT_CALL(mock_media_route_provider_,
1561 UpdateMediaSinks(MediaSourceForDesktop().id())) 1555 UpdateMediaSinks(MediaSourceForDesktop().id()))
1562 .WillOnce(InvokeWithoutArgs([&run_loop2]() { 1556 .WillOnce(InvokeWithoutArgs([&run_loop2]() {
1563 run_loop2.Quit(); 1557 run_loop2.Quit();
1564 })); 1558 }));
1565 1559
1566 run_loop2.Run(); 1560 run_loop2.Run();
1567 } 1561 }
1568 1562
1569 } // namespace media_router 1563 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698