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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 } | 543 } |
540 | 544 |
541 TEST_F(PresentationServiceImplTest, CloseSession) { | 545 TEST_F(PresentationServiceImplTest, CloseSession) { |
542 service_ptr_->CloseSession(kPresentationUrl, kPresentationId); | 546 service_ptr_->CloseSession(kPresentationUrl, kPresentationId); |
543 base::RunLoop run_loop; | 547 base::RunLoop run_loop; |
544 EXPECT_CALL(mock_delegate_, CloseSession(_, _, Eq(kPresentationId))) | 548 EXPECT_CALL(mock_delegate_, CloseSession(_, _, Eq(kPresentationId))) |
545 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 549 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
546 run_loop.Run(); | 550 run_loop.Run(); |
547 } | 551 } |
548 | 552 |
| 553 TEST_F(PresentationServiceImplTest, TerminateSession) { |
| 554 service_ptr_->TerminateSession(kPresentationUrl, kPresentationId); |
| 555 base::RunLoop run_loop; |
| 556 EXPECT_CALL(mock_delegate_, TerminateSession(_, _, Eq(kPresentationId))) |
| 557 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 558 run_loop.Run(); |
| 559 } |
| 560 |
549 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesPassed) { | 561 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesPassed) { |
550 std::string text_msg("123"); | 562 std::string text_msg("123"); |
551 std::vector<uint8_t> binary_data(3, '\1'); | 563 std::vector<uint8_t> binary_data(3, '\1'); |
552 RunListenForSessionMessages(text_msg, binary_data, true); | 564 RunListenForSessionMessages(text_msg, binary_data, true); |
553 } | 565 } |
554 | 566 |
555 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesCopied) { | 567 TEST_F(PresentationServiceImplTest, ListenForSessionMessagesCopied) { |
556 std::string text_msg("123"); | 568 std::string text_msg("123"); |
557 std::vector<uint8_t> binary_data(3, '\1'); | 569 std::vector<uint8_t> binary_data(3, '\1'); |
558 RunListenForSessionMessages(text_msg, binary_data, false); | 570 RunListenForSessionMessages(text_msg, binary_data, false); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 792 |
781 TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) { | 793 TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) { |
782 mock_delegate_.set_screen_availability_listening_supported(false); | 794 mock_delegate_.set_screen_availability_listening_supported(false); |
783 EXPECT_CALL(mock_client_, | 795 EXPECT_CALL(mock_client_, |
784 OnScreenAvailabilityNotSupported(Eq(kPresentationUrl))); | 796 OnScreenAvailabilityNotSupported(Eq(kPresentationUrl))); |
785 | 797 |
786 ListenForScreenAvailabilityAndWait(kPresentationUrl, false); | 798 ListenForScreenAvailabilityAndWait(kPresentationUrl, false); |
787 } | 799 } |
788 | 800 |
789 } // namespace content | 801 } // namespace content |
OLD | NEW |