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 blink::mojom::PresentationError; | 29 using blink::mojom::PresentationError; |
29 using blink::mojom::PresentationErrorPtr; | 30 using blink::mojom::PresentationErrorPtr; |
30 using blink::mojom::PresentationErrorType; | 31 using blink::mojom::PresentationErrorType; |
31 using blink::mojom::PresentationService; | 32 using blink::mojom::PresentationService; |
32 using blink::mojom::PresentationServiceClientPtr; | 33 using blink::mojom::PresentationServiceClientPtr; |
33 using blink::mojom::PresentationSessionInfo; | 34 using blink::mojom::PresentationSessionInfo; |
34 using blink::mojom::PresentationSessionInfoPtr; | 35 using blink::mojom::PresentationSessionInfoPtr; |
35 using blink::mojom::ConnectionMessage; | 36 using blink::mojom::ConnectionMessage; |
36 using blink::mojom::ConnectionMessagePtr; | 37 using blink::mojom::ConnectionMessagePtr; |
37 | 38 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const std::string& presentation_id)); | 96 const std::string& presentation_id)); |
96 | 97 |
97 // *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 |
98 // GMock. | 99 // GMock. |
99 void ListenForConnectionMessages( | 100 void ListenForConnectionMessages( |
100 PresentationSessionInfoPtr session_info) override { | 101 PresentationSessionInfoPtr session_info) override { |
101 ListenForConnectionMessagesInternal(session_info.get()); | 102 ListenForConnectionMessagesInternal(session_info.get()); |
102 } | 103 } |
103 MOCK_METHOD1(ListenForConnectionMessagesInternal, | 104 MOCK_METHOD1(ListenForConnectionMessagesInternal, |
104 void(PresentationSessionInfo* session_info)); | 105 void(PresentationSessionInfo* session_info)); |
| 106 |
| 107 void SetPresentationConnection( |
| 108 blink::mojom::PresentationSessionInfoPtr session, |
| 109 blink::mojom::PresentationConnectionPtr controller_conn_ptr, |
| 110 blink::mojom::PresentationConnectionRequest receiver_conn_request) |
| 111 override { |
| 112 SetPresentationConnection(session.get(), controller_conn_ptr.get()); |
| 113 } |
| 114 MOCK_METHOD2(SetPresentationConnection, |
| 115 void(PresentationSessionInfo* session_info, |
| 116 PresentationConnection* connection)); |
105 }; | 117 }; |
106 | 118 |
107 class TestWebPresentationConnectionCallback | 119 class TestWebPresentationConnectionCallback |
108 : public WebPresentationConnectionCallback { | 120 : public WebPresentationConnectionCallback { |
109 public: | 121 public: |
110 TestWebPresentationConnectionCallback(WebURL url, WebString id) | 122 TestWebPresentationConnectionCallback(WebURL url, WebString id) |
111 : url_(url), id_(id), callback_called_(false) {} | 123 : url_(url), id_(id), callback_called_(false) {} |
112 ~TestWebPresentationConnectionCallback() override { | 124 ~TestWebPresentationConnectionCallback() override { |
113 EXPECT_TRUE(callback_called_); | 125 EXPECT_TRUE(callback_called_); |
114 } | 126 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 } | 412 } |
401 | 413 |
402 TEST_F(PresentationDispatcherTest, TestSetDefaultPresentationUrls) { | 414 TEST_F(PresentationDispatcherTest, TestSetDefaultPresentationUrls) { |
403 base::RunLoop run_loop; | 415 base::RunLoop run_loop; |
404 EXPECT_CALL(presentation_service_, SetDefaultPresentationUrls(gurls_)); | 416 EXPECT_CALL(presentation_service_, SetDefaultPresentationUrls(gurls_)); |
405 dispatcher_.setDefaultPresentationUrls(urls_); | 417 dispatcher_.setDefaultPresentationUrls(urls_); |
406 run_loop.RunUntilIdle(); | 418 run_loop.RunUntilIdle(); |
407 } | 419 } |
408 | 420 |
409 } // namespace content | 421 } // namespace content |
OLD | NEW |