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

Side by Side Diff: chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc

Issue 2737413003: [Presentation API] Remove references to presentation sessions. (Closed)
Patch Set: Update presentation service mock. 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 "chrome/browser/media/router/presentation_service_delegate_impl.h" 5 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/test/mock_callback.h" 8 #include "base/test/mock_callback.h"
9 #include "chrome/browser/media/router/media_source.h" 9 #include "chrome/browser/media/router/media_source.h"
10 #include "chrome/browser/media/router/media_source_helper.h" 10 #include "chrome/browser/media/router/media_source_helper.h"
11 #include "chrome/browser/media/router/mock_media_router.h" 11 #include "chrome/browser/media/router/mock_media_router.h"
12 #include "chrome/browser/media/router/mock_screen_availability_listener.h" 12 #include "chrome/browser/media/router/mock_screen_availability_listener.h"
13 #include "chrome/browser/media/router/offscreen_presentation_manager.h" 13 #include "chrome/browser/media/router/offscreen_presentation_manager.h"
14 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h" 14 #include "chrome/browser/media/router/offscreen_presentation_manager_factory.h"
15 #include "chrome/browser/media/router/route_request_result.h" 15 #include "chrome/browser/media/router/route_request_result.h"
16 #include "chrome/browser/media/router/test_helper.h" 16 #include "chrome/browser/media/router/test_helper.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
20 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
21 #include "components/prefs/scoped_user_pref_update.h" 21 #include "components/prefs/scoped_user_pref_update.h"
22 #include "content/public/browser/presentation_screen_availability_listener.h" 22 #include "content/public/browser/presentation_screen_availability_listener.h"
23 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
24 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
25 #include "content/public/common/presentation_session.h" 25 #include "content/public/common/presentation_info.h"
26 #include "content/public/test/web_contents_tester.h" 26 #include "content/public/test/web_contents_tester.h"
27 #include "mojo/public/cpp/bindings/binding.h" 27 #include "mojo/public/cpp/bindings/binding.h"
28 #include "testing/gmock/include/gmock/gmock.h" 28 #include "testing/gmock/include/gmock/gmock.h"
29 #include "url/origin.h" 29 #include "url/origin.h"
30 30
31 using ::testing::_; 31 using ::testing::_;
32 using ::testing::Mock; 32 using ::testing::Mock;
33 using ::testing::Return; 33 using ::testing::Return;
34 using ::testing::SaveArg; 34 using ::testing::SaveArg;
35 using ::testing::StrictMock; 35 using ::testing::StrictMock;
36 36
37 namespace { 37 namespace {
38 38
39 const char kPresentationUrl1[] = "http://foo.fakeurl.com/"; 39 const char kPresentationUrl1[] = "http://foo.fakeurl.com/";
40 const char kPresentationUrl2[] = "http://bar.fakeurl.com/"; 40 const char kPresentationUrl2[] = "http://bar.fakeurl.com/";
41 const char kPresentationUrl3[] = 41 const char kPresentationUrl3[] =
42 "https://google.com/cast#__castAppId__=233637DE"; 42 "https://google.com/cast#__castAppId__=233637DE";
43 const char kFrameUrl[] = "http://anotherframeurl.fakeurl.com/"; 43 const char kFrameUrl[] = "http://anotherframeurl.fakeurl.com/";
44 44
45 } // namespace 45 } // namespace
46 46
47 namespace media_router { 47 namespace media_router {
48 48
49 class MockDelegateObserver 49 class MockDelegateObserver
50 : public content::PresentationServiceDelegate::Observer { 50 : public content::PresentationServiceDelegate::Observer {
51 public: 51 public:
52 MOCK_METHOD0(OnDelegateDestroyed, void()); 52 MOCK_METHOD0(OnDelegateDestroyed, void());
53 MOCK_METHOD1(OnDefaultPresentationStarted, 53 MOCK_METHOD1(OnDefaultPresentationStarted,
54 void(const content::PresentationSessionInfo&)); 54 void(const content::PresentationInfo&));
55 }; 55 };
56 56
57 class MockDefaultPresentationRequestObserver 57 class MockDefaultPresentationRequestObserver
58 : public PresentationServiceDelegateImpl:: 58 : public PresentationServiceDelegateImpl::
59 DefaultPresentationRequestObserver { 59 DefaultPresentationRequestObserver {
60 public: 60 public:
61 MOCK_METHOD1(OnDefaultPresentationChanged, void(const PresentationRequest&)); 61 MOCK_METHOD1(OnDefaultPresentationChanged, void(const PresentationRequest&));
62 MOCK_METHOD0(OnDefaultPresentationRemoved, void()); 62 MOCK_METHOD0(OnDefaultPresentationRemoved, void());
63 }; 63 };
64 64
65 class MockCreatePresentationConnnectionCallbacks { 65 class MockCreatePresentationConnnectionCallbacks {
66 public: 66 public:
67 MOCK_METHOD1(OnCreateConnectionSuccess, 67 MOCK_METHOD1(OnCreateConnectionSuccess,
68 void(const content::PresentationSessionInfo& connection)); 68 void(const content::PresentationInfo& connection));
69 MOCK_METHOD1(OnCreateConnectionError, 69 MOCK_METHOD1(OnCreateConnectionError,
70 void(const content::PresentationError& error)); 70 void(const content::PresentationError& error));
71 }; 71 };
72 72
73 class MockOffscreenPresentationManager : public OffscreenPresentationManager { 73 class MockOffscreenPresentationManager : public OffscreenPresentationManager {
74 public: 74 public:
75 void RegisterOffscreenPresentationController( 75 void RegisterOffscreenPresentationController(
76 const std::string& presentation_id, 76 const std::string& presentation_id,
77 const GURL& presentation_url, 77 const GURL& presentation_url,
78 const RenderFrameHostId& render_frame_id, 78 const RenderFrameHostId& render_frame_id,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 content::WebContents* wc = GetWebContents(); 120 content::WebContents* wc = GetWebContents();
121 ASSERT_TRUE(wc); 121 ASSERT_TRUE(wc);
122 PresentationServiceDelegateImpl::CreateForWebContents(wc); 122 PresentationServiceDelegateImpl::CreateForWebContents(wc);
123 delegate_impl_ = PresentationServiceDelegateImpl::FromWebContents(wc); 123 delegate_impl_ = PresentationServiceDelegateImpl::FromWebContents(wc);
124 delegate_impl_->SetMediaRouterForTest(&router_); 124 delegate_impl_->SetMediaRouterForTest(&router_);
125 presentation_urls_.push_back(presentation_url1_); 125 presentation_urls_.push_back(presentation_url1_);
126 SetMainFrame(); 126 SetMainFrame();
127 } 127 }
128 128
129 MOCK_METHOD1(OnDefaultPresentationStarted, 129 MOCK_METHOD1(OnDefaultPresentationStarted,
130 void(const content::PresentationSessionInfo& session_info)); 130 void(const content::PresentationInfo& presentation_info));
131 131
132 protected: 132 protected:
133 virtual content::WebContents* GetWebContents() { return web_contents(); } 133 virtual content::WebContents* GetWebContents() { return web_contents(); }
134 134
135 void RunDefaultPresentationUrlCallbackTest(bool incognito) { 135 void RunDefaultPresentationUrlCallbackTest(bool incognito) {
136 auto callback = base::Bind( 136 auto callback = base::Bind(
137 &PresentationServiceDelegateImplTest::OnDefaultPresentationStarted, 137 &PresentationServiceDelegateImplTest::OnDefaultPresentationStarted,
138 base::Unretained(this)); 138 base::Unretained(this));
139 std::vector<std::string> urls({kPresentationUrl1}); 139 std::vector<std::string> urls({kPresentationUrl1});
140 delegate_impl_->SetDefaultPresentationUrls(main_frame_process_id_, 140 delegate_impl_->SetDefaultPresentationUrls(main_frame_process_id_,
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 ->NavigateAndCommit(frame_url); 409 ->NavigateAndCommit(frame_url);
410 410
411 // Set up a PresentationConnection so we can listen to it. 411 // Set up a PresentationConnection so we can listen to it.
412 std::vector<MediaRouteResponseCallback> route_response_callbacks; 412 std::vector<MediaRouteResponseCallback> route_response_callbacks;
413 EXPECT_CALL(router_, JoinRoute(_, _, _, _, _, _, false)) 413 EXPECT_CALL(router_, JoinRoute(_, _, _, _, _, _, false))
414 .WillOnce(SaveArg<4>(&route_response_callbacks)); 414 .WillOnce(SaveArg<4>(&route_response_callbacks));
415 415
416 const std::string kPresentationId("pid"); 416 const std::string kPresentationId("pid");
417 presentation_urls_.push_back(GURL(kPresentationUrl3)); 417 presentation_urls_.push_back(GURL(kPresentationUrl3));
418 MockCreatePresentationConnnectionCallbacks mock_create_connection_callbacks; 418 MockCreatePresentationConnnectionCallbacks mock_create_connection_callbacks;
419 delegate_impl_->JoinSession( 419 delegate_impl_->ReconnectPresentation(
420 main_frame_process_id_, main_frame_routing_id_, presentation_urls_, 420 main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
421 kPresentationId, 421 kPresentationId,
422 base::Bind(&MockCreatePresentationConnnectionCallbacks:: 422 base::Bind(&MockCreatePresentationConnnectionCallbacks::
423 OnCreateConnectionSuccess, 423 OnCreateConnectionSuccess,
424 base::Unretained(&mock_create_connection_callbacks)), 424 base::Unretained(&mock_create_connection_callbacks)),
425 base::Bind( 425 base::Bind(
426 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, 426 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError,
427 base::Unretained(&mock_create_connection_callbacks))); 427 base::Unretained(&mock_create_connection_callbacks)));
428 428
429 EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionSuccess(_)) 429 EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionSuccess(_))
430 .Times(1); 430 .Times(1);
431 std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromSuccess( 431 std::unique_ptr<RouteRequestResult> result = RouteRequestResult::FromSuccess(
432 MediaRoute("routeId", source1_, "mediaSinkId", "description", true, "", 432 MediaRoute("routeId", source1_, "mediaSinkId", "description", true, "",
433 true), 433 true),
434 kPresentationId); 434 kPresentationId);
435 for (const auto& route_response_callback : route_response_callbacks) 435 for (const auto& route_response_callback : route_response_callbacks)
436 route_response_callback.Run(*result); 436 route_response_callback.Run(*result);
437 437
438 base::MockCallback<content::PresentationConnectionStateChangedCallback> 438 base::MockCallback<content::PresentationConnectionStateChangedCallback>
439 mock_callback; 439 mock_callback;
440 auto callback = mock_callback.Get(); 440 auto callback = mock_callback.Get();
441 content::PresentationSessionInfo connection(presentation_url1_, 441 content::PresentationInfo connection(presentation_url1_, kPresentationId);
442 kPresentationId);
443 EXPECT_CALL(router_, OnAddPresentationConnectionStateChangedCallbackInvoked( 442 EXPECT_CALL(router_, OnAddPresentationConnectionStateChangedCallbackInvoked(
444 Equals(callback))); 443 Equals(callback)));
445 delegate_impl_->ListenForConnectionStateChange( 444 delegate_impl_->ListenForConnectionStateChange(
446 main_frame_process_id_, main_frame_routing_id_, connection, callback); 445 main_frame_process_id_, main_frame_routing_id_, connection, callback);
447 } 446 }
448 447
449 TEST_F(PresentationServiceDelegateImplTest, Reset) { 448 TEST_F(PresentationServiceDelegateImplTest, Reset) {
450 EXPECT_CALL(router_, RegisterMediaSinksObserver(_)) 449 EXPECT_CALL(router_, RegisterMediaSinksObserver(_))
451 .WillRepeatedly(Return(true)); 450 .WillRepeatedly(Return(true));
452 451
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 main_frame_process_id_, main_frame_routing_id_, &listener1_)); 484 main_frame_process_id_, main_frame_routing_id_, &listener1_));
486 } 485 }
487 486
488 TEST_F(PresentationServiceDelegateImplTest, ConnectToPresentation) { 487 TEST_F(PresentationServiceDelegateImplTest, ConnectToPresentation) {
489 content::RenderFrameHost* main_frame = GetWebContents()->GetMainFrame(); 488 content::RenderFrameHost* main_frame = GetWebContents()->GetMainFrame();
490 ASSERT_TRUE(main_frame); 489 ASSERT_TRUE(main_frame);
491 int render_process_id = main_frame->GetProcess()->GetID(); 490 int render_process_id = main_frame->GetProcess()->GetID();
492 int render_frame_id = main_frame->GetRoutingID(); 491 int render_frame_id = main_frame->GetRoutingID();
493 std::string presentation_id = "presentation_id"; 492 std::string presentation_id = "presentation_id";
494 GURL presentation_url = GURL("http://www.example.com/presentation.html"); 493 GURL presentation_url = GURL("http://www.example.com/presentation.html");
495 content::PresentationSessionInfo session_info(presentation_url, 494 content::PresentationInfo presentation_info(presentation_url,
496 presentation_id); 495 presentation_id);
497 496
498 base::MockCallback< 497 base::MockCallback<base::Callback<void(const content::PresentationInfo&)>>
499 base::Callback<void(const content::PresentationSessionInfo&)>>
500 mock_callback; 498 mock_callback;
501 EXPECT_CALL(mock_callback, Run(_)); 499 EXPECT_CALL(mock_callback, Run(_));
502 MediaRoute media_route( 500 MediaRoute media_route(
503 "route_id", MediaSourceForPresentationUrl(session_info.presentation_url), 501 "route_id",
502 MediaSourceForPresentationUrl(presentation_info.presentation_url),
504 "mediaSinkId", "", true, "", true); 503 "mediaSinkId", "", true, "", true);
505 media_route.set_offscreen_presentation(true); 504 media_route.set_offscreen_presentation(true);
506 delegate_impl_->OnStartSessionSucceeded(render_process_id, render_frame_id, 505 delegate_impl_->OnStartPresentationSucceeded(
507 mock_callback.Get(), session_info, 506 render_process_id, render_frame_id, mock_callback.Get(),
508 media_route); 507 presentation_info, media_route);
509 508
510 OffscreenPresentationManagerFactory::GetInstanceForTest()->SetTestingFactory( 509 OffscreenPresentationManagerFactory::GetInstanceForTest()->SetTestingFactory(
511 profile(), &BuildMockOffscreenPresentationManager); 510 profile(), &BuildMockOffscreenPresentationManager);
512 MockOffscreenPresentationManager* mock_offscreen_manager = 511 MockOffscreenPresentationManager* mock_offscreen_manager =
513 static_cast<MockOffscreenPresentationManager*>( 512 static_cast<MockOffscreenPresentationManager*>(
514 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext( 513 OffscreenPresentationManagerFactory::GetOrCreateForBrowserContext(
515 profile())); 514 profile()));
516 EXPECT_CALL(*mock_offscreen_manager, 515 EXPECT_CALL(*mock_offscreen_manager,
517 RegisterOffscreenPresentationController( 516 RegisterOffscreenPresentationController(
518 presentation_id, presentation_url, 517 presentation_id, presentation_url,
519 RenderFrameHostId(render_process_id, render_frame_id))); 518 RenderFrameHostId(render_process_id, render_frame_id)));
520 519
521 content::PresentationConnectionPtr connection_ptr; 520 content::PresentationConnectionPtr connection_ptr;
522 content::PresentationConnectionRequest connection_request; 521 content::PresentationConnectionRequest connection_request;
523 delegate_impl_->ConnectToPresentation(render_process_id, render_frame_id, 522 delegate_impl_->ConnectToPresentation(
524 session_info, std::move(connection_ptr), 523 render_process_id, render_frame_id, presentation_info,
525 std::move(connection_request)); 524 std::move(connection_ptr), std::move(connection_request));
526 525
527 EXPECT_CALL(*mock_offscreen_manager, 526 EXPECT_CALL(*mock_offscreen_manager,
528 UnregisterOffscreenPresentationController( 527 UnregisterOffscreenPresentationController(
529 presentation_id, 528 presentation_id,
530 RenderFrameHostId(render_process_id, render_frame_id))); 529 RenderFrameHostId(render_process_id, render_frame_id)));
531 EXPECT_CALL(router_, DetachRoute("route_id")); 530 EXPECT_CALL(router_, DetachRoute("route_id"));
532 delegate_impl_->Reset(render_process_id, render_frame_id); 531 delegate_impl_->Reset(render_process_id, render_frame_id);
533 } 532 }
534 533
535 #if !defined(OS_ANDROID) 534 #if !defined(OS_ANDROID)
(...skipping 10 matching lines...) Expand all
546 // Set the user preference for |origin| to prefer tab mirroring. 545 // Set the user preference for |origin| to prefer tab mirroring.
547 { 546 {
548 ListPrefUpdate update(profile()->GetPrefs(), 547 ListPrefUpdate update(profile()->GetPrefs(),
549 prefs::kMediaRouterTabMirroringSources); 548 prefs::kMediaRouterTabMirroringSources);
550 update->AppendIfNotPresent(base::MakeUnique<base::Value>(origin)); 549 update->AppendIfNotPresent(base::MakeUnique<base::Value>(origin));
551 } 550 }
552 551
553 // Auto-join requests should be rejected. 552 // Auto-join requests should be rejected.
554 EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_)); 553 EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_));
555 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0); 554 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0);
556 delegate_impl_->JoinSession( 555 delegate_impl_->ReconnectPresentation(
557 main_frame_process_id_, main_frame_routing_id_, presentation_urls_, 556 main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
558 kPresentationId, 557 kPresentationId,
559 base::Bind(&MockCreatePresentationConnnectionCallbacks:: 558 base::Bind(&MockCreatePresentationConnnectionCallbacks::
560 OnCreateConnectionSuccess, 559 OnCreateConnectionSuccess,
561 base::Unretained(&mock_create_connection_callbacks)), 560 base::Unretained(&mock_create_connection_callbacks)),
562 base::Bind( 561 base::Bind(
563 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, 562 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError,
564 base::Unretained(&mock_create_connection_callbacks))); 563 base::Unretained(&mock_create_connection_callbacks)));
565 564
566 // Remove the user preference for |origin|. 565 // Remove the user preference for |origin|.
567 { 566 {
568 ListPrefUpdate update(profile()->GetPrefs(), 567 ListPrefUpdate update(profile()->GetPrefs(),
569 prefs::kMediaRouterTabMirroringSources); 568 prefs::kMediaRouterTabMirroringSources);
570 update->Remove(base::Value(origin), nullptr); 569 update->Remove(base::Value(origin), nullptr);
571 } 570 }
572 571
573 // Auto-join requests should now go through. 572 // Auto-join requests should now go through.
574 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1); 573 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1);
575 delegate_impl_->JoinSession( 574 delegate_impl_->ReconnectPresentation(
576 main_frame_process_id_, main_frame_routing_id_, presentation_urls_, 575 main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
577 kPresentationId, 576 kPresentationId,
578 base::Bind(&MockCreatePresentationConnnectionCallbacks:: 577 base::Bind(&MockCreatePresentationConnnectionCallbacks::
579 OnCreateConnectionSuccess, 578 OnCreateConnectionSuccess,
580 base::Unretained(&mock_create_connection_callbacks)), 579 base::Unretained(&mock_create_connection_callbacks)),
581 base::Bind( 580 base::Bind(
582 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, 581 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError,
583 base::Unretained(&mock_create_connection_callbacks))); 582 base::Unretained(&mock_create_connection_callbacks)));
584 } 583 }
585 584
(...skipping 17 matching lines...) Expand all
603 // Setting the pref in incognito shouldn't set it for the non-incognito 602 // Setting the pref in incognito shouldn't set it for the non-incognito
604 // profile. 603 // profile.
605 const base::ListValue* non_incognito_origins = 604 const base::ListValue* non_incognito_origins =
606 profile()->GetPrefs()->GetList(prefs::kMediaRouterTabMirroringSources); 605 profile()->GetPrefs()->GetList(prefs::kMediaRouterTabMirroringSources);
607 EXPECT_EQ(non_incognito_origins->Find(base::Value(origin)), 606 EXPECT_EQ(non_incognito_origins->Find(base::Value(origin)),
608 non_incognito_origins->end()); 607 non_incognito_origins->end());
609 608
610 // Auto-join requests should be rejected. 609 // Auto-join requests should be rejected.
611 EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_)); 610 EXPECT_CALL(mock_create_connection_callbacks, OnCreateConnectionError(_));
612 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0); 611 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(0);
613 delegate_impl_->JoinSession( 612 delegate_impl_->ReconnectPresentation(
614 main_frame_process_id_, main_frame_routing_id_, presentation_urls_, 613 main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
615 kPresentationId, 614 kPresentationId,
616 base::Bind(&MockCreatePresentationConnnectionCallbacks:: 615 base::Bind(&MockCreatePresentationConnnectionCallbacks::
617 OnCreateConnectionSuccess, 616 OnCreateConnectionSuccess,
618 base::Unretained(&mock_create_connection_callbacks)), 617 base::Unretained(&mock_create_connection_callbacks)),
619 base::Bind( 618 base::Bind(
620 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, 619 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError,
621 base::Unretained(&mock_create_connection_callbacks))); 620 base::Unretained(&mock_create_connection_callbacks)));
622 621
623 // Remove the user preference for |origin| in incognito. 622 // Remove the user preference for |origin| in incognito.
624 { 623 {
625 ListPrefUpdate update(profile()->GetOffTheRecordProfile()->GetPrefs(), 624 ListPrefUpdate update(profile()->GetOffTheRecordProfile()->GetPrefs(),
626 prefs::kMediaRouterTabMirroringSources); 625 prefs::kMediaRouterTabMirroringSources);
627 update->Remove(base::Value(origin), nullptr); 626 update->Remove(base::Value(origin), nullptr);
628 } 627 }
629 628
630 // Auto-join requests should now go through. 629 // Auto-join requests should now go through.
631 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1); 630 EXPECT_CALL(router_, JoinRoute(_, kPresentationId, _, _, _, _, _)).Times(1);
632 delegate_impl_->JoinSession( 631 delegate_impl_->ReconnectPresentation(
633 main_frame_process_id_, main_frame_routing_id_, presentation_urls_, 632 main_frame_process_id_, main_frame_routing_id_, presentation_urls_,
634 kPresentationId, 633 kPresentationId,
635 base::Bind(&MockCreatePresentationConnnectionCallbacks:: 634 base::Bind(&MockCreatePresentationConnnectionCallbacks::
636 OnCreateConnectionSuccess, 635 OnCreateConnectionSuccess,
637 base::Unretained(&mock_create_connection_callbacks)), 636 base::Unretained(&mock_create_connection_callbacks)),
638 base::Bind( 637 base::Bind(
639 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError, 638 &MockCreatePresentationConnnectionCallbacks::OnCreateConnectionError,
640 base::Unretained(&mock_create_connection_callbacks))); 639 base::Unretained(&mock_create_connection_callbacks)));
641 } 640 }
642 #endif // !defined(OS_ANDROID) 641 #endif // !defined(OS_ANDROID)
643 642
644 } // namespace media_router 643 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698