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 "content/browser/presentation/presentation_service_impl.h" | 5 #include "content/browser/presentation/presentation_service_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 class PresentationServiceImplTest : public RenderViewHostImplTestHarness { | 203 class PresentationServiceImplTest : public RenderViewHostImplTestHarness { |
204 public: | 204 public: |
205 PresentationServiceImplTest() | 205 PresentationServiceImplTest() |
206 : presentation_url1_(GURL(kPresentationUrl1)), | 206 : presentation_url1_(GURL(kPresentationUrl1)), |
207 presentation_url2_(GURL(kPresentationUrl2)), | 207 presentation_url2_(GURL(kPresentationUrl2)), |
208 presentation_url3_(GURL(kPresentationUrl3)) {} | 208 presentation_url3_(GURL(kPresentationUrl3)) {} |
209 | 209 |
210 void SetUp() override { | 210 void SetUp() override { |
211 RenderViewHostImplTestHarness::SetUp(); | 211 RenderViewHostImplTestHarness::SetUp(); |
212 | 212 |
213 auto request = mojo::GetProxy(&service_ptr_); | 213 auto request = mojo::MakeRequest(&service_ptr_); |
214 EXPECT_CALL(mock_delegate_, AddObserver(_, _, _)).Times(1); | 214 EXPECT_CALL(mock_delegate_, AddObserver(_, _, _)).Times(1); |
215 TestRenderFrameHost* render_frame_host = contents()->GetMainFrame(); | 215 TestRenderFrameHost* render_frame_host = contents()->GetMainFrame(); |
216 render_frame_host->InitializeRenderFrameIfNeeded(); | 216 render_frame_host->InitializeRenderFrameIfNeeded(); |
217 service_impl_.reset(new PresentationServiceImpl( | 217 service_impl_.reset(new PresentationServiceImpl( |
218 render_frame_host, contents(), &mock_delegate_)); | 218 render_frame_host, contents(), &mock_delegate_)); |
219 service_impl_->Bind(std::move(request)); | 219 service_impl_->Bind(std::move(request)); |
220 | 220 |
221 blink::mojom::PresentationServiceClientPtr client_ptr; | 221 blink::mojom::PresentationServiceClientPtr client_ptr; |
222 client_binding_.reset( | 222 client_binding_.reset( |
223 new mojo::Binding<blink::mojom::PresentationServiceClient>( | 223 new mojo::Binding<blink::mojom::PresentationServiceClient>( |
224 &mock_client_, mojo::GetProxy(&client_ptr))); | 224 &mock_client_, mojo::MakeRequest(&client_ptr))); |
225 service_impl_->SetClient(std::move(client_ptr)); | 225 service_impl_->SetClient(std::move(client_ptr)); |
226 | 226 |
227 presentation_urls_.push_back(presentation_url1_); | 227 presentation_urls_.push_back(presentation_url1_); |
228 presentation_urls_.push_back(presentation_url2_); | 228 presentation_urls_.push_back(presentation_url2_); |
229 } | 229 } |
230 | 230 |
231 void TearDown() override { | 231 void TearDown() override { |
232 service_ptr_.reset(); | 232 service_ptr_.reset(); |
233 if (service_impl_.get()) { | 233 if (service_impl_.get()) { |
234 EXPECT_CALL(mock_delegate_, RemoveObserver(_, _)).Times(1); | 234 EXPECT_CALL(mock_delegate_, RemoveObserver(_, _)).Times(1); |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 mock_delegate_.set_screen_availability_listening_supported(false); | 866 mock_delegate_.set_screen_availability_listening_supported(false); |
867 base::RunLoop run_loop; | 867 base::RunLoop run_loop; |
868 EXPECT_CALL(mock_client_, | 868 EXPECT_CALL(mock_client_, |
869 OnScreenAvailabilityNotSupported(presentation_url1_)) | 869 OnScreenAvailabilityNotSupported(presentation_url1_)) |
870 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 870 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
871 ListenForScreenAvailabilityAndWait(presentation_url1_, false); | 871 ListenForScreenAvailabilityAndWait(presentation_url1_, false); |
872 run_loop.Run(); | 872 run_loop.Run(); |
873 } | 873 } |
874 | 874 |
875 } // namespace content | 875 } // namespace content |
OLD | NEW |