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

Unified Diff: chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc

Issue 1693963003: Pass origin to StartObservingMediaSinks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Marks Review Fixes with URL changes Created 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
index 37901954dbe52fba22845e9e77c781fca45806b0..b2f214343b8153e01918609c2be0a239f47c268e 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
@@ -86,6 +86,7 @@ class PresentationServiceDelegateImplTest
&PresentationServiceDelegateImplTest::OnDefaultPresentationStarted,
base::Unretained(this));
std::string presentation_url1("http://foo.fakeUrl");
+ std::string origin_url1("http://foo.fakeUrl.origin.com");
delegate_impl_->SetDefaultPresentationUrl(render_process_id, routing_id,
presentation_url1, callback);
@@ -101,11 +102,13 @@ class PresentationServiceDelegateImplTest
// Should not trigger callback since request doesn't match.
std::string presentation_url2("http://bar.fakeUrl");
+ std::string origin_url2("http://bar.fakeUrl");
PresentationRequest different_request(
RenderFrameHostId(100, 200), presentation_url2,
GURL("http://anotherFrameUrl.fakeUrl"));
MediaRoute* media_route = new MediaRoute(
- "differentRouteId", MediaSourceForPresentationUrl(presentation_url2),
+ "differentRouteId", MediaSourceForPresentationUrl(presentation_url2,
+ origin_url2),
"mediaSinkId", "", true, "", true);
media_route->set_off_the_record(off_the_record);
result = RouteRequestResult::FromSuccess(make_scoped_ptr(media_route),
@@ -116,7 +119,8 @@ class PresentationServiceDelegateImplTest
// Should trigger callback since request matches.
EXPECT_CALL(*this, OnDefaultPresentationStarted(_)).Times(1);
MediaRoute* media_route2 = new MediaRoute(
- "routeId", MediaSourceForPresentationUrl(presentation_url1),
+ "routeId", MediaSourceForPresentationUrl(presentation_url1,
+ origin_url1),
"mediaSinkId", "", true, "", true);
media_route2->set_off_the_record(off_the_record);
result = RouteRequestResult::FromSuccess(make_scoped_ptr(media_route2),
@@ -158,9 +162,13 @@ class PresentationServiceDelegateImplIncognitoTest
TEST_F(PresentationServiceDelegateImplTest, AddScreenAvailabilityListener) {
std::string presentation_url1("http://url1.fakeUrl");
+ std::string origin_url1("http://url1.fakeUrl.origin.com");
std::string presentation_url2("http://url2.fakeUrl");
- MediaSource source1 = MediaSourceForPresentationUrl(presentation_url1);
- MediaSource source2 = MediaSourceForPresentationUrl(presentation_url2);
+ std::string origin_url2("http://url2.fakeUrl.origin.com");
+ MediaSource source1 = MediaSourceForPresentationUrl(presentation_url1,
+ origin_url1);
+ MediaSource source2 = MediaSourceForPresentationUrl(presentation_url2,
+ origin_url2);
MockScreenAvailabilityListener listener1(presentation_url1);
MockScreenAvailabilityListener listener2(presentation_url2);
int render_process_id = 10;
@@ -196,9 +204,13 @@ TEST_F(PresentationServiceDelegateImplTest, AddMultipleListenersToFrame) {
ON_CALL(router_, RegisterMediaSinksObserver(_)).WillByDefault(Return(true));
std::string presentation_url1("http://url1.com");
+ std::string origin_url1("http://url1.origin.com");
std::string presentation_url2("http://url2.com");
- MediaSource source1 = MediaSourceForPresentationUrl(presentation_url1);
- MediaSource source2 = MediaSourceForPresentationUrl(presentation_url2);
+ std::string origin_url2("http://url2.origin.com");
+ MediaSource source1 = MediaSourceForPresentationUrl(presentation_url1,
+ origin_url1);
+ MediaSource source2 = MediaSourceForPresentationUrl(presentation_url2,
+ origin_url2);
MockScreenAvailabilityListener listener1(presentation_url1);
MockScreenAvailabilityListener listener2(presentation_url2);
int render_process_id = 10;
@@ -229,7 +241,8 @@ TEST_F(PresentationServiceDelegateImplTest, AddMultipleListenersToFrame) {
TEST_F(PresentationServiceDelegateImplTest, AddSameListenerTwice) {
std::string presentation_url1("http://url1.fakeUrl");
- MediaSource source1(MediaSourceForPresentationUrl(presentation_url1));
+ MediaSource source1(MediaSourceForPresentationUrl(presentation_url1,
+ presentation_url1));
MockScreenAvailabilityListener listener1(presentation_url1);
int render_process_id = 1;
int render_frame_id = 0;
@@ -370,6 +383,7 @@ TEST_F(PresentationServiceDelegateImplTest, ListenForConnnectionStateChange) {
.WillOnce(SaveArg<4>(&route_response_callbacks));
const std::string kPresentationUrl("http://url1.fakeUrl");
+ const std::string kOriginUrl("http://url1.fakeUrl.origin.com");
const std::string kPresentationId("pid");
MockCreatePresentationConnnectionCallbacks mock_create_connection_callbacks;
delegate_impl_->JoinSession(
@@ -385,7 +399,8 @@ TEST_F(PresentationServiceDelegateImplTest, ListenForConnnectionStateChange) {
.Times(1);
scoped_ptr<RouteRequestResult> result = RouteRequestResult::FromSuccess(
make_scoped_ptr(new MediaRoute(
- "routeId", MediaSourceForPresentationUrl(kPresentationUrl),
+ "routeId", MediaSourceForPresentationUrl(kPresentationUrl,
+ kOriginUrl),
"mediaSinkId", "description", true, "", true)),
kPresentationId);
for (const auto& route_response_callback : route_response_callbacks)
@@ -408,7 +423,9 @@ TEST_F(PresentationServiceDelegateImplTest, Reset) {
.WillRepeatedly(Return(true));
std::string presentation_url1("http://url1.fakeUrl");
- MediaSource source = MediaSourceForPresentationUrl(presentation_url1);
+ std::string origin_url1("http://url1.fakeUrl.origin.com");
+ MediaSource source = MediaSourceForPresentationUrl(presentation_url1,
+ origin_url1);
MockScreenAvailabilityListener listener1(presentation_url1);
int render_process_id = 1;
int render_frame_id = 0;
« no previous file with comments | « chrome/browser/media/router/presentation_service_delegate_impl.cc ('k') | chrome/browser/media/router/test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698