| Index: chrome/browser/media/router/create_presentation_connection_request_unittest.cc
|
| diff --git a/chrome/browser/media/router/create_presentation_session_request_unittest.cc b/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
|
| similarity index 62%
|
| rename from chrome/browser/media/router/create_presentation_session_request_unittest.cc
|
| rename to chrome/browser/media/router/create_presentation_connection_request_unittest.cc
|
| index 98614c678d521895d4ccb2e20c2153ba17faa93f..7532529ea12866b4f8842ff379cf3b8fa90ee484 100644
|
| --- a/chrome/browser/media/router/create_presentation_session_request_unittest.cc
|
| +++ b/chrome/browser/media/router/create_presentation_connection_request_unittest.cc
|
| @@ -3,7 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/bind.h"
|
| -#include "chrome/browser/media/router/create_presentation_session_request.h"
|
| +#include "chrome/browser/media/router/create_presentation_connection_request.h"
|
| #include "chrome/browser/media/router/media_source_helper.h"
|
| #include "content/public/browser/presentation_service_delegate.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| @@ -13,16 +13,18 @@ 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";
|
|
|
| } // namespace
|
|
|
| -class CreatePresentationSessionRequestTest : public ::testing::Test {
|
| +class CreatePresentationConnectionRequestTest : public ::testing::Test {
|
| public:
|
| - CreatePresentationSessionRequestTest() : cb_invoked_(false) {}
|
| - ~CreatePresentationSessionRequestTest() override {}
|
| + CreatePresentationConnectionRequestTest()
|
| + : cb_invoked_(false), render_frame_host_id_(1, 2) {}
|
| + ~CreatePresentationConnectionRequestTest() override {}
|
|
|
| void OnSuccess(const content::PresentationSessionInfo& expected_info,
|
| const content::PresentationSessionInfo& actual_info,
|
| @@ -49,52 +51,49 @@ class CreatePresentationSessionRequestTest : public ::testing::Test {
|
| }
|
|
|
| bool cb_invoked_;
|
| + const RenderFrameHostId render_frame_host_id_;
|
| };
|
|
|
| // Test that the object's getters match the constructor parameters.
|
| -TEST_F(CreatePresentationSessionRequestTest, Getters) {
|
| - GURL frame_url("http://frameUrl");
|
| +TEST_F(CreatePresentationConnectionRequestTest, Getters) {
|
| content::PresentationError error(content::PRESENTATION_ERROR_UNKNOWN,
|
| "Unknown error.");
|
| - CreatePresentationSessionRequest request(
|
| - kPresentationUrl, frame_url,
|
| - base::Bind(&CreatePresentationSessionRequestTest::FailOnSuccess,
|
| + CreatePresentationConnectionRequest request(
|
| + render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl),
|
| + base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess,
|
| base::Unretained(this)),
|
| - base::Bind(&CreatePresentationSessionRequestTest::OnError,
|
| + base::Bind(&CreatePresentationConnectionRequestTest::OnError,
|
| base::Unretained(this), error));
|
| - EXPECT_EQ(frame_url, request.frame_url());
|
| - EXPECT_EQ(kPresentationUrl,
|
| - PresentationUrlFromMediaSource(request.media_source()));
|
| +
|
| + PresentationRequest presentation_request(render_frame_host_id_,
|
| + kPresentationUrl, GURL(kFrameUrl));
|
| + EXPECT_TRUE(request.presentation_request().Equals(presentation_request));
|
| // Since we didn't explicitly call Invoke*, the error callback will be
|
| // invoked when |request| is destroyed.
|
| }
|
|
|
| -TEST_F(CreatePresentationSessionRequestTest, SuccessCallback) {
|
| - GURL frame_url("http://frameUrl");
|
| +TEST_F(CreatePresentationConnectionRequestTest, SuccessCallback) {
|
| content::PresentationSessionInfo session_info(kPresentationUrl,
|
| kPresentationId);
|
| - CreatePresentationSessionRequest request(
|
| - kPresentationUrl, frame_url,
|
| - base::Bind(&CreatePresentationSessionRequestTest::OnSuccess,
|
| + CreatePresentationConnectionRequest request(
|
| + render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl),
|
| + base::Bind(&CreatePresentationConnectionRequestTest::OnSuccess,
|
| base::Unretained(this), session_info),
|
| - base::Bind(&CreatePresentationSessionRequestTest::FailOnError,
|
| + base::Bind(&CreatePresentationConnectionRequestTest::FailOnError,
|
| base::Unretained(this)));
|
| request.InvokeSuccessCallback(kPresentationId, kRouteId);
|
| EXPECT_TRUE(cb_invoked_);
|
| }
|
|
|
| -TEST_F(CreatePresentationSessionRequestTest, ErrorCallback) {
|
| - GURL frame_url("http://frameUrl");
|
| - content::PresentationSessionInfo session_info(kPresentationUrl,
|
| - kPresentationId);
|
| +TEST_F(CreatePresentationConnectionRequestTest, ErrorCallback) {
|
| content::PresentationError error(
|
| content::PRESENTATION_ERROR_SESSION_REQUEST_CANCELLED,
|
| "This is an error message");
|
| - CreatePresentationSessionRequest request(
|
| - kPresentationUrl, frame_url,
|
| - base::Bind(&CreatePresentationSessionRequestTest::FailOnSuccess,
|
| + CreatePresentationConnectionRequest request(
|
| + render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl),
|
| + base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess,
|
| base::Unretained(this)),
|
| - base::Bind(&CreatePresentationSessionRequestTest::OnError,
|
| + base::Bind(&CreatePresentationConnectionRequestTest::OnError,
|
| base::Unretained(this), error));
|
| request.InvokeErrorCallback(error);
|
| EXPECT_TRUE(cb_invoked_);
|
|
|