Index: content/browser/presentation/presentation_service_impl_unittest.cc |
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc |
index 1f7f758405395f55c0f519d7aeba2e52f4302d3e..90005c1835f3c3accad8be2e0702c216e5cc792d 100644 |
--- a/content/browser/presentation/presentation_service_impl_unittest.cc |
+++ b/content/browser/presentation/presentation_service_impl_unittest.cc |
@@ -65,6 +65,15 @@ class MockPresentationServiceDelegate : public PresentationServiceDelegate { |
const std::string& presentation_id, |
const PresentationSessionSuccessCallback& success_cb, |
const PresentationSessionErrorCallback& error_cb)); |
+ |
+ MOCK_METHOD6(SendStringMessage, |
+ void( |
+ int render_process_id, |
+ int render_frame_id, |
+ const std::string& presentation_url, |
+ const std::string& presentation_id, |
+ const std::string& message, |
+ const SendMessageCallback& send_message_cb)); |
}; |
class PresentationServiceImplTest : public RenderViewHostImplTestHarness { |
@@ -184,6 +193,11 @@ class PresentationServiceImplTest : public RenderViewHostImplTestHarness { |
run_loop_quit_closure_.Run(); |
} |
+ void ExpectSendMessageMojoCallback() { |
+ if (!run_loop_quit_closure_.is_null()) |
+ run_loop_quit_closure_.Run(); |
+ } |
+ |
MockPresentationServiceDelegate mock_delegate_; |
scoped_ptr<PresentationServiceImpl> service_impl_; |
mojo::InterfacePtr<presentation::PresentationService> service_ptr_; |
@@ -581,4 +595,27 @@ TEST_F(PresentationServiceImplTest, StartSessionInProgress) { |
SaveQuitClosureAndRunLoop(); |
} |
+TEST_F(PresentationServiceImplTest, SendStringMessage) { |
+ std::string presentation_url("http://fooUrl"); |
+ std::string presentation_id("presentationId"); |
+ std::string message("testMessage"); |
+ service_ptr_->SendStringMessage( |
+ presentation_url, |
+ presentation_id, |
+ message, |
+ base::Bind( |
+ &PresentationServiceImplTest::ExpectSendMessageMojoCallback, |
+ base::Unretained(this))); |
+ base::RunLoop run_loop; |
+ base::Callback<void()> send_message_cb; |
+ EXPECT_CALL(mock_delegate_, SendStringMessage( |
+ _, _, Eq(presentation_url), Eq(presentation_id), Eq(message), _)) |
+ .WillOnce(DoAll( |
+ InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit), |
+ SaveArg<5>(&send_message_cb))); |
+ run_loop.Run(); |
+ send_message_cb.Run(); |
+ SaveQuitClosureAndRunLoop(); |
+} |
+ |
} // namespace content |