| Index: chrome/browser/media/router/presentation_media_sinks_observer_unittest.cc
|
| diff --git a/chrome/browser/media/router/presentation_media_sinks_observer_unittest.cc b/chrome/browser/media/router/presentation_media_sinks_observer_unittest.cc
|
| index 21220b46ffef015b587bd1c1de2c035db545eee4..09a63fc55d9161ff8a352f6d5544f37320a24cb2 100644
|
| --- a/chrome/browser/media/router/presentation_media_sinks_observer_unittest.cc
|
| +++ b/chrome/browser/media/router/presentation_media_sinks_observer_unittest.cc
|
| @@ -29,7 +29,8 @@ class PresentationMediaSinksObserverTest : public ::testing::Test {
|
| EXPECT_CALL(router_, RegisterMediaSinksObserver(_)).WillOnce(Return(true));
|
| observer_.reset(new PresentationMediaSinksObserver(
|
| &router_, &listener_,
|
| - MediaSourceForPresentationUrl("http://example.com/presentation.html")));
|
| + MediaSourceForPresentationUrl("http://example.com/presentation.html",
|
| + "http://example.com")));
|
| EXPECT_TRUE(observer_->Init());
|
| }
|
|
|
| @@ -51,21 +52,33 @@ TEST_F(PresentationMediaSinksObserverTest, AvailableScreens) {
|
| result.push_back(MediaSink("sinkId", "Sink", MediaSink::IconType::CAST));
|
|
|
| EXPECT_CALL(listener_, OnScreenAvailabilityChanged(true)).Times(1);
|
| - observer_->OnSinksReceived(result);
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + result);
|
| }
|
|
|
| TEST_F(PresentationMediaSinksObserverTest, NoAvailableScreens) {
|
| EXPECT_CALL(listener_, OnScreenAvailabilityChanged(false)).Times(1);
|
| - observer_->OnSinksReceived(std::vector<MediaSink>());
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + std::vector<MediaSink>());
|
| }
|
|
|
| TEST_F(PresentationMediaSinksObserverTest, ConsecutiveResults) {
|
| EXPECT_CALL(listener_, OnScreenAvailabilityChanged(false)).Times(1);
|
| - observer_->OnSinksReceived(std::vector<MediaSink>());
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + std::vector<MediaSink>());
|
| EXPECT_TRUE(Mock::VerifyAndClearExpectations(&listener_));
|
|
|
| // Does not propagate result to |listener_| since result is same.
|
| - observer_->OnSinksReceived(std::vector<MediaSink>());
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + std::vector<MediaSink>());
|
| EXPECT_TRUE(Mock::VerifyAndClearExpectations(&listener_));
|
|
|
| // |listener_| should get result since it changed to true.
|
| @@ -73,17 +86,26 @@ TEST_F(PresentationMediaSinksObserverTest, ConsecutiveResults) {
|
| result.push_back(MediaSink("sinkId", "Sink", MediaSink::IconType::CAST));
|
|
|
| EXPECT_CALL(listener_, OnScreenAvailabilityChanged(true)).Times(1);
|
| - observer_->OnSinksReceived(result);
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + result);
|
| EXPECT_TRUE(Mock::VerifyAndClearExpectations(&listener_));
|
|
|
| // Does not propagate result to |listener_| since result is same.
|
| result.push_back(MediaSink("sinkId2", "Sink 2", MediaSink::IconType::CAST));
|
| - observer_->OnSinksReceived(result);
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + result);
|
| EXPECT_TRUE(Mock::VerifyAndClearExpectations(&listener_));
|
|
|
| // |listener_| should get result since it changed to false.
|
| EXPECT_CALL(listener_, OnScreenAvailabilityChanged(false)).Times(1);
|
| - observer_->OnSinksReceived(std::vector<MediaSink>());
|
| + observer_->OnSinksReceived(MediaSourceForPresentationUrl(
|
| + "http://example.com/presentation.html",
|
| + "http://example.com"),
|
| + std::vector<MediaSink>());
|
| EXPECT_TRUE(Mock::VerifyAndClearExpectations(&listener_));
|
| }
|
|
|
|
|