Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: content/browser/presentation/presentation_service_impl_unittest.cc

Issue 2706463002: [Presentation API] Mojo typemap for content::PresentationConnectionMessage (Closed)
Patch Set: Fix compile error in presentation_connection_message Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <iterator>
10 #include <memory> 11 #include <memory>
11 #include <string> 12 #include <string>
12 #include <utility> 13 #include <utility>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/location.h" 16 #include "base/location.h"
16 #include "base/run_loop.h" 17 #include "base/run_loop.h"
17 #include "base/single_thread_task_runner.h" 18 #include "base/single_thread_task_runner.h"
18 #include "base/test/test_timeouts.h" 19 #include "base/test/test_timeouts.h"
19 #include "base/threading/thread_task_runner_handle.h" 20 #include "base/threading/thread_task_runner_handle.h"
20 #include "content/public/browser/navigation_handle.h" 21 #include "content/public/browser/navigation_handle.h"
21 #include "content/public/browser/presentation_service_delegate.h" 22 #include "content/public/browser/presentation_service_delegate.h"
22 #include "content/public/common/presentation_constants.h" 23 #include "content/public/common/presentation_connection_message.h"
23 #include "content/public/common/presentation_session.h" 24 #include "content/public/common/presentation_session.h"
24 #include "content/test/test_render_frame_host.h" 25 #include "content/test/test_render_frame_host.h"
25 #include "content/test/test_render_view_host.h" 26 #include "content/test/test_render_view_host.h"
26 #include "content/test/test_web_contents.h" 27 #include "content/test/test_web_contents.h"
27 #include "mojo/public/cpp/bindings/interface_ptr.h" 28 #include "mojo/public/cpp/bindings/interface_ptr.h"
28 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
29 30
30 using ::testing::_; 31 using ::testing::_;
32 using ::testing::ByRef;
31 using ::testing::Eq; 33 using ::testing::Eq;
34 using ::testing::Invoke;
32 using ::testing::InvokeWithoutArgs; 35 using ::testing::InvokeWithoutArgs;
33 using ::testing::Mock; 36 using ::testing::Mock;
34 using ::testing::Return; 37 using ::testing::Return;
35 using ::testing::SaveArg; 38 using ::testing::SaveArg;
39 using ::testing::WithArgs;
36 40
37 namespace content { 41 namespace content {
38 42
39 namespace { 43 namespace {
40 44
41 // Matches Mojo structs.
42 MATCHER_P(Equals, expected, "") {
43 return expected.Equals(arg);
44 }
45
46 // Matches content::PresentationSessionInfo. 45 // Matches content::PresentationSessionInfo.
47 MATCHER_P(SessionInfoEquals, expected, "") { 46 MATCHER_P(SessionInfoEquals, expected, "") {
48 return expected.presentation_url == arg.presentation_url && 47 return expected.presentation_url == arg.presentation_url &&
49 expected.presentation_id == arg.presentation_id; 48 expected.presentation_id == arg.presentation_id;
50 } 49 }
51 50
52 const char kPresentationId[] = "presentationId"; 51 const char kPresentationId[] = "presentationId";
53 const char kPresentationUrl1[] = "http://foo.com/index.html"; 52 const char kPresentationUrl1[] = "http://foo.com/index.html";
54 const char kPresentationUrl2[] = "http://example.com/index.html"; 53 const char kPresentationUrl2[] = "http://example.com/index.html";
55 const char kPresentationUrl3[] = "http://example.net/index.html"; 54 const char kPresentationUrl3[] = "http://example.net/index.html";
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 void(int render_process_id, 108 void(int render_process_id,
110 int render_frame_id, 109 int render_frame_id,
111 const std::string& presentation_id)); 110 const std::string& presentation_id));
112 MOCK_METHOD3(Terminate, 111 MOCK_METHOD3(Terminate,
113 void(int render_process_id, 112 void(int render_process_id,
114 int render_frame_id, 113 int render_frame_id,
115 const std::string& presentation_id)); 114 const std::string& presentation_id));
116 MOCK_METHOD4(ListenForConnectionMessages, 115 MOCK_METHOD4(ListenForConnectionMessages,
117 void(int render_process_id, 116 void(int render_process_id,
118 int render_frame_id, 117 int render_frame_id,
119 const content::PresentationSessionInfo& session, 118 const PresentationSessionInfo& session,
120 const PresentationConnectionMessageCallback& message_cb)); 119 const PresentationConnectionMessageCallback& message_cb));
121 MOCK_METHOD5(SendMessageRawPtr, 120 MOCK_METHOD5(SendMessage,
122 void(int render_process_id, 121 void(int render_process_id,
123 int render_frame_id, 122 int render_frame_id,
124 const content::PresentationSessionInfo& session, 123 const PresentationSessionInfo& session,
125 PresentationConnectionMessage* message_request, 124 const PresentationConnectionMessage& message_request,
126 const SendMessageCallback& send_message_cb)); 125 const SendMessageCallback& send_message_cb));
127 void SendMessage( 126 MOCK_METHOD4(
128 int render_process_id, 127 ListenForConnectionStateChange,
129 int render_frame_id, 128 void(int render_process_id,
130 const content::PresentationSessionInfo& session, 129 int render_frame_id,
131 std::unique_ptr<PresentationConnectionMessage> message_request, 130 const PresentationSessionInfo& connection,
132 const SendMessageCallback& send_message_cb) override { 131 const PresentationConnectionStateChangedCallback& state_changed_cb));
133 SendMessageRawPtr(render_process_id, render_frame_id, session,
134 message_request.release(), send_message_cb);
135 }
136 MOCK_METHOD4(ListenForConnectionStateChange,
137 void(int render_process_id,
138 int render_frame_id,
139 const content::PresentationSessionInfo& connection,
140 const content::PresentationConnectionStateChangedCallback&
141 state_changed_cb));
142 132
143 void ConnectToPresentation( 133 void ConnectToPresentation(
144 int render_process_id, 134 int render_process_id,
145 int render_frame_id, 135 int render_frame_id,
146 const content::PresentationSessionInfo& session, 136 const PresentationSessionInfo& session,
147 PresentationConnectionPtr controller_conn_ptr, 137 PresentationConnectionPtr controller_conn_ptr,
148 PresentationConnectionRequest receiver_conn_request) override { 138 PresentationConnectionRequest receiver_conn_request) override {
149 RegisterOffscreenPresentationConnectionRaw( 139 RegisterOffscreenPresentationConnectionRaw(
150 render_process_id, render_frame_id, session, controller_conn_ptr.get()); 140 render_process_id, render_frame_id, session, controller_conn_ptr.get());
151 } 141 }
152 142
153 MOCK_METHOD4(RegisterOffscreenPresentationConnectionRaw, 143 MOCK_METHOD4(RegisterOffscreenPresentationConnectionRaw,
154 void(int render_process_id, 144 void(int render_process_id,
155 int render_frame_id, 145 int render_frame_id,
156 const content::PresentationSessionInfo& session, 146 const PresentationSessionInfo& session,
157 blink::mojom::PresentationConnection* connection)); 147 blink::mojom::PresentationConnection* connection));
158 148
159 void set_screen_availability_listening_supported(bool value) { 149 void set_screen_availability_listening_supported(bool value) {
160 screen_availability_listening_supported_ = value; 150 screen_availability_listening_supported_ = value;
161 } 151 }
162 152
163 private: 153 private:
164 bool screen_availability_listening_supported_ = true; 154 bool screen_availability_listening_supported_ = true;
165 }; 155 };
166 156
167 class MockReceiverPresentationServiceDelegate 157 class MockReceiverPresentationServiceDelegate
168 : public ReceiverPresentationServiceDelegate { 158 : public ReceiverPresentationServiceDelegate {
169 public: 159 public:
170 MOCK_METHOD3(AddObserver, 160 MOCK_METHOD3(AddObserver,
171 void(int render_process_id, 161 void(int render_process_id,
172 int render_frame_id, 162 int render_frame_id,
173 PresentationServiceDelegate::Observer* observer)); 163 PresentationServiceDelegate::Observer* observer));
174 MOCK_METHOD2(RemoveObserver, 164 MOCK_METHOD2(RemoveObserver,
175 void(int render_process_id, int render_frame_id)); 165 void(int render_process_id, int render_frame_id));
176 MOCK_METHOD2(Reset, void(int render_process_id, int routing_id)); 166 MOCK_METHOD2(Reset, void(int render_process_id, int routing_id));
177 MOCK_METHOD1(RegisterReceiverConnectionAvailableCallback, 167 MOCK_METHOD1(RegisterReceiverConnectionAvailableCallback,
178 void(const content::ReceiverConnectionAvailableCallback&)); 168 void(const ReceiverConnectionAvailableCallback&));
179 }; 169 };
180 170
181 class MockPresentationConnection : public blink::mojom::PresentationConnection { 171 class MockPresentationConnection : public blink::mojom::PresentationConnection {
182 public: 172 public:
183 void OnMessage(blink::mojom::ConnectionMessagePtr message, 173 MOCK_METHOD2(OnMessage,
184 const base::Callback<void(bool)>& send_message_cb) override { 174 void(const PresentationConnectionMessage& message,
185 OnConnectionMessageReceived(*message); 175 const base::Callback<void(bool)>& send_message_cb));
186 }
187 MOCK_METHOD1(OnConnectionMessageReceived,
188 void(const blink::mojom::ConnectionMessage& message));
189 MOCK_METHOD1(DidChangeState, void(PresentationConnectionState state)); 176 MOCK_METHOD1(DidChangeState, void(PresentationConnectionState state));
190 }; 177 };
191 178
192 class MockPresentationServiceClient 179 class MockPresentationServiceClient
193 : public blink::mojom::PresentationServiceClient { 180 : public blink::mojom::PresentationServiceClient {
194 public: 181 public:
195 MOCK_METHOD2(OnScreenAvailabilityUpdated, 182 MOCK_METHOD2(OnScreenAvailabilityUpdated,
196 void(const GURL& url, bool available)); 183 void(const GURL& url, bool available));
197 MOCK_METHOD2(OnConnectionStateChanged, 184 MOCK_METHOD2(OnConnectionStateChanged,
198 void(const content::PresentationSessionInfo& connection, 185 void(const PresentationSessionInfo& connection,
199 PresentationConnectionState new_state)); 186 PresentationConnectionState new_state));
200 MOCK_METHOD3(OnConnectionClosed, 187 MOCK_METHOD3(OnConnectionClosed,
201 void(const content::PresentationSessionInfo& connection, 188 void(const PresentationSessionInfo& connection,
202 PresentationConnectionCloseReason reason, 189 PresentationConnectionCloseReason reason,
203 const std::string& message)); 190 const std::string& message));
204 MOCK_METHOD1(OnScreenAvailabilityNotSupported, void(const GURL& url)); 191 MOCK_METHOD1(OnScreenAvailabilityNotSupported, void(const GURL& url));
205 192 MOCK_METHOD2(
206 void OnConnectionMessagesReceived( 193 OnConnectionMessagesReceived,
207 const content::PresentationSessionInfo& session_info, 194 void(const PresentationSessionInfo& session_info,
208 std::vector<blink::mojom::ConnectionMessagePtr> messages) override { 195 const std::vector<PresentationConnectionMessage>& messages));
209 messages_received_ = std::move(messages);
210 MessagesReceived();
211 }
212 MOCK_METHOD0(MessagesReceived, void());
213
214 MOCK_METHOD1(OnDefaultSessionStarted, 196 MOCK_METHOD1(OnDefaultSessionStarted,
215 void(const content::PresentationSessionInfo& session_info)); 197 void(const PresentationSessionInfo& session_info));
216 198
217 void OnReceiverConnectionAvailable( 199 void OnReceiverConnectionAvailable(
218 const content::PresentationSessionInfo& session_info, 200 const PresentationSessionInfo& session_info,
219 blink::mojom::PresentationConnectionPtr controller_conn_ptr, 201 blink::mojom::PresentationConnectionPtr controller_conn_ptr,
220 blink::mojom::PresentationConnectionRequest receiver_conn_request) 202 blink::mojom::PresentationConnectionRequest receiver_conn_request)
221 override { 203 override {
222 OnReceiverConnectionAvailable(session_info); 204 OnReceiverConnectionAvailable(session_info);
223 } 205 }
224 MOCK_METHOD1(OnReceiverConnectionAvailable, 206 MOCK_METHOD1(OnReceiverConnectionAvailable,
225 void(const content::PresentationSessionInfo& session_info)); 207 void(const PresentationSessionInfo& session_info));
226
227 std::vector<blink::mojom::ConnectionMessagePtr> messages_received_;
228 }; 208 };
229 209
230 class PresentationServiceImplTest : public RenderViewHostImplTestHarness { 210 class PresentationServiceImplTest : public RenderViewHostImplTestHarness {
231 public: 211 public:
232 PresentationServiceImplTest() 212 PresentationServiceImplTest()
233 : presentation_url1_(GURL(kPresentationUrl1)), 213 : presentation_url1_(GURL(kPresentationUrl1)),
234 presentation_url2_(GURL(kPresentationUrl2)), 214 presentation_url2_(GURL(kPresentationUrl2)),
235 presentation_url3_(GURL(kPresentationUrl3)) {} 215 presentation_url3_(GURL(kPresentationUrl3)) {}
236 216
237 void SetUp() override { 217 void SetUp() override {
(...skipping 23 matching lines...) Expand all
261 void TearDown() override { 241 void TearDown() override {
262 service_ptr_.reset(); 242 service_ptr_.reset();
263 if (service_impl_.get()) { 243 if (service_impl_.get()) {
264 EXPECT_CALL(mock_delegate_, RemoveObserver(_, _)).Times(1); 244 EXPECT_CALL(mock_delegate_, RemoveObserver(_, _)).Times(1);
265 service_impl_.reset(); 245 service_impl_.reset();
266 } 246 }
267 RenderViewHostImplTestHarness::TearDown(); 247 RenderViewHostImplTestHarness::TearDown();
268 } 248 }
269 249
270 void Navigate(bool main_frame) { 250 void Navigate(bool main_frame) {
271 content::RenderFrameHost* rfh = main_rfh(); 251 RenderFrameHost* rfh = main_rfh();
272 content::RenderFrameHostTester* rfh_tester = 252 RenderFrameHostTester* rfh_tester = RenderFrameHostTester::For(rfh);
273 content::RenderFrameHostTester::For(rfh);
274 if (!main_frame) 253 if (!main_frame)
275 rfh = rfh_tester->AppendChild("subframe"); 254 rfh = rfh_tester->AppendChild("subframe");
276 std::unique_ptr<NavigationHandle> navigation_handle = 255 std::unique_ptr<NavigationHandle> navigation_handle =
277 NavigationHandle::CreateNavigationHandleForTesting( 256 NavigationHandle::CreateNavigationHandleForTesting(
278 GURL(), rfh, true); 257 GURL(), rfh, true);
279 // Destructor calls DidFinishNavigation. 258 // Destructor calls DidFinishNavigation.
280 } 259 }
281 260
282 void ListenForScreenAvailabilityAndWait(const GURL& url, 261 void ListenForScreenAvailabilityAndWait(const GURL& url,
283 bool delegate_success) { 262 bool delegate_success) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 307
329 void ExpectCleanState() { 308 void ExpectCleanState() {
330 EXPECT_TRUE(service_impl_->default_presentation_urls_.empty()); 309 EXPECT_TRUE(service_impl_->default_presentation_urls_.empty());
331 EXPECT_EQ( 310 EXPECT_EQ(
332 service_impl_->screen_availability_listeners_.find(presentation_url1_), 311 service_impl_->screen_availability_listeners_.find(presentation_url1_),
333 service_impl_->screen_availability_listeners_.end()); 312 service_impl_->screen_availability_listeners_.end());
334 EXPECT_FALSE(service_impl_->on_connection_messages_callback_.get()); 313 EXPECT_FALSE(service_impl_->on_connection_messages_callback_.get());
335 } 314 }
336 315
337 void ExpectNewSessionCallbackSuccess( 316 void ExpectNewSessionCallbackSuccess(
338 const base::Optional<content::PresentationSessionInfo>& info, 317 const base::Optional<PresentationSessionInfo>& info,
339 const base::Optional<content::PresentationError>& error) { 318 const base::Optional<PresentationError>& error) {
340 EXPECT_TRUE(info); 319 EXPECT_TRUE(info);
341 EXPECT_FALSE(error); 320 EXPECT_FALSE(error);
342 if (!run_loop_quit_closure_.is_null()) 321 if (!run_loop_quit_closure_.is_null())
343 run_loop_quit_closure_.Run(); 322 run_loop_quit_closure_.Run();
344 } 323 }
345 324
346 void ExpectNewSessionCallbackError( 325 void ExpectNewSessionCallbackError(
347 const base::Optional<content::PresentationSessionInfo>& info, 326 const base::Optional<PresentationSessionInfo>& info,
348 const base::Optional<content::PresentationError>& error) { 327 const base::Optional<PresentationError>& error) {
349 EXPECT_FALSE(info); 328 EXPECT_FALSE(info);
350 EXPECT_TRUE(error); 329 EXPECT_TRUE(error);
351 if (!run_loop_quit_closure_.is_null()) 330 if (!run_loop_quit_closure_.is_null())
352 run_loop_quit_closure_.Run(); 331 run_loop_quit_closure_.Run();
353 } 332 }
354 333
355 void ExpectConnectionMessages(
356 const std::vector<blink::mojom::ConnectionMessagePtr>& expected_msgs,
357 const std::vector<blink::mojom::ConnectionMessagePtr>& actual_msgs) {
358 EXPECT_EQ(expected_msgs.size(), actual_msgs.size());
359 for (size_t i = 0; i < actual_msgs.size(); ++i)
360 EXPECT_TRUE(expected_msgs[i].Equals(actual_msgs[i]));
361 }
362
363 void ExpectSendConnectionMessageCallback(bool success) { 334 void ExpectSendConnectionMessageCallback(bool success) {
364 EXPECT_TRUE(success); 335 EXPECT_TRUE(success);
365 EXPECT_FALSE(service_impl_->send_message_callback_); 336 EXPECT_FALSE(service_impl_->send_message_callback_);
366 if (!run_loop_quit_closure_.is_null()) 337 if (!run_loop_quit_closure_.is_null())
367 run_loop_quit_closure_.Run(); 338 run_loop_quit_closure_.Run();
368 } 339 }
369 340
370 void RunListenForConnectionMessages(const std::string& text_msg,
371 const std::vector<uint8_t>& binary_data,
372 bool pass_ownership) {
373 std::vector<blink::mojom::ConnectionMessagePtr> expected_msgs(2);
374 expected_msgs[0] = blink::mojom::ConnectionMessage::New();
375 expected_msgs[0]->type = blink::mojom::PresentationMessageType::TEXT;
376 expected_msgs[0]->message = text_msg;
377 expected_msgs[1] = blink::mojom::ConnectionMessage::New();
378 expected_msgs[1]->type = blink::mojom::PresentationMessageType::BINARY;
379 expected_msgs[1]->data = binary_data;
380
381 content::PresentationSessionInfo session(presentation_url1_,
382 kPresentationId);
383
384 PresentationConnectionMessageCallback message_cb;
385 {
386 base::RunLoop run_loop;
387 EXPECT_CALL(mock_delegate_, ListenForConnectionMessages(_, _, _, _))
388 .WillOnce(DoAll(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit),
389 SaveArg<3>(&message_cb)));
390 service_ptr_->ListenForConnectionMessages(session);
391 run_loop.Run();
392 }
393
394 std::vector<std::unique_ptr<PresentationConnectionMessage>> messages;
395 std::unique_ptr<content::PresentationConnectionMessage> message;
396 message.reset(new content::PresentationConnectionMessage(
397 PresentationMessageType::TEXT));
398 message->message = text_msg;
399 messages.push_back(std::move(message));
400 message.reset(new content::PresentationConnectionMessage(
401 PresentationMessageType::BINARY));
402 message->data.reset(new std::vector<uint8_t>(binary_data));
403 messages.push_back(std::move(message));
404
405 std::vector<blink::mojom::ConnectionMessagePtr> actual_msgs;
406 {
407 base::RunLoop run_loop;
408 EXPECT_CALL(mock_client_, MessagesReceived())
409 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
410 message_cb.Run(std::move(messages), pass_ownership);
411 run_loop.Run();
412 }
413 ExpectConnectionMessages(expected_msgs, mock_client_.messages_received_);
414 }
415
416 MockPresentationServiceDelegate mock_delegate_; 341 MockPresentationServiceDelegate mock_delegate_;
417 MockReceiverPresentationServiceDelegate mock_receiver_delegate_; 342 MockReceiverPresentationServiceDelegate mock_receiver_delegate_;
418 343
419 std::unique_ptr<PresentationServiceImpl> service_impl_; 344 std::unique_ptr<PresentationServiceImpl> service_impl_;
420 mojo::InterfacePtr<blink::mojom::PresentationService> service_ptr_; 345 mojo::InterfacePtr<blink::mojom::PresentationService> service_ptr_;
421 346
422 MockPresentationServiceClient mock_client_; 347 MockPresentationServiceClient mock_client_;
423 std::unique_ptr<mojo::Binding<blink::mojom::PresentationServiceClient>> 348 std::unique_ptr<mojo::Binding<blink::mojom::PresentationServiceClient>>
424 client_binding_; 349 client_binding_;
425 350
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 EXPECT_CALL(mock_delegate_, 423 EXPECT_CALL(mock_delegate_,
499 SetDefaultPresentationUrls(_, _, presentation_urls_, _)) 424 SetDefaultPresentationUrls(_, _, presentation_urls_, _))
500 .Times(1); 425 .Times(1);
501 426
502 service_impl_->SetDefaultPresentationUrls(presentation_urls_); 427 service_impl_->SetDefaultPresentationUrls(presentation_urls_);
503 428
504 // Sets different DPUs. 429 // Sets different DPUs.
505 std::vector<GURL> more_urls = presentation_urls_; 430 std::vector<GURL> more_urls = presentation_urls_;
506 more_urls.push_back(presentation_url3_); 431 more_urls.push_back(presentation_url3_);
507 432
508 content::PresentationSessionStartedCallback callback; 433 PresentationSessionStartedCallback callback;
509 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrls(_, _, more_urls, _)) 434 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrls(_, _, more_urls, _))
510 .WillOnce(SaveArg<3>(&callback)); 435 .WillOnce(SaveArg<3>(&callback));
511 service_impl_->SetDefaultPresentationUrls(more_urls); 436 service_impl_->SetDefaultPresentationUrls(more_urls);
512 437
513 content::PresentationSessionInfo session_info(presentation_url2_, 438 PresentationSessionInfo session_info(presentation_url2_, kPresentationId);
514 kPresentationId);
515 439
516 base::RunLoop run_loop; 440 base::RunLoop run_loop;
517 EXPECT_CALL(mock_client_, 441 EXPECT_CALL(mock_client_,
518 OnDefaultSessionStarted(SessionInfoEquals(session_info))) 442 OnDefaultSessionStarted(SessionInfoEquals(session_info)))
519 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 443 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
520 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)); 444 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _));
521 callback.Run( 445 callback.Run(PresentationSessionInfo(presentation_url2_, kPresentationId));
522 content::PresentationSessionInfo(presentation_url2_, kPresentationId));
523 run_loop.Run(); 446 run_loop.Run();
524 } 447 }
525 448
526 TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) { 449 TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) {
527 content::PresentationSessionInfo connection(presentation_url1_, 450 PresentationSessionInfo connection(presentation_url1_, kPresentationId);
528 kPresentationId); 451 PresentationConnectionStateChangedCallback state_changed_cb;
529 content::PresentationConnectionStateChangedCallback state_changed_cb;
530 // Trigger state change. It should be propagated back up to |mock_client_|. 452 // Trigger state change. It should be propagated back up to |mock_client_|.
531 content::PresentationSessionInfo presentation_connection(presentation_url1_, 453 PresentationSessionInfo presentation_connection(presentation_url1_,
532 kPresentationId); 454 kPresentationId);
533 455
534 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)) 456 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
535 .WillOnce(SaveArg<3>(&state_changed_cb)); 457 .WillOnce(SaveArg<3>(&state_changed_cb));
536 service_impl_->ListenForConnectionStateChange(connection); 458 service_impl_->ListenForConnectionStateChange(connection);
537 459
538 { 460 {
539 base::RunLoop run_loop; 461 base::RunLoop run_loop;
540 EXPECT_CALL(mock_client_, 462 EXPECT_CALL(
541 OnConnectionStateChanged( 463 mock_client_,
542 SessionInfoEquals(presentation_connection), 464 OnConnectionStateChanged(SessionInfoEquals(presentation_connection),
543 content::PRESENTATION_CONNECTION_STATE_TERMINATED)) 465 PRESENTATION_CONNECTION_STATE_TERMINATED))
544 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 466 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
545 state_changed_cb.Run(PresentationConnectionStateChangeInfo( 467 state_changed_cb.Run(PresentationConnectionStateChangeInfo(
546 PRESENTATION_CONNECTION_STATE_TERMINATED)); 468 PRESENTATION_CONNECTION_STATE_TERMINATED));
547 run_loop.Run(); 469 run_loop.Run();
548 } 470 }
549 } 471 }
550 472
551 TEST_F(PresentationServiceImplTest, ListenForConnectionClose) { 473 TEST_F(PresentationServiceImplTest, ListenForConnectionClose) {
552 content::PresentationSessionInfo connection(presentation_url1_, 474 PresentationSessionInfo connection(presentation_url1_, kPresentationId);
553 kPresentationId); 475 PresentationConnectionStateChangedCallback state_changed_cb;
554 content::PresentationConnectionStateChangedCallback state_changed_cb;
555 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)) 476 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
556 .WillOnce(SaveArg<3>(&state_changed_cb)); 477 .WillOnce(SaveArg<3>(&state_changed_cb));
557 service_impl_->ListenForConnectionStateChange(connection); 478 service_impl_->ListenForConnectionStateChange(connection);
558 479
559 // Trigger connection close. It should be propagated back up to 480 // Trigger connection close. It should be propagated back up to
560 // |mock_client_|. 481 // |mock_client_|.
561 content::PresentationSessionInfo presentation_connection(presentation_url1_, 482 PresentationSessionInfo presentation_connection(presentation_url1_,
562 kPresentationId); 483 kPresentationId);
563 { 484 {
564 base::RunLoop run_loop; 485 base::RunLoop run_loop;
565 PresentationConnectionStateChangeInfo closed_info( 486 PresentationConnectionStateChangeInfo closed_info(
566 PRESENTATION_CONNECTION_STATE_CLOSED); 487 PRESENTATION_CONNECTION_STATE_CLOSED);
567 closed_info.close_reason = PRESENTATION_CONNECTION_CLOSE_REASON_WENT_AWAY; 488 closed_info.close_reason = PRESENTATION_CONNECTION_CLOSE_REASON_WENT_AWAY;
568 closed_info.message = "Foo"; 489 closed_info.message = "Foo";
569 490
570 EXPECT_CALL(mock_client_, 491 EXPECT_CALL(mock_client_,
571 OnConnectionClosed( 492 OnConnectionClosed(
572 SessionInfoEquals(presentation_connection), 493 SessionInfoEquals(presentation_connection),
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 } 588 }
668 589
669 TEST_F(PresentationServiceImplTest, Terminate) { 590 TEST_F(PresentationServiceImplTest, Terminate) {
670 service_ptr_->Terminate(presentation_url1_, kPresentationId); 591 service_ptr_->Terminate(presentation_url1_, kPresentationId);
671 base::RunLoop run_loop; 592 base::RunLoop run_loop;
672 EXPECT_CALL(mock_delegate_, Terminate(_, _, Eq(kPresentationId))) 593 EXPECT_CALL(mock_delegate_, Terminate(_, _, Eq(kPresentationId)))
673 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 594 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
674 run_loop.Run(); 595 run_loop.Run();
675 } 596 }
676 597
677 TEST_F(PresentationServiceImplTest, ListenForConnectionMessagesPassed) {
678 std::string text_msg("123");
679 std::vector<uint8_t> binary_data(3, '\1');
680 RunListenForConnectionMessages(text_msg, binary_data, true);
681 }
682
683 TEST_F(PresentationServiceImplTest, ListenForConnectionMessagesCopied) {
684 std::string text_msg("123");
685 std::vector<uint8_t> binary_data(3, '\1');
686 RunListenForConnectionMessages(text_msg, binary_data, false);
687 }
688
689 TEST_F(PresentationServiceImplTest, ListenForConnectionMessagesWithEmptyMsg) {
690 std::string text_msg("");
691 std::vector<uint8_t> binary_data;
692 RunListenForConnectionMessages(text_msg, binary_data, false);
693 }
694
695 TEST_F(PresentationServiceImplTest, SetPresentationConnection) { 598 TEST_F(PresentationServiceImplTest, SetPresentationConnection) {
696 content::PresentationSessionInfo session(presentation_url1_, kPresentationId); 599 PresentationSessionInfo session(presentation_url1_, kPresentationId);
697 600
698 blink::mojom::PresentationConnectionPtr connection; 601 blink::mojom::PresentationConnectionPtr connection;
699 MockPresentationConnection mock_presentation_connection; 602 MockPresentationConnection mock_presentation_connection;
700 mojo::Binding<blink::mojom::PresentationConnection> connection_binding( 603 mojo::Binding<blink::mojom::PresentationConnection> connection_binding(
701 &mock_presentation_connection, mojo::MakeRequest(&connection)); 604 &mock_presentation_connection, mojo::MakeRequest(&connection));
702 blink::mojom::PresentationConnectionPtr receiver_connection; 605 blink::mojom::PresentationConnectionPtr receiver_connection;
703 auto request = mojo::MakeRequest(&receiver_connection); 606 auto request = mojo::MakeRequest(&receiver_connection);
704 607
705 content::PresentationSessionInfo expected(presentation_url1_, 608 PresentationSessionInfo expected(presentation_url1_, kPresentationId);
706 kPresentationId);
707 EXPECT_CALL(mock_delegate_, RegisterOffscreenPresentationConnectionRaw( 609 EXPECT_CALL(mock_delegate_, RegisterOffscreenPresentationConnectionRaw(
708 _, _, SessionInfoEquals(expected), _)); 610 _, _, SessionInfoEquals(expected), _));
709 611
710 service_impl_->SetPresentationConnection(session, std::move(connection), 612 service_impl_->SetPresentationConnection(session, std::move(connection),
711 std::move(request)); 613 std::move(request));
712 } 614 }
713 615
714 TEST_F(PresentationServiceImplTest, ReceiverPresentationServiceDelegate) { 616 TEST_F(PresentationServiceImplTest, ReceiverPresentationServiceDelegate) {
715 MockReceiverPresentationServiceDelegate mock_receiver_delegate; 617 MockReceiverPresentationServiceDelegate mock_receiver_delegate;
716 618
717 PresentationServiceImpl service_impl(contents()->GetMainFrame(), contents(), 619 PresentationServiceImpl service_impl(contents()->GetMainFrame(), contents(),
718 nullptr, &mock_receiver_delegate); 620 nullptr, &mock_receiver_delegate);
719 621
720 ReceiverConnectionAvailableCallback callback; 622 ReceiverConnectionAvailableCallback callback;
721 EXPECT_CALL(mock_receiver_delegate, 623 EXPECT_CALL(mock_receiver_delegate,
722 RegisterReceiverConnectionAvailableCallback(_)) 624 RegisterReceiverConnectionAvailableCallback(_))
723 .WillOnce(SaveArg<0>(&callback)); 625 .WillOnce(SaveArg<0>(&callback));
724 626
725 blink::mojom::PresentationServiceClientPtr client_ptr; 627 blink::mojom::PresentationServiceClientPtr client_ptr;
726 client_binding_.reset( 628 client_binding_.reset(
727 new mojo::Binding<blink::mojom::PresentationServiceClient>( 629 new mojo::Binding<blink::mojom::PresentationServiceClient>(
728 &mock_client_, mojo::MakeRequest(&client_ptr))); 630 &mock_client_, mojo::MakeRequest(&client_ptr)));
729 service_impl.controller_delegate_ = nullptr; 631 service_impl.controller_delegate_ = nullptr;
730 service_impl.SetClient(std::move(client_ptr)); 632 service_impl.SetClient(std::move(client_ptr));
731 EXPECT_FALSE(callback.is_null()); 633 EXPECT_FALSE(callback.is_null());
732 634
733 // NO-OP for ControllerPresentationServiceDelegate API functions 635 // NO-OP for ControllerPresentationServiceDelegate API functions
734 EXPECT_CALL(mock_delegate_, ListenForConnectionMessages(_, _, _, _)).Times(0); 636 EXPECT_CALL(mock_delegate_, ListenForConnectionMessages(_, _, _, _)).Times(0);
735 637
736 content::PresentationSessionInfo session(presentation_url1_, kPresentationId); 638 PresentationSessionInfo session(presentation_url1_, kPresentationId);
737 service_impl.ListenForConnectionMessages(session); 639 service_impl.ListenForConnectionMessages(session);
738 } 640 }
739 641
740 TEST_F(PresentationServiceImplTest, StartSessionInProgress) { 642 TEST_F(PresentationServiceImplTest, StartSessionInProgress) {
741 EXPECT_CALL(mock_delegate_, StartSession(_, _, presentation_urls_, _, _)) 643 EXPECT_CALL(mock_delegate_, StartSession(_, _, presentation_urls_, _, _))
742 .Times(1); 644 .Times(1);
743 service_ptr_->StartSession(presentation_urls_, base::Bind(&DoNothing)); 645 service_ptr_->StartSession(presentation_urls_, base::Bind(&DoNothing));
744 646
745 // This request should fail immediately, since there is already a StartSession 647 // This request should fail immediately, since there is already a StartSession
746 // in progress. 648 // in progress.
747 service_ptr_->StartSession( 649 service_ptr_->StartSession(
748 presentation_urls_, 650 presentation_urls_,
749 base::Bind(&PresentationServiceImplTest::ExpectNewSessionCallbackError, 651 base::Bind(&PresentationServiceImplTest::ExpectNewSessionCallbackError,
750 base::Unretained(this))); 652 base::Unretained(this)));
751 SaveQuitClosureAndRunLoop(); 653 SaveQuitClosureAndRunLoop();
752 } 654 }
753 655
754 TEST_F(PresentationServiceImplTest, SendStringMessage) { 656 TEST_F(PresentationServiceImplTest, SendStringMessage) {
755 std::string message("Test presentation session message"); 657 PresentationConnectionMessage message("Test presentation session message");
756 658
757 content::PresentationSessionInfo session(presentation_url1_, kPresentationId); 659 PresentationSessionInfo session(presentation_url1_, kPresentationId);
758 blink::mojom::ConnectionMessagePtr message_request(
759 blink::mojom::ConnectionMessage::New());
760 message_request->type = blink::mojom::PresentationMessageType::TEXT;
761 message_request->message = message;
762 service_ptr_->SendConnectionMessage( 660 service_ptr_->SendConnectionMessage(
763 session, std::move(message_request), 661 session, message,
764 base::Bind( 662 base::Bind(
765 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback, 663 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback,
766 base::Unretained(this))); 664 base::Unretained(this)));
767 665
768 base::RunLoop run_loop; 666 base::RunLoop run_loop;
769 base::Callback<void(bool)> send_message_cb; 667 EXPECT_CALL(mock_delegate_, SendMessage(_, _, _, _, _))
770 PresentationConnectionMessage* test_message = nullptr; 668 .WillOnce(DoAll(WithArgs<3, 4>(Invoke([&message](
771 EXPECT_CALL(mock_delegate_, SendMessageRawPtr(_, _, _, _, _)) 669 const PresentationConnectionMessage& message_request,
772 .WillOnce(DoAll(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit), 670 const base::Callback<void(bool)>& send_message_cb) {
773 SaveArg<3>(&test_message), SaveArg<4>(&send_message_cb))); 671 EXPECT_EQ(message, message_request);
672 send_message_cb.Run(true);
673 })),
674 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)));
774 run_loop.Run(); 675 run_loop.Run();
775
776 // Make sure |test_message| gets deleted.
777 std::unique_ptr<PresentationConnectionMessage> scoped_test_message(
778 test_message);
779 EXPECT_TRUE(test_message);
780 EXPECT_FALSE(test_message->is_binary());
781 EXPECT_LE(test_message->message.size(),
782 kMaxPresentationConnectionMessageSize);
783 EXPECT_EQ(message, test_message->message);
784 ASSERT_FALSE(test_message->data);
785 send_message_cb.Run(true);
786 SaveQuitClosureAndRunLoop(); 676 SaveQuitClosureAndRunLoop();
787 } 677 }
788 678
789 TEST_F(PresentationServiceImplTest, SendArrayBuffer) { 679 TEST_F(PresentationServiceImplTest, SendArrayBuffer) {
790 // Test Array buffer data. 680 // Test Array buffer data.
791 const uint8_t buffer[] = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48}; 681 const uint8_t buffer[] = {0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48};
792 std::vector<uint8_t> data; 682 std::vector<uint8_t> data;
793 data.assign(buffer, buffer + sizeof(buffer)); 683 data.assign(buffer, buffer + sizeof(buffer));
684 PresentationConnectionMessage message(data);
794 685
795 content::PresentationSessionInfo session(presentation_url1_, kPresentationId); 686 PresentationSessionInfo session(presentation_url1_, kPresentationId);
796 blink::mojom::ConnectionMessagePtr message_request(
797 blink::mojom::ConnectionMessage::New());
798 message_request->type = blink::mojom::PresentationMessageType::BINARY;
799 message_request->data = data;
800 service_ptr_->SendConnectionMessage( 687 service_ptr_->SendConnectionMessage(
801 session, std::move(message_request), 688 session, message,
802 base::Bind( 689 base::Bind(
803 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback, 690 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback,
804 base::Unretained(this))); 691 base::Unretained(this)));
805 692
806 base::RunLoop run_loop; 693 base::RunLoop run_loop;
807 base::Callback<void(bool)> send_message_cb; 694 EXPECT_CALL(mock_delegate_, SendMessage(_, _, _, _, _))
808 PresentationConnectionMessage* test_message = nullptr; 695 .WillOnce(DoAll(WithArgs<3, 4>(Invoke([&message](
809 EXPECT_CALL(mock_delegate_, SendMessageRawPtr(_, _, _, _, _)) 696 const PresentationConnectionMessage& message_request,
810 .WillOnce(DoAll(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit), 697 const base::Callback<void(bool)>& send_message_cb) {
811 SaveArg<3>(&test_message), SaveArg<4>(&send_message_cb))); 698 EXPECT_EQ(message, message_request);
699 send_message_cb.Run(true);
700 })),
701 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)));
812 run_loop.Run(); 702 run_loop.Run();
813
814 // Make sure |test_message| gets deleted.
815 std::unique_ptr<PresentationConnectionMessage> scoped_test_message(
816 test_message);
817 EXPECT_TRUE(test_message);
818 EXPECT_TRUE(test_message->is_binary());
819 EXPECT_EQ(PresentationMessageType::BINARY, test_message->type);
820 EXPECT_TRUE(test_message->message.empty());
821 ASSERT_TRUE(test_message->data);
822 EXPECT_EQ(data.size(), test_message->data->size());
823 EXPECT_LE(test_message->data->size(), kMaxPresentationConnectionMessageSize);
824 EXPECT_EQ(0, memcmp(buffer, &(*test_message->data)[0], sizeof(buffer)));
825 send_message_cb.Run(true);
826 SaveQuitClosureAndRunLoop(); 703 SaveQuitClosureAndRunLoop();
827 } 704 }
828 705
829 TEST_F(PresentationServiceImplTest, SendArrayBufferWithExceedingLimit) {
830 // Create buffer with size exceeding the limit.
831 // Use same size as in content::kMaxPresentationConnectionMessageSize.
832 const size_t kMaxBufferSizeInBytes = 64 * 1024; // 64 KB.
833 uint8_t buffer[kMaxBufferSizeInBytes + 1];
834 memset(buffer, 0, kMaxBufferSizeInBytes+1);
835 std::vector<uint8_t> data;
836 data.assign(buffer, buffer + sizeof(buffer));
837
838 content::PresentationSessionInfo session(presentation_url1_, kPresentationId);
839 blink::mojom::ConnectionMessagePtr message_request(
840 blink::mojom::ConnectionMessage::New());
841 message_request->type = blink::mojom::PresentationMessageType::BINARY;
842 message_request->data = data;
843 service_ptr_->SendConnectionMessage(
844 session, std::move(message_request),
845 base::Bind(
846 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback,
847 base::Unretained(this)));
848
849 base::RunLoop run_loop;
850 base::Callback<void(bool)> send_message_cb;
851 PresentationConnectionMessage* test_message = nullptr;
852 EXPECT_CALL(mock_delegate_, SendMessageRawPtr(_, _, _, _, _))
853 .WillOnce(DoAll(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit),
854 SaveArg<3>(&test_message), SaveArg<4>(&send_message_cb)));
855 run_loop.Run();
856
857 EXPECT_FALSE(test_message);
858 send_message_cb.Run(true);
859 SaveQuitClosureAndRunLoop();
860 }
861
862 TEST_F(PresentationServiceImplTest, SendBlobData) { 706 TEST_F(PresentationServiceImplTest, SendBlobData) {
863 const uint8_t buffer[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; 707 const uint8_t buffer[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07};
864 std::vector<uint8_t> data; 708 std::vector<uint8_t> data;
865 data.assign(buffer, buffer + sizeof(buffer)); 709 data.assign(buffer, buffer + sizeof(buffer));
866 710
867 content::PresentationSessionInfo session(presentation_url1_, kPresentationId); 711 PresentationSessionInfo session(presentation_url1_, kPresentationId);
868 blink::mojom::ConnectionMessagePtr message_request( 712 PresentationConnectionMessage message(data);
869 blink::mojom::ConnectionMessage::New());
870 message_request->type = blink::mojom::PresentationMessageType::BINARY;
871 message_request->data = data;
872 service_ptr_->SendConnectionMessage( 713 service_ptr_->SendConnectionMessage(
873 session, std::move(message_request), 714 session, message,
874 base::Bind( 715 base::Bind(
875 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback, 716 &PresentationServiceImplTest::ExpectSendConnectionMessageCallback,
876 base::Unretained(this))); 717 base::Unretained(this)));
877 718
878 base::RunLoop run_loop; 719 base::RunLoop run_loop;
879 base::Callback<void(bool)> send_message_cb; 720 EXPECT_CALL(mock_delegate_, SendMessage(_, _, _, _, _))
880 PresentationConnectionMessage* test_message = nullptr; 721 .WillOnce(DoAll(WithArgs<3, 4>(Invoke([&message](
881 EXPECT_CALL(mock_delegate_, SendMessageRawPtr(_, _, _, _, _)) 722 const PresentationConnectionMessage& message_request,
882 .WillOnce(DoAll(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit), 723 const base::Callback<void(bool)>& send_message_cb) {
883 SaveArg<3>(&test_message), SaveArg<4>(&send_message_cb))); 724 EXPECT_EQ(message, message_request);
725 send_message_cb.Run(true);
726 })),
727 InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)));
884 run_loop.Run(); 728 run_loop.Run();
885
886 // Make sure |test_message| gets deleted.
887 std::unique_ptr<PresentationConnectionMessage> scoped_test_message(
888 test_message);
889 EXPECT_TRUE(test_message);
890 EXPECT_TRUE(test_message->is_binary());
891 EXPECT_EQ(PresentationMessageType::BINARY, test_message->type);
892 EXPECT_TRUE(test_message->message.empty());
893 ASSERT_TRUE(test_message->data);
894 EXPECT_EQ(data.size(), test_message->data->size());
895 EXPECT_LE(test_message->data->size(), kMaxPresentationConnectionMessageSize);
896 EXPECT_EQ(0, memcmp(buffer, &(*test_message->data)[0], sizeof(buffer)));
897 send_message_cb.Run(true);
898 SaveQuitClosureAndRunLoop(); 729 SaveQuitClosureAndRunLoop();
899 } 730 }
900 731
901 TEST_F(PresentationServiceImplTest, MaxPendingJoinSessionRequests) { 732 TEST_F(PresentationServiceImplTest, MaxPendingJoinSessionRequests) {
902 const char* presentation_url = "http://fooUrl%d"; 733 const char* presentation_url = "http://fooUrl%d";
903 const char* presentation_id = "presentationId%d"; 734 const char* presentation_id = "presentationId%d";
904 int num_requests = PresentationServiceImpl::kMaxNumQueuedSessionRequests; 735 int num_requests = PresentationServiceImpl::kMaxNumQueuedSessionRequests;
905 int i = 0; 736 int i = 0;
906 EXPECT_CALL(mock_delegate_, JoinSession(_, _, _, _, _, _)) 737 EXPECT_CALL(mock_delegate_, JoinSession(_, _, _, _, _, _))
907 .Times(num_requests); 738 .Times(num_requests);
(...skipping 16 matching lines...) Expand all
924 mock_delegate_.set_screen_availability_listening_supported(false); 755 mock_delegate_.set_screen_availability_listening_supported(false);
925 base::RunLoop run_loop; 756 base::RunLoop run_loop;
926 EXPECT_CALL(mock_client_, 757 EXPECT_CALL(mock_client_,
927 OnScreenAvailabilityNotSupported(presentation_url1_)) 758 OnScreenAvailabilityNotSupported(presentation_url1_))
928 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 759 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
929 ListenForScreenAvailabilityAndWait(presentation_url1_, false); 760 ListenForScreenAvailabilityAndWait(presentation_url1_, false);
930 run_loop.Run(); 761 run_loop.Run();
931 } 762 }
932 763
933 } // namespace content 764 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698