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