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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "content/browser/presentation/presentation_service_impl.h" | 8 #include "content/browser/presentation/presentation_service_impl.h" |
9 #include "content/public/browser/presentation_service_delegate.h" | 9 #include "content/public/browser/presentation_service_delegate.h" |
10 #include "content/public/browser/presentation_session.h" | 10 #include "content/public/browser/presentation_session.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 void ExpectNewSessionMojoCallbackError( | 178 void ExpectNewSessionMojoCallbackError( |
179 presentation::PresentationSessionInfoPtr info, | 179 presentation::PresentationSessionInfoPtr info, |
180 presentation::PresentationErrorPtr error) { | 180 presentation::PresentationErrorPtr error) { |
181 EXPECT_TRUE(info.is_null()); | 181 EXPECT_TRUE(info.is_null()); |
182 EXPECT_FALSE(error.is_null()); | 182 EXPECT_FALSE(error.is_null()); |
183 if (!run_loop_quit_closure_.is_null()) | 183 if (!run_loop_quit_closure_.is_null()) |
184 run_loop_quit_closure_.Run(); | 184 run_loop_quit_closure_.Run(); |
185 } | 185 } |
186 | 186 |
| 187 void ExpectSendMessageMojoCallback() { |
| 188 if (!run_loop_quit_closure_.is_null()) |
| 189 run_loop_quit_closure_.Run(); |
| 190 } |
| 191 |
187 MockPresentationServiceDelegate mock_delegate_; | 192 MockPresentationServiceDelegate mock_delegate_; |
188 scoped_ptr<PresentationServiceImpl> service_impl_; | 193 scoped_ptr<PresentationServiceImpl> service_impl_; |
189 mojo::InterfacePtr<presentation::PresentationService> service_ptr_; | 194 mojo::InterfacePtr<presentation::PresentationService> service_ptr_; |
190 base::Closure run_loop_quit_closure_; | 195 base::Closure run_loop_quit_closure_; |
191 int callback_count_; | 196 int callback_count_; |
192 }; | 197 }; |
193 | 198 |
194 TEST_F(PresentationServiceImplTest, ListenForScreenAvailability) { | 199 TEST_F(PresentationServiceImplTest, ListenForScreenAvailability) { |
195 std::string presentation_url("http://fooUrl"); | 200 std::string presentation_url("http://fooUrl"); |
196 ListenForScreenAvailabilityAndWait( | 201 ListenForScreenAvailabilityAndWait( |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 579 |
575 // Running the callback means the first request is done. It should now | 580 // Running the callback means the first request is done. It should now |
576 // move on to the queued request. | 581 // move on to the queued request. |
577 EXPECT_CALL(mock_delegate_, StartSession( | 582 EXPECT_CALL(mock_delegate_, StartSession( |
578 _, _, Eq(presentation_url2), Eq(presentation_id2), _, _)) | 583 _, _, Eq(presentation_url2), Eq(presentation_id2), _, _)) |
579 .Times(1); | 584 .Times(1); |
580 success_cb.Run(PresentationSessionInfo(presentation_url1, presentation_id1)); | 585 success_cb.Run(PresentationSessionInfo(presentation_url1, presentation_id1)); |
581 SaveQuitClosureAndRunLoop(); | 586 SaveQuitClosureAndRunLoop(); |
582 } | 587 } |
583 | 588 |
| 589 /* |
| 590 * TODO(s.singapati): Add testcase for SendMessage() |
| 591 */ |
| 592 |
584 } // namespace content | 593 } // namespace content |
OLD | NEW |