| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void(int render_process_id, | 100 void(int render_process_id, |
| 101 int render_frame_id, | 101 int render_frame_id, |
| 102 const std::string& presentation_url, | 102 const std::string& presentation_url, |
| 103 const std::string& presentation_id, | 103 const std::string& presentation_id, |
| 104 const PresentationSessionStartedCallback& success_cb, | 104 const PresentationSessionStartedCallback& success_cb, |
| 105 const PresentationSessionErrorCallback& error_cb)); | 105 const PresentationSessionErrorCallback& error_cb)); |
| 106 MOCK_METHOD3(CloseSession, | 106 MOCK_METHOD3(CloseSession, |
| 107 void(int render_process_id, | 107 void(int render_process_id, |
| 108 int render_frame_id, | 108 int render_frame_id, |
| 109 const std::string& presentation_id)); | 109 const std::string& presentation_id)); |
| 110 MOCK_METHOD3(TerminateSession, |
| 111 void(int render_process_id, |
| 112 int render_frame_id, |
| 113 const std::string& presentation_id)); |
| 110 MOCK_METHOD4(ListenForSessionMessages, | 114 MOCK_METHOD4(ListenForSessionMessages, |
| 111 void(int render_process_id, | 115 void(int render_process_id, |
| 112 int render_frame_id, | 116 int render_frame_id, |
| 113 const content::PresentationSessionInfo& session, | 117 const content::PresentationSessionInfo& session, |
| 114 const PresentationSessionMessageCallback& message_cb)); | 118 const PresentationSessionMessageCallback& message_cb)); |
| 115 MOCK_METHOD5(SendMessageRawPtr, | 119 MOCK_METHOD5(SendMessageRawPtr, |
| 116 void(int render_process_id, | 120 void(int render_process_id, |
| 117 int render_frame_id, | 121 int render_frame_id, |
| 118 const content::PresentationSessionInfo& session, | 122 const content::PresentationSessionInfo& session, |
| 119 PresentationSessionMessage* message_request, | 123 PresentationSessionMessage* message_request, |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 } | 572 } |
| 569 | 573 |
| 570 TEST_F(PresentationServiceImplTest, CloseSession) { | 574 TEST_F(PresentationServiceImplTest, CloseSession) { |
| 571 service_ptr_->CloseSession(kPresentationUrl, kPresentationId); | 575 service_ptr_->CloseSession(kPresentationUrl, kPresentationId); |
| 572 base::RunLoop run_loop; | 576 base::RunLoop run_loop; |
| 573 EXPECT_CALL(mock_delegate_, CloseSession(_, _, Eq(kPresentationId))) | 577 EXPECT_CALL(mock_delegate_, CloseSession(_, _, Eq(kPresentationId))) |
| 574 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 578 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 575 run_loop.Run(); | 579 run_loop.Run(); |
| 576 } | 580 } |
| 577 | 581 |
| 582 TEST_F(PresentationServiceImplTest, TerminateSession) { |
| 583 service_ptr_->TerminateSession(kPresentationUrl, kPresentationId); |
| 584 base::RunLoop run_loop; |
| 585 EXPECT_CALL(mock_delegate_, TerminateSession(_, _, Eq(kPresentationId))) |
| 586 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 587 run_loop.Run(); |
| 588 } |
| 589 |
| 578 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesPassed) { | 590 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesPassed) { |
| 579 std::string text_msg("123"); | 591 std::string text_msg("123"); |
| 580 std::vector<uint8_t> binary_data(3, '\1'); | 592 std::vector<uint8_t> binary_data(3, '\1'); |
| 581 RunListenForSessionMessages(text_msg, binary_data, true); | 593 RunListenForSessionMessages(text_msg, binary_data, true); |
| 582 } | 594 } |
| 583 | 595 |
| 584 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesCopied) { | 596 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesCopied) { |
| 585 std::string text_msg("123"); | 597 std::string text_msg("123"); |
| 586 std::vector<uint8_t> binary_data(3, '\1'); | 598 std::vector<uint8_t> binary_data(3, '\1'); |
| 587 RunListenForSessionMessages(text_msg, binary_data, false); | 599 RunListenForSessionMessages(text_msg, binary_data, false); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 | 804 |
| 793 TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) { | 805 TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) { |
| 794 mock_delegate_.set_screen_availability_listening_supported(false); | 806 mock_delegate_.set_screen_availability_listening_supported(false); |
| 795 EXPECT_CALL(mock_client_, | 807 EXPECT_CALL(mock_client_, |
| 796 OnScreenAvailabilityNotSupported(Eq(kPresentationUrl))); | 808 OnScreenAvailabilityNotSupported(Eq(kPresentationUrl))); |
| 797 | 809 |
| 798 ListenForScreenAvailabilityAndWait(kPresentationUrl, false); | 810 ListenForScreenAvailabilityAndWait(kPresentationUrl, false); |
| 799 } | 811 } |
| 800 | 812 |
| 801 } // namespace content | 813 } // namespace content |
| OLD | NEW |