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

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

Issue 2547703002: [Media Router] Handle multiple Presentation URLs when creating routes (Closed)
Patch Set: rebase Created 4 years 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/create_presentation_connection_request_unittest.cc
diff --git a/chrome/browser/media/router/create_presentation_connection_request_unittest.cc b/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
index 6d9fdf30f68072ea62a98b81c97f2cf7154b5aad..8e71ecb44e563d18f3fe85abf74ed53c6091efe3 100644
--- a/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
+++ b/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
@@ -12,11 +12,13 @@ namespace media_router {
namespace {
-const char kPresentationUrl[] = "http://foo.com";
-const char kFrameUrl[] = "http://google.com";
-const char kPresentationId[] = "presentationId";
-const char kRouteId[] =
- "urn:x-org.chromium:media:route:presentationId/cast-sink1/http://foo.com";
+constexpr char kPresentationUrl1[] = "http://www.example.com/presentation.html";
+constexpr char kPresentationUrl2[] = "http://www.example.net/alternate.html";
+constexpr char kFrameUrl[] = "http://google.com";
+constexpr char kPresentationId[] = "presentationId";
+constexpr char kRouteId[] =
+ "urn:x-org.chromium:media:route:presentationId/cast-sink1/"
+ "http://www.example.com/presentation.html";
} // namespace
@@ -25,8 +27,8 @@ class CreatePresentationConnectionRequestTest : public ::testing::Test {
CreatePresentationConnectionRequestTest()
: cb_invoked_(false),
render_frame_host_id_(1, 2),
- presentation_url_(kPresentationUrl),
- presentation_urls_({presentation_url_}) {}
+ presentation_url_(kPresentationUrl1),
+ presentation_urls_({presentation_url_, GURL(kPresentationUrl2)}) {}
~CreatePresentationConnectionRequestTest() override {}
@@ -36,6 +38,7 @@ class CreatePresentationConnectionRequestTest : public ::testing::Test {
cb_invoked_ = true;
EXPECT_EQ(expected_info.presentation_url, actual_info.presentation_url);
EXPECT_EQ(expected_info.presentation_id, actual_info.presentation_id);
+ EXPECT_EQ(route.media_route_id(), kRouteId);
}
void OnError(const content::PresentationError& expected_error,
@@ -65,7 +68,7 @@ TEST_F(CreatePresentationConnectionRequestTest, Getters) {
content::PresentationError error(content::PRESENTATION_ERROR_UNKNOWN,
"Unknown error.");
CreatePresentationConnectionRequest request(
- render_frame_host_id_, presentation_url_, GURL(kFrameUrl),
+ render_frame_host_id_, presentation_urls_, GURL(kFrameUrl),
base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess,
base::Unretained(this)),
base::Bind(&CreatePresentationConnectionRequestTest::OnError,
@@ -82,14 +85,14 @@ TEST_F(CreatePresentationConnectionRequestTest, SuccessCallback) {
content::PresentationSessionInfo session_info(presentation_url_,
kPresentationId);
CreatePresentationConnectionRequest request(
- render_frame_host_id_, presentation_url_, GURL(kFrameUrl),
+ render_frame_host_id_, {presentation_url_}, GURL(kFrameUrl),
base::Bind(&CreatePresentationConnectionRequestTest::OnSuccess,
base::Unretained(this), session_info),
base::Bind(&CreatePresentationConnectionRequestTest::FailOnError,
base::Unretained(this)));
MediaRoute route(kRouteId, MediaSourceForTab(1), "sinkId", "Description",
false, "", false);
- request.InvokeSuccessCallback(kPresentationId, route);
+ request.InvokeSuccessCallback(kPresentationId, presentation_url_, route);
EXPECT_TRUE(cb_invoked_);
}
@@ -98,7 +101,7 @@ TEST_F(CreatePresentationConnectionRequestTest, ErrorCallback) {
content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED,
"This is an error message");
CreatePresentationConnectionRequest request(
- render_frame_host_id_, presentation_url_, GURL(kFrameUrl),
+ render_frame_host_id_, presentation_urls_, GURL(kFrameUrl),
base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess,
base::Unretained(this)),
base::Bind(&CreatePresentationConnectionRequestTest::OnError,

Powered by Google App Engine
This is Rietveld 408576698