| 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" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" | 12 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nAvailabilityObserver.h" |
| 13 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" | 13 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nError.h" |
| 14 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nSessionInfo.h" | 14 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio
nSessionInfo.h" |
| 15 #include "third_party/WebKit/public/web/WebArrayBuffer.h" | 15 #include "third_party/WebKit/public/web/WebArrayBuffer.h" |
| 16 | 16 |
| 17 using ::testing::_; | 17 using ::testing::_; |
| 18 using ::testing::Invoke; | 18 using ::testing::Invoke; |
| 19 using blink::WebArrayBuffer; | 19 using blink::WebArrayBuffer; |
| 20 using blink::WebPresentationAvailabilityCallbacks; | 20 using blink::WebPresentationAvailabilityCallbacks; |
| 21 using blink::WebPresentationAvailabilityObserver; | 21 using blink::WebPresentationAvailabilityObserver; |
| 22 using blink::WebPresentationConnectionCallback; | 22 using blink::WebPresentationConnectionCallback; |
| 23 using blink::WebPresentationError; | 23 using blink::WebPresentationError; |
| 24 using blink::WebPresentationSessionInfo; | 24 using blink::WebPresentationSessionInfo; |
| 25 using blink::WebString; | 25 using blink::WebString; |
| 26 using blink::WebURL; | 26 using blink::WebURL; |
| 27 using blink::WebVector; | 27 using blink::WebVector; |
| 28 using blink::mojom::PresentationConnection; | 28 using content::mojom::PresentationConnection; |
| 29 using blink::mojom::PresentationError; | 29 using content::mojom::PresentationError; |
| 30 using blink::mojom::PresentationErrorPtr; | 30 using content::mojom::PresentationErrorPtr; |
| 31 using blink::mojom::PresentationErrorType; | 31 using content::mojom::PresentationErrorType; |
| 32 using blink::mojom::PresentationService; | 32 using content::mojom::PresentationService; |
| 33 using blink::mojom::PresentationServiceClientPtr; | 33 using content::mojom::PresentationServiceClientPtr; |
| 34 using blink::mojom::PresentationSessionInfo; | 34 using content::mojom::PresentationSessionInfo; |
| 35 using blink::mojom::PresentationSessionInfoPtr; | 35 using content::mojom::PresentationSessionInfoPtr; |
| 36 using blink::mojom::ConnectionMessage; | 36 using content::mojom::ConnectionMessage; |
| 37 using blink::mojom::ConnectionMessagePtr; | 37 using content::mojom::ConnectionMessagePtr; |
| 38 | 38 |
| 39 // TODO(crbug.com/576808): Add test cases for the following: | 39 // TODO(crbug.com/576808): Add test cases for the following: |
| 40 // - State changes | 40 // - State changes |
| 41 // - Messages received | 41 // - Messages received |
| 42 // - Discarding queued messages when the frame navigates | 42 // - Discarding queued messages when the frame navigates |
| 43 // - Screen availability not supported | 43 // - Screen availability not supported |
| 44 // - Default presentation starting | 44 // - Default presentation starting |
| 45 | 45 |
| 46 namespace content { | 46 namespace content { |
| 47 | 47 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // *Internal method is to work around lack of support for move-only types in | 98 // *Internal method is to work around lack of support for move-only types in |
| 99 // GMock. | 99 // GMock. |
| 100 void ListenForConnectionMessages( | 100 void ListenForConnectionMessages( |
| 101 PresentationSessionInfoPtr session_info) override { | 101 PresentationSessionInfoPtr session_info) override { |
| 102 ListenForConnectionMessagesInternal(session_info.get()); | 102 ListenForConnectionMessagesInternal(session_info.get()); |
| 103 } | 103 } |
| 104 MOCK_METHOD1(ListenForConnectionMessagesInternal, | 104 MOCK_METHOD1(ListenForConnectionMessagesInternal, |
| 105 void(PresentationSessionInfo* session_info)); | 105 void(PresentationSessionInfo* session_info)); |
| 106 | 106 |
| 107 void SetPresentationConnection( | 107 void SetPresentationConnection( |
| 108 blink::mojom::PresentationSessionInfoPtr session, | 108 content::mojom::PresentationSessionInfoPtr session, |
| 109 blink::mojom::PresentationConnectionPtr controller_conn_ptr, | 109 content::mojom::PresentationConnectionPtr controller_conn_ptr, |
| 110 blink::mojom::PresentationConnectionRequest receiver_conn_request) | 110 content::mojom::PresentationConnectionRequest receiver_conn_request) |
| 111 override { | 111 override { |
| 112 SetPresentationConnection(session.get(), controller_conn_ptr.get()); | 112 SetPresentationConnection(session.get(), controller_conn_ptr.get()); |
| 113 } | 113 } |
| 114 MOCK_METHOD2(SetPresentationConnection, | 114 MOCK_METHOD2(SetPresentationConnection, |
| 115 void(PresentationSessionInfo* session_info, | 115 void(PresentationSessionInfo* session_info, |
| 116 PresentationConnection* connection)); | 116 PresentationConnection* connection)); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 class TestWebPresentationConnectionCallback | 119 class TestWebPresentationConnectionCallback |
| 120 : public WebPresentationConnectionCallback { | 120 : public WebPresentationConnectionCallback { |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 | 413 |
| 414 TEST_F(PresentationDispatcherTest, TestSetDefaultPresentationUrls) { | 414 TEST_F(PresentationDispatcherTest, TestSetDefaultPresentationUrls) { |
| 415 base::RunLoop run_loop; | 415 base::RunLoop run_loop; |
| 416 EXPECT_CALL(presentation_service_, SetDefaultPresentationUrls(gurls_)); | 416 EXPECT_CALL(presentation_service_, SetDefaultPresentationUrls(gurls_)); |
| 417 dispatcher_.setDefaultPresentationUrls(urls_); | 417 dispatcher_.setDefaultPresentationUrls(urls_); |
| 418 run_loop.RunUntilIdle(); | 418 run_loop.RunUntilIdle(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 } // namespace content | 421 } // namespace content |
| OLD | NEW |