| 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/location.h" |
| 5 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/single_thread_task_runner.h" |
| 8 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "base/thread_task_runner_handle.h" |
| 9 #include "content/browser/presentation/presentation_service_impl.h" | 11 #include "content/browser/presentation/presentation_service_impl.h" |
| 10 #include "content/public/browser/presentation_service_delegate.h" | 12 #include "content/public/browser/presentation_service_delegate.h" |
| 11 #include "content/public/browser/presentation_session.h" | 13 #include "content/public/browser/presentation_session.h" |
| 12 #include "content/public/common/presentation_constants.h" | 14 #include "content/public/common/presentation_constants.h" |
| 13 #include "content/test/test_render_frame_host.h" | 15 #include "content/test/test_render_frame_host.h" |
| 14 #include "content/test/test_render_view_host.h" | 16 #include "content/test/test_render_view_host.h" |
| 15 #include "content/test/test_web_contents.h" | 17 #include "content/test/test_web_contents.h" |
| 16 #include "mojo/public/cpp/bindings/interface_ptr.h" | 18 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 17 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 18 | 20 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit), | 169 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit), |
| 168 Return(delegate_success))); | 170 Return(delegate_success))); |
| 169 service_ptr_->ListenForScreenAvailability(); | 171 service_ptr_->ListenForScreenAvailability(); |
| 170 run_loop.Run(); | 172 run_loop.Run(); |
| 171 | 173 |
| 172 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_delegate_)); | 174 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_delegate_)); |
| 173 } | 175 } |
| 174 | 176 |
| 175 void RunLoopFor(base::TimeDelta duration) { | 177 void RunLoopFor(base::TimeDelta duration) { |
| 176 base::RunLoop run_loop; | 178 base::RunLoop run_loop; |
| 177 base::MessageLoop::current()->PostDelayedTask( | 179 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 178 FROM_HERE, run_loop.QuitClosure(), duration); | 180 FROM_HERE, run_loop.QuitClosure(), duration); |
| 179 run_loop.Run(); | 181 run_loop.Run(); |
| 180 } | 182 } |
| 181 | 183 |
| 182 void SaveQuitClosureAndRunLoop() { | 184 void SaveQuitClosureAndRunLoop() { |
| 183 base::RunLoop run_loop; | 185 base::RunLoop run_loop; |
| 184 run_loop_quit_closure_ = run_loop.QuitClosure(); | 186 run_loop_quit_closure_ = run_loop.QuitClosure(); |
| 185 run_loop.Run(); | 187 run_loop.Run(); |
| 186 run_loop_quit_closure_.Reset(); | 188 run_loop_quit_closure_.Reset(); |
| 187 } | 189 } |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 service_ptr_->JoinSession( | 833 service_ptr_->JoinSession( |
| 832 base::StringPrintf(presentation_url, i), | 834 base::StringPrintf(presentation_url, i), |
| 833 base::StringPrintf(presentation_id, i), | 835 base::StringPrintf(presentation_id, i), |
| 834 base::Bind( | 836 base::Bind( |
| 835 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, | 837 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, |
| 836 base::Unretained(this))); | 838 base::Unretained(this))); |
| 837 SaveQuitClosureAndRunLoop(); | 839 SaveQuitClosureAndRunLoop(); |
| 838 } | 840 } |
| 839 | 841 |
| 840 } // namespace content | 842 } // namespace content |
| OLD | NEW |