| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 <memory> | 5 #include <memory> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/public/test/test_browser_thread_bundle.h" | 9 #include "content/public/test/test_browser_thread_bundle.h" |
| 10 #include "content/renderer/presentation/presentation_dispatcher.h" | 10 #include "content/renderer/presentation/presentation_dispatcher.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 urls_, base::MakeUnique<TestWebPresentationConnectionCallback>( | 239 urls_, base::MakeUnique<TestWebPresentationConnectionCallback>( |
| 240 url1_, presentation_id_)); | 240 url1_, presentation_id_)); |
| 241 run_loop.RunUntilIdle(); | 241 run_loop.RunUntilIdle(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 TEST_F(PresentationDispatcherTest, TestStartSessionError) { | 244 TEST_F(PresentationDispatcherTest, TestStartSessionError) { |
| 245 WebString error_message = WebString::fromUTF8("Test error message"); | 245 WebString error_message = WebString::fromUTF8("Test error message"); |
| 246 base::RunLoop run_loop; | 246 base::RunLoop run_loop; |
| 247 | 247 |
| 248 EXPECT_CALL(presentation_service_, StartSession(gurls_, _)) | 248 EXPECT_CALL(presentation_service_, StartSession(gurls_, _)) |
| 249 .WillOnce(Invoke([this, &error_message]( | 249 .WillOnce(Invoke([&error_message]( |
| 250 const std::vector<GURL>& presentation_urls, | 250 const std::vector<GURL>& presentation_urls, |
| 251 const PresentationService::StartSessionCallback& callback) { | 251 const PresentationService::StartSessionCallback& callback) { |
| 252 PresentationErrorPtr error(PresentationError::New()); | 252 PresentationErrorPtr error(PresentationError::New()); |
| 253 error->error_type = PresentationErrorType::NO_AVAILABLE_SCREENS; | 253 error->error_type = PresentationErrorType::NO_AVAILABLE_SCREENS; |
| 254 error->message = error_message.utf8(); | 254 error->message = error_message.utf8(); |
| 255 callback.Run(PresentationSessionInfoPtr(), std::move(error)); | 255 callback.Run(PresentationSessionInfoPtr(), std::move(error)); |
| 256 })); | 256 })); |
| 257 dispatcher_.startSession( | 257 dispatcher_.startSession( |
| 258 urls_, | 258 urls_, |
| 259 base::MakeUnique<TestWebPresentationConnectionErrorCallback>( | 259 base::MakeUnique<TestWebPresentationConnectionErrorCallback>( |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 } | 413 } |
| 414 | 414 |
| 415 TEST_F(PresentationDispatcherTest, TestSetDefaultPresentationUrls) { | 415 TEST_F(PresentationDispatcherTest, TestSetDefaultPresentationUrls) { |
| 416 base::RunLoop run_loop; | 416 base::RunLoop run_loop; |
| 417 EXPECT_CALL(presentation_service_, SetDefaultPresentationUrls(gurls_)); | 417 EXPECT_CALL(presentation_service_, SetDefaultPresentationUrls(gurls_)); |
| 418 dispatcher_.setDefaultPresentationUrls(urls_); | 418 dispatcher_.setDefaultPresentationUrls(urls_); |
| 419 run_loop.RunUntilIdle(); | 419 run_loop.RunUntilIdle(); |
| 420 } | 420 } |
| 421 | 421 |
| 422 } // namespace content | 422 } // namespace content |
| OLD | NEW |