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

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

Issue 2471573005: [Presentation API] (5th) (1-UA) integrate controller and receiver side for 1-UA messaging (Closed)
Patch Set: merge with master 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 SendMessageRawPtr(render_process_id, render_frame_id, session, 133 SendMessageRawPtr(render_process_id, render_frame_id, session,
134 message_request.release(), send_message_cb); 134 message_request.release(), send_message_cb);
135 } 135 }
136 MOCK_METHOD4(ListenForConnectionStateChange, 136 MOCK_METHOD4(ListenForConnectionStateChange,
137 void(int render_process_id, 137 void(int render_process_id,
138 int render_frame_id, 138 int render_frame_id,
139 const content::PresentationSessionInfo& connection, 139 const content::PresentationSessionInfo& connection,
140 const content::PresentationConnectionStateChangedCallback& 140 const content::PresentationConnectionStateChangedCallback&
141 state_changed_cb)); 141 state_changed_cb));
142 142
143 void ConnectToOffscreenPresentation( 143 void ConnectToPresentation(
144 int render_process_id, 144 int render_process_id,
145 int render_frame_id, 145 int render_frame_id,
146 const content::PresentationSessionInfo& session, 146 const content::PresentationSessionInfo& session,
147 PresentationConnectionPtr controller_conn_ptr, 147 PresentationConnectionPtr controller_conn_ptr,
148 PresentationConnectionRequest receiver_conn_request) override { 148 PresentationConnectionRequest receiver_conn_request) override {
149 RegisterOffscreenPresentationConnectionRaw( 149 RegisterOffscreenPresentationConnectionRaw(
150 render_process_id, render_frame_id, session, controller_conn_ptr.get()); 150 render_process_id, render_frame_id, session, controller_conn_ptr.get());
151 } 151 }
152 152
153 MOCK_METHOD4(RegisterOffscreenPresentationConnectionRaw, 153 MOCK_METHOD4(RegisterOffscreenPresentationConnectionRaw,
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 base::RunLoop run_loop; 516 base::RunLoop run_loop;
517 EXPECT_CALL(mock_client_, 517 EXPECT_CALL(mock_client_,
518 OnDefaultSessionStarted(SessionInfoEquals(session_info))) 518 OnDefaultSessionStarted(SessionInfoEquals(session_info)))
519 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 519 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
520 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)); 520 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _));
521 callback.Run( 521 callback.Run(
522 content::PresentationSessionInfo(presentation_url2_, kPresentationId)); 522 content::PresentationSessionInfo(presentation_url2_, kPresentationId));
523 run_loop.Run(); 523 run_loop.Run();
524 } 524 }
525 525
526 TEST_F(PresentationServiceImplTest, 526 TEST_F(PresentationServiceImplTest, ListenForConnectionStateChange) {
527 ListenForConnectionStateChange) {
528 content::PresentationSessionInfo connection(presentation_url1_, 527 content::PresentationSessionInfo connection(presentation_url1_,
529 kPresentationId); 528 kPresentationId);
530 content::PresentationConnectionStateChangedCallback state_changed_cb; 529 content::PresentationConnectionStateChangedCallback state_changed_cb;
531 // Trigger state change. It should be propagated back up to |mock_client_|. 530 // Trigger state change. It should be propagated back up to |mock_client_|.
532 content::PresentationSessionInfo presentation_connection(presentation_url1_, 531 content::PresentationSessionInfo presentation_connection(presentation_url1_,
533 kPresentationId); 532 kPresentationId);
534 533
535 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _)) 534 EXPECT_CALL(mock_delegate_, ListenForConnectionStateChange(_, _, _, _))
536 .WillOnce(SaveArg<3>(&state_changed_cb)); 535 .WillOnce(SaveArg<3>(&state_changed_cb));
537 service_impl_->ListenForConnectionStateChange(connection); 536 service_impl_->ListenForConnectionStateChange(connection);
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 mock_delegate_.set_screen_availability_listening_supported(false); 924 mock_delegate_.set_screen_availability_listening_supported(false);
926 base::RunLoop run_loop; 925 base::RunLoop run_loop;
927 EXPECT_CALL(mock_client_, 926 EXPECT_CALL(mock_client_,
928 OnScreenAvailabilityNotSupported(presentation_url1_)) 927 OnScreenAvailabilityNotSupported(presentation_url1_))
929 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); 928 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
930 ListenForScreenAvailabilityAndWait(presentation_url1_, false); 929 ListenForScreenAvailabilityAndWait(presentation_url1_, false);
931 run_loop.Run(); 930 run_loop.Run();
932 } 931 }
933 932
934 } // namespace content 933 } // 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