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

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

Issue 2972933002: [Media Router] Move main frame check for SetDefaultPresentationUrls. (Closed)
Patch Set: Rebase Created 3 years, 5 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
« no previous file with comments | « content/browser/presentation/presentation_service_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <iterator>
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 PresentationInfo presentation_info(presentation_url2_, kPresentationId); 452 PresentationInfo presentation_info(presentation_url2_, kPresentationId);
453 453
454 EXPECT_CALL(mock_client_, 454 EXPECT_CALL(mock_client_,
455 OnDefaultPresentationStarted(InfoEquals(presentation_info))); 455 OnDefaultPresentationStarted(InfoEquals(presentation_info)));
456 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)); 456 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _));
457 std::move(callback).Run( 457 std::move(callback).Run(
458 PresentationInfo(presentation_url2_, kPresentationId)); 458 PresentationInfo(presentation_url2_, kPresentationId));
459 base::RunLoop().RunUntilIdle(); 459 base::RunLoop().RunUntilIdle();
460 } 460 }
461 461
462 TEST_F(PresentationServiceImplTest,
463 SetDefaultPresentationUrlsNoopsOnNonMainFrame) {
464 RenderFrameHost* rfh = main_rfh();
465 RenderFrameHostTester* rfh_tester = RenderFrameHostTester::For(rfh);
466 rfh = rfh_tester->AppendChild("subframe");
467
468 EXPECT_CALL(mock_delegate_, RemoveObserver(_, _)).Times(1);
469 EXPECT_CALL(mock_delegate_, AddObserver(_, _, _)).Times(1);
470 service_impl_.reset(
471 new PresentationServiceImpl(rfh, contents(), &mock_delegate_, nullptr));
472
473 EXPECT_CALL(mock_delegate_,
474 SetDefaultPresentationUrls(_, _, presentation_urls_, _))
475 .Times(0);
476 service_impl_->SetDefaultPresentationUrls(presentation_urls_);
477 }
478
462 TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) { 479 TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) {
463 PresentationInfo connection(presentation_url1_, kPresentationId); 480 PresentationInfo connection(presentation_url1_, kPresentationId);
464 PresentationConnectionStateChangedCallback state_changed_cb; 481 PresentationConnectionStateChangedCallback state_changed_cb;
465 // Trigger state change. It should be propagated back up to |mock_client_|. 482 // Trigger state change. It should be propagated back up to |mock_client_|.
466 PresentationInfo presentation_connection(presentation_url1_, kPresentationId); 483 PresentationInfo presentation_connection(presentation_url1_, kPresentationId);
467 484
468 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)) 485 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
469 .WillOnce(SaveArg<3>(&state_changed_cb)); 486 .WillOnce(SaveArg<3>(&state_changed_cb));
470 service_impl_->ListenForConnectionStateChange(connection); 487 service_impl_->ListenForConnectionStateChange(connection);
471 488
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 service_impl.controller_delegate_ = nullptr; 715 service_impl.controller_delegate_ = nullptr;
699 service_impl.SetClient(std::move(client_ptr)); 716 service_impl.SetClient(std::move(client_ptr));
700 717
701 EXPECT_CALL(mock_receiver_delegate_, Reset(_, _)).Times(0); 718 EXPECT_CALL(mock_receiver_delegate_, Reset(_, _)).Times(0);
702 service_impl.Reset(); 719 service_impl.Reset();
703 720
704 EXPECT_CALL(mock_receiver_delegate_, RemoveObserver(_, _)).Times(1); 721 EXPECT_CALL(mock_receiver_delegate_, RemoveObserver(_, _)).Times(1);
705 } 722 }
706 723
707 } // namespace content 724 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/presentation/presentation_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698