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

Side by Side Diff: content/renderer/presentation/presentation_dispatcher_unittest.cc

Issue 2674273003: Revert of [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: Created 3 years, 10 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 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_connection_proxy.h" 10 #include "content/renderer/presentation/presentation_connection_proxy.h"
11 #include "content/renderer/presentation/presentation_dispatcher.h" 11 #include "content/renderer/presentation/presentation_dispatcher.h"
12 #include "content/renderer/presentation/test_presentation_connection.h" 12 #include "content/renderer/presentation/test_presentation_connection.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nAvailabilityObserver.h" 14 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nAvailabilityObserver.h"
15 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnection.h" 15 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnection.h"
16 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnectionCallbacks.h" 16 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nConnectionCallbacks.h"
17 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h" 17 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nController.h"
18 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nError.h" 18 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nError.h"
19 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nReceiver.h"
20 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nSessionInfo.h" 19 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentatio nSessionInfo.h"
21 #include "third_party/WebKit/public/web/WebArrayBuffer.h" 20 #include "third_party/WebKit/public/web/WebArrayBuffer.h"
22 21
23 using ::testing::_; 22 using ::testing::_;
24 using ::testing::Invoke; 23 using ::testing::Invoke;
25 using blink::WebArrayBuffer; 24 using blink::WebArrayBuffer;
26 using blink::WebPresentationAvailabilityCallbacks; 25 using blink::WebPresentationAvailabilityCallbacks;
27 using blink::WebPresentationAvailabilityObserver; 26 using blink::WebPresentationAvailabilityObserver;
28 using blink::WebPresentationConnectionCallbacks; 27 using blink::WebPresentationConnectionCallbacks;
29 using blink::WebPresentationError; 28 using blink::WebPresentationError;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 blink::mojom::PresentationConnectionPtr controller_conn_ptr, 104 blink::mojom::PresentationConnectionPtr controller_conn_ptr,
106 blink::mojom::PresentationConnectionRequest receiver_conn_request) 105 blink::mojom::PresentationConnectionRequest receiver_conn_request)
107 override { 106 override {
108 SetPresentationConnection(session_info, controller_conn_ptr.get()); 107 SetPresentationConnection(session_info, controller_conn_ptr.get());
109 } 108 }
110 MOCK_METHOD2(SetPresentationConnection, 109 MOCK_METHOD2(SetPresentationConnection,
111 void(const PresentationSessionInfo& session_info, 110 void(const PresentationSessionInfo& session_info,
112 PresentationConnection* connection)); 111 PresentationConnection* connection));
113 }; 112 };
114 113
115 class TestPresentationConnectionProxy : public PresentationConnectionProxy {
116 public:
117 TestPresentationConnectionProxy(blink::WebPresentationConnection* connection)
118 : PresentationConnectionProxy(connection) {}
119
120 void SendConnectionMessage(blink::mojom::ConnectionMessagePtr session_message,
121 const OnMessageCallback& callback) const override {
122 SendConnectionMessageInternal(session_message.get(), callback);
123 }
124 MOCK_CONST_METHOD2(SendConnectionMessageInternal,
125 void(blink::mojom::ConnectionMessage*,
126 const OnMessageCallback&));
127 };
128
129 class TestPresentationReceiver : public blink::WebPresentationReceiver {
130 public:
131 blink::WebPresentationConnection* onReceiverConnectionAvailable(
132 const blink::WebPresentationSessionInfo&) override {
133 return &connection_;
134 }
135
136 TestPresentationConnection connection_;
137 };
138
139 class MockPresentationAvailabilityCallbacks 114 class MockPresentationAvailabilityCallbacks
140 : public blink::WebCallbacks<bool, const blink::WebPresentationError&> { 115 : public blink::WebCallbacks<bool, const blink::WebPresentationError&> {
141 public: 116 public:
142 MOCK_METHOD1(onSuccess, void(bool value)); 117 MOCK_METHOD1(onSuccess, void(bool value));
143 MOCK_METHOD1(onError, void(const blink::WebPresentationError&)); 118 MOCK_METHOD1(onError, void(const blink::WebPresentationError&));
144 }; 119 };
145 120
146 class TestWebPresentationConnectionCallback 121 class TestWebPresentationConnectionCallback
147 : public WebPresentationConnectionCallbacks { 122 : public WebPresentationConnectionCallbacks {
148 public: 123 public:
149 // Does not take ownership of |connection|. 124 TestWebPresentationConnectionCallback(WebURL url, WebString id)
150 TestWebPresentationConnectionCallback(WebURL url, 125 : url_(url), id_(id), callback_called_(false) {}
151 WebString id,
152 TestPresentationConnection* connection)
153 : url_(url), id_(id), callback_called_(false), connection_(connection) {}
154 ~TestWebPresentationConnectionCallback() override { 126 ~TestWebPresentationConnectionCallback() override {
155 EXPECT_TRUE(callback_called_); 127 EXPECT_TRUE(callback_called_);
156 } 128 }
157 129
158 void onSuccess(const WebPresentationSessionInfo& info) override { 130 void onSuccess(const WebPresentationSessionInfo& info) override {
159 callback_called_ = true; 131 callback_called_ = true;
160 EXPECT_EQ(info.url, url_); 132 EXPECT_EQ(info.url, url_);
161 EXPECT_EQ(info.id, id_); 133 EXPECT_EQ(info.id, id_);
162 } 134 }
163 135
164 blink::WebPresentationConnection* getConnection() override { 136 blink::WebPresentationConnection* getConnection() override {
165 return connection_; 137 return &connection_;
166 } 138 }
167 139
168 private: 140 private:
169 const WebURL url_; 141 const WebURL url_;
170 const WebString id_; 142 const WebString id_;
171 bool callback_called_; 143 bool callback_called_;
172 TestPresentationConnection* connection_; 144 TestPresentationConnection connection_;
173 }; 145 };
174 146
175 class TestWebPresentationConnectionErrorCallback 147 class TestWebPresentationConnectionErrorCallback
176 : public WebPresentationConnectionCallbacks { 148 : public WebPresentationConnectionCallbacks {
177 public: 149 public:
178 TestWebPresentationConnectionErrorCallback( 150 TestWebPresentationConnectionErrorCallback(
179 WebPresentationError::ErrorType error_type, 151 WebPresentationError::ErrorType error_type,
180 WebString message) 152 WebString message)
181 : error_type_(error_type), message_(message), callback_called_(false) {} 153 : error_type_(error_type), message_(message), callback_called_(false) {}
182 ~TestWebPresentationConnectionErrorCallback() override { 154 ~TestWebPresentationConnectionErrorCallback() override {
(...skipping 30 matching lines...) Expand all
213 mojo::MakeRequest(&presentation_service_)); 185 mojo::MakeRequest(&presentation_service_));
214 } 186 }
215 } 187 }
216 188
217 MockPresentationService* mock_presentation_service_; 189 MockPresentationService* mock_presentation_service_;
218 std::unique_ptr<mojo::Binding<PresentationService>> mock_binding_; 190 std::unique_ptr<mojo::Binding<PresentationService>> mock_binding_;
219 }; 191 };
220 192
221 class PresentationDispatcherTest : public ::testing::Test { 193 class PresentationDispatcherTest : public ::testing::Test {
222 public: 194 public:
223 using OnMessageCallback = PresentationConnectionProxy::OnMessageCallback;
224
225 enum class URLState { Available, Unavailable, Unsupported, Unknown }; 195 enum class URLState { Available, Unavailable, Unsupported, Unknown };
226 196
227 PresentationDispatcherTest() 197 PresentationDispatcherTest()
228 : gurl1_(GURL("https://www.example.com/1.html")), 198 : gurl1_(GURL("https://www.example.com/1.html")),
229 gurl2_(GURL("https://www.example.com/2.html")), 199 gurl2_(GURL("https://www.example.com/2.html")),
230 gurl3_(GURL("https://www.example.com/3.html")), 200 gurl3_(GURL("https://www.example.com/3.html")),
231 gurl4_(GURL("https://www.example.com/4.html")), 201 gurl4_(GURL("https://www.example.com/4.html")),
232 gurls_({gurl1_, gurl2_, gurl3_, gurl4_}), 202 gurls_({gurl1_, gurl2_, gurl3_, gurl4_}),
233 url1_(WebURL(gurl1_)), 203 url1_(WebURL(gurl1_)),
234 url2_(WebURL(gurl2_)), 204 url2_(WebURL(gurl2_)),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 std::vector<MockPresentationAvailabilityObserver*> mock_observers_; 288 std::vector<MockPresentationAvailabilityObserver*> mock_observers_;
319 289
320 MockPresentationService presentation_service_; 290 MockPresentationService presentation_service_;
321 TestPresentationDispatcher dispatcher_; 291 TestPresentationDispatcher dispatcher_;
322 292
323 private: 293 private:
324 content::TestBrowserThreadBundle thread_bundle_; 294 content::TestBrowserThreadBundle thread_bundle_;
325 }; 295 };
326 296
327 TEST_F(PresentationDispatcherTest, TestStartSession) { 297 TEST_F(PresentationDispatcherTest, TestStartSession) {
328 TestPresentationConnection connection; 298 base::RunLoop run_loop;
329 EXPECT_FALSE(connection.proxy());
330 {
331 base::RunLoop run_loop;
332 EXPECT_CALL(presentation_service_, ListenForConnectionMessages(_));
333 EXPECT_CALL(presentation_service_, SetPresentationConnection(_, _));
334 EXPECT_CALL(presentation_service_, StartSession(gurls_, _))
335 .WillOnce(Invoke([this](
336 const std::vector<GURL>& presentation_urls,
337 const PresentationService::StartSessionCallback& callback) {
338 PresentationSessionInfo session_info(gurl1_, presentation_id_.utf8());
339 callback.Run(session_info, base::nullopt);
340 }));
341 299
342 dispatcher_.startSession( 300 EXPECT_CALL(presentation_service_, StartSession(gurls_, _))
343 urls_, base::MakeUnique<TestWebPresentationConnectionCallback>( 301 .WillOnce(Invoke([this](
344 url1_, presentation_id_, &connection)); 302 const std::vector<GURL>& presentation_urls,
345 run_loop.RunUntilIdle(); 303 const PresentationService::StartSessionCallback& callback) {
346 } 304 PresentationSessionInfo session_info(gurl1_, presentation_id_.utf8());
347 EXPECT_TRUE(connection.proxy()); 305 callback.Run(session_info, base::nullopt);
306 }));
307 client()->startSession(
308 urls_, base::MakeUnique<TestWebPresentationConnectionCallback>(
309 url1_, presentation_id_));
310 run_loop.RunUntilIdle();
348 } 311 }
349 312
350 TEST_F(PresentationDispatcherTest, TestStartSessionError) { 313 TEST_F(PresentationDispatcherTest, TestStartSessionError) {
351 WebString error_message = WebString::fromUTF8("Test error message"); 314 WebString error_message = WebString::fromUTF8("Test error message");
352 base::RunLoop run_loop; 315 base::RunLoop run_loop;
353 316
354 EXPECT_CALL(presentation_service_, StartSession(gurls_, _)) 317 EXPECT_CALL(presentation_service_, StartSession(gurls_, _))
355 .WillOnce(Invoke([&error_message]( 318 .WillOnce(Invoke([&error_message](
356 const std::vector<GURL>& presentation_urls, 319 const std::vector<GURL>& presentation_urls,
357 const PresentationService::StartSessionCallback& callback) { 320 const PresentationService::StartSessionCallback& callback) {
358 callback.Run( 321 callback.Run(
359 base::nullopt, 322 base::nullopt,
360 PresentationError(content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS, 323 PresentationError(content::PRESENTATION_ERROR_NO_AVAILABLE_SCREENS,
361 error_message.utf8())); 324 error_message.utf8()));
362 })); 325 }));
363 dispatcher_.startSession( 326 client()->startSession(
364 urls_, 327 urls_,
365 base::MakeUnique<TestWebPresentationConnectionErrorCallback>( 328 base::MakeUnique<TestWebPresentationConnectionErrorCallback>(
366 WebPresentationError::ErrorTypeNoAvailableScreens, error_message)); 329 WebPresentationError::ErrorTypeNoAvailableScreens, error_message));
367 run_loop.RunUntilIdle(); 330 run_loop.RunUntilIdle();
368 } 331 }
369 332
370 TEST_F(PresentationDispatcherTest, TestJoinSessionError) { 333 TEST_F(PresentationDispatcherTest, TestJoinSessionError) {
371 WebString error_message = WebString::fromUTF8("Test error message"); 334 WebString error_message = WebString::fromUTF8("Test error message");
372 base::RunLoop run_loop; 335 base::RunLoop run_loop;
373 336
(...skipping 10 matching lines...) Expand all
384 error_message.utf8())); 347 error_message.utf8()));
385 })); 348 }));
386 dispatcher_.joinSession( 349 dispatcher_.joinSession(
387 urls_, presentation_id_, 350 urls_, presentation_id_,
388 base::MakeUnique<TestWebPresentationConnectionErrorCallback>( 351 base::MakeUnique<TestWebPresentationConnectionErrorCallback>(
389 WebPresentationError::ErrorTypeNoAvailableScreens, error_message)); 352 WebPresentationError::ErrorTypeNoAvailableScreens, error_message));
390 run_loop.RunUntilIdle(); 353 run_loop.RunUntilIdle();
391 } 354 }
392 355
393 TEST_F(PresentationDispatcherTest, TestJoinSession) { 356 TEST_F(PresentationDispatcherTest, TestJoinSession) {
394 TestPresentationConnection connection; 357 base::RunLoop run_loop;
395 EXPECT_FALSE(connection.proxy());
396 {
397 base::RunLoop run_loop;
398 EXPECT_CALL(presentation_service_, ListenForConnectionMessages(_));
399 EXPECT_CALL(presentation_service_, SetPresentationConnection(_, _));
400 EXPECT_CALL(presentation_service_, JoinSession(gurls_, _, _))
401 .WillOnce(Invoke([this](
402 const std::vector<GURL>& presentation_urls,
403 const base::Optional<std::string>& presentation_id,
404 const PresentationService::JoinSessionCallback& callback) {
405 EXPECT_TRUE(presentation_id.has_value());
406 EXPECT_EQ(presentation_id_.utf8(), presentation_id.value());
407 callback.Run(PresentationSessionInfo(gurl1_, presentation_id_.utf8()),
408 base::nullopt);
409 }));
410 358
411 dispatcher_.joinSession( 359 EXPECT_CALL(presentation_service_, JoinSession(gurls_, _, _))
412 urls_, presentation_id_, 360 .WillOnce(Invoke([this](
413 base::MakeUnique<TestWebPresentationConnectionCallback>( 361 const std::vector<GURL>& presentation_urls,
414 url1_, presentation_id_, &connection)); 362 const base::Optional<std::string>& presentation_id,
415 run_loop.RunUntilIdle(); 363 const PresentationService::JoinSessionCallback& callback) {
416 } 364 EXPECT_TRUE(presentation_id.has_value());
417 EXPECT_TRUE(connection.proxy()); 365 EXPECT_EQ(presentation_id_.utf8(), presentation_id.value());
366 callback.Run(PresentationSessionInfo(gurl1_, presentation_id_.utf8()),
367 base::nullopt);
368 }));
369 dispatcher_.joinSession(
370 urls_, presentation_id_,
371 base::MakeUnique<TestWebPresentationConnectionCallback>(
372 url1_, presentation_id_));
373 run_loop.RunUntilIdle();
418 } 374 }
419 375
420 TEST_F(PresentationDispatcherTest, TestSendString) { 376 TEST_F(PresentationDispatcherTest, TestSendString) {
421 WebString message = WebString::fromUTF8("test message"); 377 WebString message = WebString::fromUTF8("test message");
422 TestPresentationConnection connection;
423 TestPresentationConnectionProxy connection_proxy(&connection);
424
425 base::RunLoop run_loop; 378 base::RunLoop run_loop;
426 EXPECT_CALL(connection_proxy, SendConnectionMessageInternal(_, _)) 379 EXPECT_CALL(presentation_service_, SendConnectionMessageInternal(_, _, _))
427 .WillOnce(Invoke([this, &message](ConnectionMessage* session_message, 380 .WillOnce(Invoke([this, &message](
428 const OnMessageCallback& callback) { 381 const PresentationSessionInfo& session_info,
429 EXPECT_EQ(blink::mojom::PresentationMessageType::TEXT, 382 ConnectionMessage* message_request,
430 session_message->type); 383 const PresentationService::SendConnectionMessageCallback& callback) {
431 EXPECT_EQ(message.utf8(), session_message->message.value()); 384 EXPECT_EQ(gurl1_, session_info.presentation_url);
385 EXPECT_EQ(presentation_id_.utf8(), session_info.presentation_id);
386 EXPECT_TRUE(message_request->message.has_value());
387 EXPECT_EQ(message.utf8(), message_request->message.value());
388 callback.Run(true);
432 })); 389 }));
433 dispatcher_.sendString(url1_, presentation_id_, message, &connection_proxy); 390 dispatcher_.sendString(url1_, presentation_id_, message, nullptr);
434 run_loop.RunUntilIdle(); 391 run_loop.RunUntilIdle();
435 } 392 }
436 393
437 TEST_F(PresentationDispatcherTest, TestSendArrayBuffer) { 394 TEST_F(PresentationDispatcherTest, TestSendArrayBuffer) {
438 TestPresentationConnection connection;
439 TestPresentationConnectionProxy connection_proxy(&connection);
440
441 base::RunLoop run_loop; 395 base::RunLoop run_loop;
442 EXPECT_CALL(connection_proxy, SendConnectionMessageInternal(_, _)) 396 EXPECT_CALL(presentation_service_, SendConnectionMessageInternal(_, _, _))
443 .WillOnce(Invoke([this](ConnectionMessage* message_request, 397 .WillOnce(Invoke([this](
444 const OnMessageCallback& callback) { 398 const PresentationSessionInfo& session_info,
399 ConnectionMessage* message_request,
400 const PresentationService::SendConnectionMessageCallback& callback) {
401 EXPECT_EQ(gurl1_, session_info.presentation_url);
402 EXPECT_EQ(presentation_id_.utf8(), session_info.presentation_id);
445 std::vector<uint8_t> data( 403 std::vector<uint8_t> data(
446 array_buffer_data(), 404 array_buffer_data(),
447 array_buffer_data() + array_buffer_.byteLength()); 405 array_buffer_data() + array_buffer_.byteLength());
448 EXPECT_TRUE(message_request->data.has_value()); 406 EXPECT_TRUE(message_request->data.has_value());
449 EXPECT_EQ(data, message_request->data.value()); 407 EXPECT_EQ(data, message_request->data.value());
408 callback.Run(true);
450 })); 409 }));
451 dispatcher_.sendArrayBuffer(url1_, presentation_id_, array_buffer_data(), 410 dispatcher_.sendArrayBuffer(url1_, presentation_id_, array_buffer_data(),
452 array_buffer_.byteLength(), &connection_proxy); 411 array_buffer_.byteLength(), nullptr);
453 run_loop.RunUntilIdle(); 412 run_loop.RunUntilIdle();
454 } 413 }
455 414
456 TEST_F(PresentationDispatcherTest, TestSendBlobData) { 415 TEST_F(PresentationDispatcherTest, TestSendBlobData) {
457 TestPresentationConnection connection;
458 TestPresentationConnectionProxy connection_proxy(&connection);
459
460 base::RunLoop run_loop; 416 base::RunLoop run_loop;
461 EXPECT_CALL(connection_proxy, SendConnectionMessageInternal(_, _)) 417 EXPECT_CALL(presentation_service_, SendConnectionMessageInternal(_, _, _))
462 .WillOnce(Invoke([this](ConnectionMessage* message_request, 418 .WillOnce(Invoke([this](
463 const OnMessageCallback& callback) { 419 const PresentationSessionInfo& session_info,
420 ConnectionMessage* message_request,
421 const PresentationService::SendConnectionMessageCallback& callback) {
422 EXPECT_EQ(gurl1_, session_info.presentation_url);
423 EXPECT_EQ(presentation_id_.utf8(), session_info.presentation_id);
464 std::vector<uint8_t> data( 424 std::vector<uint8_t> data(
465 array_buffer_data(), 425 array_buffer_data(),
466 array_buffer_data() + array_buffer_.byteLength()); 426 array_buffer_data() + array_buffer_.byteLength());
467 EXPECT_TRUE(message_request->data.has_value()); 427 EXPECT_TRUE(message_request->data.has_value());
468 EXPECT_EQ(data, message_request->data.value()); 428 EXPECT_EQ(data, message_request->data.value());
469 callback.Run(true); 429 callback.Run(true);
470 })); 430 }));
471 dispatcher_.sendBlobData(url1_, presentation_id_, array_buffer_data(), 431 dispatcher_.sendBlobData(url1_, presentation_id_, array_buffer_data(),
472 array_buffer_.byteLength(), &connection_proxy); 432 array_buffer_.byteLength(), nullptr);
473 run_loop.RunUntilIdle(); 433 run_loop.RunUntilIdle();
474 } 434 }
475 435
476 TEST_F(PresentationDispatcherTest, TestOnReceiverConnectionAvailable) {
477 PresentationSessionInfo session_info(gurl1_, presentation_id_.utf8());
478
479 blink::mojom::PresentationConnectionPtr controller_connection_ptr;
480 TestPresentationConnection controller_connection;
481 TestPresentationConnectionProxy controller_connection_proxy(
482 &controller_connection);
483 mojo::Binding<blink::mojom::PresentationConnection> binding(
484 &controller_connection_proxy,
485 mojo::MakeRequest(&controller_connection_ptr));
486
487 blink::mojom::PresentationConnectionPtr receiver_connection_ptr;
488
489 TestPresentationReceiver receiver;
490 dispatcher_.setReceiver(&receiver);
491
492 base::RunLoop run_loop;
493 EXPECT_CALL(controller_connection,
494 didChangeState(blink::WebPresentationConnectionState::Connected));
495 EXPECT_CALL(receiver.connection_,
496 didChangeState(blink::WebPresentationConnectionState::Connected));
497
498 dispatcher_.OnReceiverConnectionAvailable(
499 std::move(session_info), std::move(controller_connection_ptr),
500 mojo::MakeRequest(&receiver_connection_ptr));
501
502 EXPECT_TRUE(receiver_connection_ptr);
503 EXPECT_TRUE(receiver.connection_.proxy());
504 run_loop.RunUntilIdle();
505 }
506
507 TEST_F(PresentationDispatcherTest, TestCloseSession) { 436 TEST_F(PresentationDispatcherTest, TestCloseSession) {
508 base::RunLoop run_loop; 437 base::RunLoop run_loop;
509 EXPECT_CALL(presentation_service_, 438 EXPECT_CALL(presentation_service_,
510 CloseConnection(gurl1_, presentation_id_.utf8())); 439 CloseConnection(gurl1_, presentation_id_.utf8()));
511 dispatcher_.closeSession(url1_, presentation_id_); 440 dispatcher_.closeSession(url1_, presentation_id_);
512 run_loop.RunUntilIdle(); 441 run_loop.RunUntilIdle();
513 } 442 }
514 443
515 TEST_F(PresentationDispatcherTest, TestTerminateSession) { 444 TEST_F(PresentationDispatcherTest, TestTerminateSession) {
516 base::RunLoop run_loop; 445 base::RunLoop run_loop;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 712
784 for (auto* mock_observer : mock_observers_) 713 for (auto* mock_observer : mock_observers_)
785 EXPECT_CALL(*mock_observer, availabilityChanged(false)); 714 EXPECT_CALL(*mock_observer, availabilityChanged(false));
786 715
787 base::RunLoop run_loop_2; 716 base::RunLoop run_loop_2;
788 ChangeURLState(gurl2_, URLState::Unavailable); 717 ChangeURLState(gurl2_, URLState::Unavailable);
789 run_loop_2.RunUntilIdle(); 718 run_loop_2.RunUntilIdle();
790 } 719 }
791 720
792 } // namespace content 721 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/presentation/presentation_dispatcher.cc ('k') | content/renderer/presentation/test_presentation_connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698