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 8b7a04173d6660f73563ef4c707c23bce0c8545d..f6fef473eeaad02b1e03c982733507d62d4916fa 100644 |
--- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc |
+++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc |
@@ -64,6 +64,12 @@ class MockCreatePresentationConnnectionCallbacks { |
void(const content::PresentationError& error)); |
}; |
+class MockPresentationSessionStartedCallback { |
+ public: |
+ MOCK_METHOD1(OnPresentationSessionStartedCallback, |
+ void(const content::PresentationSessionInfo&)); |
+}; |
+ |
class PresentationServiceDelegateImplTest |
: public ChromeRenderViewHostTestHarness { |
public: |
@@ -484,13 +490,30 @@ TEST_F(PresentationServiceDelegateImplTest, ConnectToOffscreenPresentation) { |
GetOrCreateForControllerBrowserContext(GetWebContents()); |
content::PresentationSessionInfo session_info(GURL("presentation_url"), |
- "presentation_id"); |
+ "presentation_id", false); |
EXPECT_EQ(size_t(0), presentation_manager->offscreen_presentations_.size()); |
+ |
+ MockPresentationSessionStartedCallback mock_callback; |
+ EXPECT_CALL(mock_callback, OnPresentationSessionStartedCallback(_)); |
+ MediaRoute media_route( |
+ "route_id", MediaSourceForPresentationUrl(session_info.presentation_url), |
+ "mediaSinkId", "", true, "", true); |
+ delegate_impl_->OnStartSessionSucceeded( |
+ render_process_id, render_frame_id, |
+ base::Bind(&MockPresentationSessionStartedCallback:: |
+ OnPresentationSessionStartedCallback, |
+ base::Unretained(&mock_callback)), |
+ session_info, media_route); |
+ |
content::PresentationConnectionPtr connection; |
delegate_impl_->ConnectToOffscreenPresentation( |
render_process_id, render_frame_id, session_info, std::move(connection)); |
EXPECT_EQ(size_t(1), presentation_manager->offscreen_presentations_.size()); |
+ |
+ EXPECT_CALL(router_, DetachRoute("route_id")); |
+ delegate_impl_->Reset(render_process_id, render_frame_id); |
+ EXPECT_TRUE(presentation_manager->offscreen_presentations_.empty()); |
} |
} // namespace media_router |