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

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

Issue 2737413003: [Presentation API] Remove references to presentation sessions. (Closed)
Patch Set: Update PresentationServiceDelegateImpl unittest Created 3 years, 9 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 ab200c304682344f4b1de6c8d5c7a2184b9be561..5557b8a6f3cad0c6f4b526c61ce84c34e9e61d80 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
@@ -22,7 +22,7 @@
#include "content/public/browser/presentation_screen_availability_listener.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
-#include "content/public/common/presentation_session.h"
+#include "content/public/common/presentation_info.h"
#include "content/public/test/web_contents_tester.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -51,7 +51,7 @@ class MockDelegateObserver
public:
MOCK_METHOD0(OnDelegateDestroyed, void());
MOCK_METHOD1(OnDefaultPresentationStarted,
- void(const content::PresentationSessionInfo&));
+ void(const content::PresentationInfo&));
};
class MockDefaultPresentationRequestObserver
@@ -65,7 +65,7 @@ class MockDefaultPresentationRequestObserver
class MockCreatePresentationConnnectionCallbacks {
public:
MOCK_METHOD1(OnCreateConnectionSuccess,
- void(const content::PresentationSessionInfo& connection));
+ void(const content::PresentationInfo& connection));
MOCK_METHOD1(OnCreateConnectionError,
void(const content::PresentationError& error));
};
@@ -133,7 +133,7 @@ class PresentationServiceDelegateImplTest
}
MOCK_METHOD1(OnDefaultPresentationStarted,
- void(const content::PresentationSessionInfo& session_info));
+ void(const content::PresentationInfo& presentation_info));
protected:
virtual content::WebContents* GetWebContents() { return web_contents(); }
@@ -440,7 +440,7 @@ TEST_F(PresentationServiceDelegateImplTest, ListenForConnnectionStateChange) {
.WillRepeatedly(Return(false));
MockCreatePresentationConnnectionCallbacks mock_create_connection_callbacks;
- delegate_impl_->JoinSession(
+ delegate_impl_->ReconnectPresentation(
main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
kPresentationId,
base::Bind(&MockCreatePresentationConnnectionCallbacks::
@@ -462,8 +462,7 @@ TEST_F(PresentationServiceDelegateImplTest, ListenForConnnectionStateChange) {
base::MockCallback<content::PresentationConnectionStateChangedCallback>
mock_callback;
auto callback = mock_callback.Get();
- content::PresentationSessionInfo connection(presentation_url1_,
- kPresentationId);
+ content::PresentationInfo connection(presentation_url1_, kPresentationId);
EXPECT_CALL(router_, OnAddPresentationConnectionStateChangedCallbackInvoked(
Equals(callback)));
delegate_impl_->ListenForConnectionStateChange(
@@ -513,8 +512,8 @@ TEST_F(PresentationServiceDelegateImplTest,
TestCloseConnectionForOffscreenPresentation) {
std::string presentation_id = "presentation_id";
GURL presentation_url = GURL("http://www.example.com/presentation.html");
- content::PresentationSessionInfo session_info(presentation_url,
- presentation_id);
+ content::PresentationInfo presentation_info(presentation_url,
+ presentation_id);
RenderFrameHostId rfh_id(main_frame_process_id_, main_frame_routing_id_);
MediaRoute media_route("route_id",
MediaSourceForPresentationUrl(presentation_url),
@@ -525,12 +524,12 @@ TEST_F(PresentationServiceDelegateImplTest,
EXPECT_CALL(mock_offscreen_manager, IsOffscreenPresentation(presentation_id))
.WillRepeatedly(Return(true));
- base::MockCallback<content::PresentationSessionStartedCallback> success_cb;
+ base::MockCallback<content::PresentationConnectionCallback> success_cb;
EXPECT_CALL(success_cb, Run(_));
- delegate_impl_->OnStartSessionSucceeded(
+ delegate_impl_->OnStartPresentationSucceeded(
main_frame_process_id_, main_frame_routing_id_, success_cb.Get(),
- session_info, media_route);
+ presentation_info, media_route);
EXPECT_CALL(mock_offscreen_manager, UnregisterOffscreenPresentationController(
presentation_id, rfh_id))
@@ -544,7 +543,7 @@ TEST_F(PresentationServiceDelegateImplTest,
}
TEST_F(PresentationServiceDelegateImplTest,
- TestJoinSessionForOffscreenPresentation) {
+ TestReconnectPresentationForOffscreenPresentation) {
std::string presentation_id = "presentation_id";
GURL presentation_url = GURL("http://www.example.com/presentation.html");
MediaRoute media_route("route_id",
@@ -559,17 +558,17 @@ TEST_F(PresentationServiceDelegateImplTest,
.WillRepeatedly(Return(&media_route));
std::vector<GURL> urls = {presentation_url};
- base::MockCallback<content::PresentationSessionStartedCallback> success_cb;
- base::MockCallback<content::PresentationSessionErrorCallback> error_cb;
+ base::MockCallback<content::PresentationConnectionCallback> success_cb;
+ base::MockCallback<content::PresentationConnectionErrorCallback> error_cb;
EXPECT_CALL(success_cb, Run(_));
EXPECT_CALL(mock_offscreen_manager,
UnregisterOffscreenPresentationController(
presentation_id, RenderFrameHostId(main_frame_process_id_,
main_frame_routing_id_)));
- delegate_impl_->JoinSession(main_frame_process_id_, main_frame_routing_id_,
- urls, presentation_id, success_cb.Get(),
- error_cb.Get());
+ delegate_impl_->ReconnectPresentation(
+ main_frame_process_id_, main_frame_routing_id_, urls, presentation_id,
+ success_cb.Get(), error_cb.Get());
delegate_impl_->Reset(main_frame_process_id_, main_frame_routing_id_);
}
@@ -580,19 +579,21 @@ TEST_F(PresentationServiceDelegateImplTest, ConnectToPresentation) {
int render_frame_id = main_frame->GetRoutingID();
std::string presentation_id = "presentation_id";
GURL presentation_url = GURL("http://www.example.com/presentation.html");
- content::PresentationSessionInfo session_info(presentation_url,
- presentation_id);
+ content::PresentationInfo presentation_info(presentation_url,
+ presentation_id);
+
MediaRoute media_route(
- "route_id", MediaSourceForPresentationUrl(session_info.presentation_url),
+ "route_id",
+ MediaSourceForPresentationUrl(presentation_info.presentation_url),
"mediaSinkId", "", true, "", true);
media_route.set_offscreen_presentation(true);
- base::MockCallback<content::PresentationSessionStartedCallback> success_cb;
+ base::MockCallback<content::PresentationConnectionCallback> success_cb;
EXPECT_CALL(success_cb, Run(_));
- delegate_impl_->OnStartSessionSucceeded(render_process_id, render_frame_id,
- success_cb.Get(), session_info,
- media_route);
+ delegate_impl_->OnStartPresentationSucceeded(
+ render_process_id, render_frame_id, success_cb.Get(), presentation_info,
+ media_route);
auto& mock_offscreen_manager = GetMockOffscreenPresentationManager();
EXPECT_CALL(mock_offscreen_manager,
@@ -603,9 +604,9 @@ TEST_F(PresentationServiceDelegateImplTest, ConnectToPresentation) {
content::PresentationConnectionPtr connection_ptr;
content::PresentationConnectionRequest connection_request;
- delegate_impl_->ConnectToPresentation(render_process_id, render_frame_id,
- session_info, std::move(connection_ptr),
- std::move(connection_request));
+ delegate_impl_->ConnectToPresentation(
+ render_process_id, render_frame_id, presentation_info,
+ std::move(connection_ptr), std::move(connection_request));
EXPECT_CALL(mock_offscreen_manager,
UnregisterOffscreenPresentationController(
@@ -640,7 +641,7 @@ TEST_F(PresentationServiceDelegateImplTest, AutoJoinRequest) {
// Auto-join requests should be rejected.
EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_));
EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0);
- delegate_impl_->JoinSession(
+ delegate_impl_->ReconnectPresentation(
main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
kPresentationId,
base::Bind(&MockCreatePresentationConnnectionCallbacks::
@@ -659,7 +660,7 @@ TEST_F(PresentationServiceDelegateImplTest, AutoJoinRequest) {
// Auto-join requests should now go through.
EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1);
- delegate_impl_->JoinSession(
+ delegate_impl_->ReconnectPresentation(
main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
kPresentationId,
base::Bind(&MockCreatePresentationConnnectionCallbacks::
@@ -701,7 +702,7 @@ TEST_F(PresentationServiceDelegateImplIncognitoTest, AutoJoinRequest) {
// Auto-join requests should be rejected.
EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_));
EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0);
- delegate_impl_->JoinSession(
+ delegate_impl_->ReconnectPresentation(
main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
kPresentationId,
base::Bind(&MockCreatePresentationConnnectionCallbacks::
@@ -720,7 +721,7 @@ TEST_F(PresentationServiceDelegateImplIncognitoTest, AutoJoinRequest) {
// Auto-join requests should now go through.
EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1);
- delegate_impl_->JoinSession(
+ delegate_impl_->ReconnectPresentation(
main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
kPresentationId,
base::Bind(&MockCreatePresentationConnnectionCallbacks::

Powered by Google App Engine
This is Rietveld 408576698