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

Unified Diff: content/browser/presentation/presentation_service_impl_unittest.cc

Issue 2949053002: [Presentation API] OffscreenPresentationManager should only interact with top level receiver frame (Closed)
Patch Set: add unit test Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/presentation/presentation_service_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/presentation/presentation_service_impl_unittest.cc
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc
index f53b56204953ebf61d208e5db4a32d59bacf0a4a..d691d44df3daa454704abf446ea85357460a80c0 100644
--- a/content/browser/presentation/presentation_service_impl_unittest.cc
+++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -612,14 +612,13 @@ TEST_F(PresentationServiceImplTest, SetPresentationConnection) {
}
TEST_F(PresentationServiceImplTest, ReceiverPresentationServiceDelegate) {
- MockReceiverPresentationServiceDelegate mock_receiver_delegate;
- EXPECT_CALL(mock_receiver_delegate, AddObserver(_, _, _)).Times(1);
+ EXPECT_CALL(mock_receiver_delegate_, AddObserver(_, _, _)).Times(1);
PresentationServiceImpl service_impl(main_rfh(), contents(), nullptr,
- &mock_receiver_delegate);
+ &mock_receiver_delegate_);
ReceiverConnectionAvailableCallback callback;
- EXPECT_CALL(mock_receiver_delegate,
+ EXPECT_CALL(mock_receiver_delegate_,
RegisterReceiverConnectionAvailableCallback(_))
.WillOnce(SaveArg<0>(&callback));
@@ -645,7 +644,32 @@ TEST_F(PresentationServiceImplTest, ReceiverPresentationServiceDelegate) {
mojo::MakeRequest(&receiver_connection));
base::RunLoop().RunUntilIdle();
- EXPECT_CALL(mock_receiver_delegate, RemoveObserver(_, _)).Times(1);
+ EXPECT_CALL(mock_receiver_delegate_, RemoveObserver(_, _)).Times(1);
+}
+
+TEST_F(PresentationServiceImplTest, ReceiverDelegateOnSubFrame) {
+ EXPECT_CALL(mock_receiver_delegate_, AddObserver(_, _, _)).Times(1);
+
+ PresentationServiceImpl service_impl(main_rfh(), contents(), nullptr,
+ &mock_receiver_delegate_);
+ service_impl.is_main_frame_ = false;
+
+ ReceiverConnectionAvailableCallback callback;
+ EXPECT_CALL(mock_receiver_delegate_,
+ RegisterReceiverConnectionAvailableCallback(_))
+ .Times(0);
+
+ blink::mojom::PresentationServiceClientPtr client_ptr;
+ client_binding_.reset(
+ new mojo::Binding<blink::mojom::PresentationServiceClient>(
+ &mock_client_, mojo::MakeRequest(&client_ptr)));
+ service_impl.controller_delegate_ = nullptr;
+ service_impl.SetClient(std::move(client_ptr));
+
+ EXPECT_CALL(mock_receiver_delegate_, Reset(_, _)).Times(0);
+ service_impl.Reset();
+
+ EXPECT_CALL(mock_receiver_delegate_, RemoveObserver(_, _)).Times(1);
}
} // namespace content
« 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