| 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 31e3d6456cd8b7f59638431014e46e1d1c243458..10536d0124fe3d4af67ca4ac9fc688d9c0f57faa 100644
|
| --- a/content/browser/presentation/presentation_service_impl_unittest.cc
|
| +++ b/content/browser/presentation/presentation_service_impl_unittest.cc
|
| @@ -139,6 +139,12 @@ class MockPresentationServiceDelegate : public PresentationServiceDelegate {
|
| const content::PresentationSessionInfo& connection,
|
| const content::PresentationConnectionStateChangedCallback&
|
| state_changed_cb));
|
| + MOCK_METHOD3(
|
| + GetReceiverConnections,
|
| + std::vector<content::PresentationSessionInfo>(
|
| + int render_process_id,
|
| + int render_frame_id,
|
| + const content::PresentationSessionStartedCallback& callback));
|
|
|
| void set_screen_availability_listening_supported(bool value) {
|
| screen_availability_listening_supported_ = value;
|
| @@ -190,6 +196,13 @@ class MockPresentationServiceClient
|
| MOCK_METHOD1(OnDefaultSessionStarted,
|
| void(const blink::mojom::PresentationSessionInfo& session_info));
|
|
|
| + void OnReceiverConnectionAvailable(
|
| + blink::mojom::PresentationSessionInfoPtr connection) {
|
| + OnReceiverConnectionAvailable(*connection);
|
| + }
|
| + MOCK_METHOD1(OnReceiverConnectionAvailable,
|
| + void(const blink::mojom::PresentationSessionInfo& connection));
|
| +
|
| mojo::Array<blink::mojom::SessionMessagePtr> messages_received_;
|
| };
|
|
|
| @@ -258,6 +271,8 @@ class PresentationServiceImplTest : public RenderViewHostImplTestHarness {
|
| void SimulateScreenAvailabilityChangeAndWait(
|
| const std::string& url, bool available) {
|
| auto listener_it = service_impl_->screen_availability_listeners_.find(url);
|
| + ASSERT_TRUE(listener_it !=
|
| + service_impl_->screen_availability_listeners_.end());
|
| ASSERT_TRUE(listener_it->second);
|
|
|
| base::RunLoop run_loop;
|
| @@ -315,6 +330,14 @@ class PresentationServiceImplTest : public RenderViewHostImplTestHarness {
|
| run_loop_quit_closure_.Run();
|
| }
|
|
|
| + void ExpectReceiverConnections(
|
| + size_t expected_num_connections,
|
| + mojo::Array<blink::mojom::PresentationSessionInfoPtr> connections) {
|
| + EXPECT_EQ(expected_num_connections, connections.size());
|
| + if (!run_loop_quit_closure_.is_null())
|
| + run_loop_quit_closure_.Run();
|
| + }
|
| +
|
| void RunListenForSessionMessages(const std::string& text_msg,
|
| const std::vector<uint8_t>& binary_data,
|
| bool pass_ownership) {
|
| @@ -856,4 +879,16 @@ TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) {
|
| run_loop.Run();
|
| }
|
|
|
| +TEST_F(PresentationServiceImplTest, GetReceiverConnections) {
|
| + std::vector<content::PresentationSessionInfo> connections;
|
| + content::PresentationSessionInfo connection("", kPresentationId);
|
| + connections.push_back(connection);
|
| + EXPECT_CALL(mock_delegate_, GetReceiverConnections(_, _, _))
|
| + .WillOnce(Return(connections));
|
| + service_ptr_->GetReceiverConnections(
|
| + base::Bind(&PresentationServiceImplTest::ExpectReceiverConnections,
|
| + base::Unretained(this), 1));
|
| + SaveQuitClosureAndRunLoop();
|
| +}
|
| +
|
| } // namespace content
|
|
|