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

Side by Side Diff: content/browser/presentation/presentation_service_impl_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 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 <memory> 10 #include <memory>
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SendMessageRawPtr(render_process_id, render_frame_id, session, 132 SendMessageRawPtr(render_process_id, render_frame_id, session,
133 message_request.release(), send_message_cb); 133 message_request.release(), send_message_cb);
134 } 134 }
135 MOCK_METHOD4(ListenForConnectionStateChange, 135 MOCK_METHOD4(ListenForConnectionStateChange,
136 void(int render_process_id, 136 void(int render_process_id,
137 int render_frame_id, 137 int render_frame_id,
138 const content::PresentationSessionInfo& connection, 138 const content::PresentationSessionInfo& connection,
139 const content::PresentationConnectionStateChangedCallback& 139 const content::PresentationConnectionStateChangedCallback&
140 state_changed_cb)); 140 state_changed_cb));
141 141
142 void ConnectToPresentation( 142 void ConnectToOffscreenPresentation(
143 int render_process_id, 143 int render_process_id,
144 int render_frame_id, 144 int render_frame_id,
145 const content::PresentationSessionInfo& session, 145 const content::PresentationSessionInfo& session,
146 PresentationConnectionPtr controller_conn_ptr, 146 PresentationConnectionPtr controller_conn_ptr,
147 PresentationConnectionRequest receiver_conn_request) override { 147 PresentationConnectionRequest receiver_conn_request) override {
148 RegisterOffscreenPresentationConnectionRaw( 148 RegisterOffscreenPresentationConnectionRaw(
149 render_process_id, render_frame_id, session, controller_conn_ptr.get()); 149 render_process_id, render_frame_id, session, controller_conn_ptr.get());
150 } 150 }
151 151
152 MOCK_METHOD4(RegisterOffscreenPresentationConnectionRaw, 152 MOCK_METHOD4(RegisterOffscreenPresentationConnectionRaw,
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 base::RunLoop run_loop; 507 base::RunLoop run_loop;
508 EXPECT_CALL(mock_client_, 508 EXPECT_CALL(mock_client_,
509 OnDefaultSessionStarted(SessionInfoEquals(session_info))) 509 OnDefaultSessionStarted(SessionInfoEquals(session_info)))
510 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 510 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
511 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)); 511 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _));
512 callback.Run( 512 callback.Run(
513 content::PresentationSessionInfo(presentation_url2_, kPresentationId)); 513 content::PresentationSessionInfo(presentation_url2_, kPresentationId));
514 run_loop.Run(); 514 run_loop.Run();
515 } 515 }
516 516
517 TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) { 517 TEST_F(PresentationServiceImplTest,
518 ListenForConnectionStateChange) {
518 content::PresentationSessionInfo connection(presentation_url1_, 519 content::PresentationSessionInfo connection(presentation_url1_,
519 kPresentationId); 520 kPresentationId);
520 content::PresentationConnectionStateChangedCallback state_changed_cb; 521 content::PresentationConnectionStateChangedCallback state_changed_cb;
521 // Trigger state change. It should be propagated back up to |mock_client_|. 522 // Trigger state change. It should be propagated back up to |mock_client_|.
522 content::PresentationSessionInfo presentation_connection(presentation_url1_, 523 content::PresentationSessionInfo presentation_connection(presentation_url1_,
523 kPresentationId); 524 kPresentationId);
524 525
525 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)) 526 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
526 .WillOnce(SaveArg<3>(&state_changed_cb)); 527 .WillOnce(SaveArg<3>(&state_changed_cb));
527 service_impl_->ListenForConnectionStateChange(connection); 528 service_impl_->ListenForConnectionStateChange(connection);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
915 mock_delegate_.set_screen_availability_listening_supported(false); 916 mock_delegate_.set_screen_availability_listening_supported(false);
916 base::RunLoop run_loop; 917 base::RunLoop run_loop;
917 EXPECT_CALL(mock_client_, 918 EXPECT_CALL(mock_client_,
918 OnScreenAvailabilityNotSupported(presentation_url1_)) 919 OnScreenAvailabilityNotSupported(presentation_url1_))
919 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 920 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
920 ListenForScreenAvailabilityAndWait(presentation_url1_, false); 921 ListenForScreenAvailabilityAndWait(presentation_url1_, false);
921 run_loop.Run(); 922 run_loop.Run();
922 } 923 }
923 924
924 } // namespace content 925 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/presentation/presentation_service_impl.cc ('k') | content/public/browser/presentation_service_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698