Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "content/browser/presentation/presentation_service_impl.h" | 8 #include "content/browser/presentation/presentation_service_impl.h" |
| 9 #include "content/public/browser/presentation_service_delegate.h" | 9 #include "content/public/browser/presentation_service_delegate.h" |
| 10 #include "content/public/browser/presentation_session.h" | |
| 10 #include "content/test/test_render_frame_host.h" | 11 #include "content/test/test_render_frame_host.h" |
| 11 #include "content/test/test_render_view_host.h" | 12 #include "content/test/test_render_view_host.h" |
| 12 #include "content/test/test_web_contents.h" | 13 #include "content/test/test_web_contents.h" |
| 13 #include "mojo/public/cpp/bindings/interface_ptr.h" | 14 #include "mojo/public/cpp/bindings/interface_ptr.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 15 | 16 |
| 16 using ::testing::_; | 17 using ::testing::_; |
| 17 using ::testing::Eq; | 18 using ::testing::Eq; |
| 18 using ::testing::InvokeWithoutArgs; | 19 using ::testing::InvokeWithoutArgs; |
| 19 using ::testing::Mock; | 20 using ::testing::Mock; |
| 20 using ::testing::Return; | 21 using ::testing::Return; |
| 22 using ::testing::SaveArg; | |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| 23 | 25 |
| 24 class MockPresentationServiceDelegate : public PresentationServiceDelegate { | 26 class MockPresentationServiceDelegate : public PresentationServiceDelegate { |
| 25 public: | 27 public: |
| 26 MOCK_METHOD1(AddObserver, | 28 MOCK_METHOD1(AddObserver, |
| 27 void(PresentationServiceDelegate::Observer* observer)); | 29 void(PresentationServiceDelegate::Observer* observer)); |
| 28 MOCK_METHOD1(RemoveObserver, | 30 MOCK_METHOD1(RemoveObserver, |
| 29 void(PresentationServiceDelegate::Observer* observer)); | 31 void(PresentationServiceDelegate::Observer* observer)); |
| 30 MOCK_METHOD3(AddScreenAvailabilityListener, | 32 MOCK_METHOD3(AddScreenAvailabilityListener, |
| 31 bool( | 33 bool( |
| 32 int render_process_id, | 34 int render_process_id, |
| 33 int routing_id, | 35 int routing_id, |
| 34 PresentationScreenAvailabilityListener* listener)); | 36 PresentationScreenAvailabilityListener* listener)); |
| 35 MOCK_METHOD3(RemoveScreenAvailabilityListener, | 37 MOCK_METHOD3(RemoveScreenAvailabilityListener, |
| 36 void( | 38 void( |
| 37 int render_process_id, | 39 int render_process_id, |
| 38 int routing_id, | 40 int routing_id, |
| 39 PresentationScreenAvailabilityListener* listener)); | 41 PresentationScreenAvailabilityListener* listener)); |
| 40 MOCK_METHOD2(RemoveAllScreenAvailabilityListeners, | 42 MOCK_METHOD2(RemoveAllScreenAvailabilityListeners, |
| 41 void( | 43 void( |
| 42 int render_process_id, | 44 int render_process_id, |
| 43 int routing_id)); | 45 int routing_id)); |
| 46 MOCK_METHOD3(SetDefaultPresentationUrl, | |
| 47 void( | |
| 48 int render_process_id, | |
| 49 int routing_id, | |
| 50 const std::string& default_presentation_url)); | |
| 51 MOCK_METHOD6(StartSession, | |
| 52 void( | |
| 53 int render_process_id, | |
| 54 int render_frame_id, | |
| 55 const std::string& presentation_url, | |
| 56 const std::string& presentation_id, | |
| 57 const PresentationSessionSuccessCallback& success_cb, | |
| 58 const PresentationSessionErrorCallback& error_cb)); | |
| 59 MOCK_METHOD6(JoinSession, | |
| 60 void( | |
| 61 int render_process_id, | |
| 62 int render_frame_id, | |
| 63 const std::string& presentation_url, | |
| 64 const std::string& presentation_id, | |
| 65 const PresentationSessionSuccessCallback& success_cb, | |
| 66 const PresentationSessionErrorCallback& error_cb)); | |
| 44 }; | 67 }; |
| 45 | 68 |
| 46 class PresentationServiceImplTest : public RenderViewHostImplTestHarness { | 69 class PresentationServiceImplTest : public RenderViewHostImplTestHarness { |
| 47 public: | 70 public: |
| 48 PresentationServiceImplTest() : callback_count_(0) {} | 71 PresentationServiceImplTest() : callback_count_(0) {} |
| 49 | 72 |
| 50 void SetUp() override { | 73 void SetUp() override { |
| 51 RenderViewHostImplTestHarness::SetUp(); | 74 RenderViewHostImplTestHarness::SetUp(); |
| 52 | 75 |
| 53 EXPECT_CALL(mock_delegate_, AddObserver(_)).Times(1); | 76 EXPECT_CALL(mock_delegate_, AddObserver(_)).Times(1); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 109 |
| 87 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_delegate_)); | 110 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_delegate_)); |
| 88 } | 111 } |
| 89 | 112 |
| 90 void ExpectListenerDoesNotExist(const std::string& presentation_url) { | 113 void ExpectListenerDoesNotExist(const std::string& presentation_url) { |
| 91 const auto& contexts = service_impl_->availability_contexts_; | 114 const auto& contexts = service_impl_->availability_contexts_; |
| 92 auto it = contexts.find(presentation_url); | 115 auto it = contexts.find(presentation_url); |
| 93 EXPECT_TRUE(it == contexts.end()); | 116 EXPECT_TRUE(it == contexts.end()); |
| 94 } | 117 } |
| 95 | 118 |
| 119 void RunLoopUntilIdle() { | |
| 120 base::RunLoop().RunUntilIdle(); | |
| 121 } | |
| 122 | |
| 96 void RunLoopFor(base::TimeDelta duration) { | 123 void RunLoopFor(base::TimeDelta duration) { |
| 97 base::RunLoop run_loop; | 124 base::RunLoop run_loop; |
| 98 base::MessageLoop::current()->PostDelayedTask( | 125 base::MessageLoop::current()->PostDelayedTask( |
| 99 FROM_HERE, run_loop.QuitClosure(), duration); | 126 FROM_HERE, run_loop.QuitClosure(), duration); |
| 100 run_loop.Run(); | 127 run_loop.Run(); |
| 101 } | 128 } |
| 102 | 129 |
| 103 void SaveQuitClosureAndRunLoop() { | 130 void SaveQuitClosureAndRunLoop() { |
| 104 base::RunLoop run_loop; | 131 base::RunLoop run_loop; |
| 105 run_loop_quit_closure_ = run_loop.QuitClosure(); | 132 run_loop_quit_closure_ = run_loop.QuitClosure(); |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 119 it->second->OnScreenAvailabilityChanged(available); | 146 it->second->OnScreenAvailabilityChanged(available); |
| 120 } | 147 } |
| 121 | 148 |
| 122 void ScreenAvailabilityChangedCallback(bool expected, bool available) { | 149 void ScreenAvailabilityChangedCallback(bool expected, bool available) { |
| 123 ++callback_count_; | 150 ++callback_count_; |
| 124 EXPECT_EQ(expected, available); | 151 EXPECT_EQ(expected, available); |
| 125 if (!run_loop_quit_closure_.is_null()) | 152 if (!run_loop_quit_closure_.is_null()) |
| 126 run_loop_quit_closure_.Run(); | 153 run_loop_quit_closure_.Run(); |
| 127 } | 154 } |
| 128 | 155 |
| 156 void ExpectReset() { | |
| 157 EXPECT_CALL(mock_delegate_, RemoveAllScreenAvailabilityListeners(_, _)) | |
| 158 .Times(1); | |
| 159 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrl(_, _, Eq(""))) | |
| 160 .Times(1); | |
| 161 } | |
| 162 | |
| 163 void ExpectNewSessionMojoCallbackSuccess( | |
| 164 presentation::PresentationSessionInfoPtr info, | |
| 165 presentation::PresentationErrorPtr error) { | |
| 166 EXPECT_FALSE(info.is_null()); | |
| 167 EXPECT_TRUE(error.is_null()); | |
| 168 if (!run_loop_quit_closure_.is_null()) | |
| 169 run_loop_quit_closure_.Run(); | |
| 170 } | |
| 171 | |
| 172 void ExpectNewSessionMojoCallbackError( | |
| 173 presentation::PresentationSessionInfoPtr info, | |
| 174 presentation::PresentationErrorPtr error) { | |
| 175 EXPECT_TRUE(info.is_null()); | |
| 176 EXPECT_FALSE(error.is_null()); | |
| 177 if (!run_loop_quit_closure_.is_null()) | |
| 178 run_loop_quit_closure_.Run(); | |
| 179 } | |
| 180 | |
| 129 MockPresentationServiceDelegate mock_delegate_; | 181 MockPresentationServiceDelegate mock_delegate_; |
| 130 scoped_ptr<PresentationServiceImpl> service_impl_; | 182 scoped_ptr<PresentationServiceImpl> service_impl_; |
| 131 mojo::InterfacePtr<presentation::PresentationService> service_ptr_; | 183 mojo::InterfacePtr<presentation::PresentationService> service_ptr_; |
| 132 base::Closure run_loop_quit_closure_; | 184 base::Closure run_loop_quit_closure_; |
| 133 int callback_count_; | 185 int callback_count_; |
| 134 }; | 186 }; |
| 135 | 187 |
| 136 TEST_F(PresentationServiceImplTest, GetScreenAvailability) { | 188 TEST_F(PresentationServiceImplTest, GetScreenAvailability) { |
| 137 std::string presentation_url("http://fooUrl"); | 189 std::string presentation_url("http://fooUrl"); |
| 138 GetScreenAvailabilityAndWait( | 190 GetScreenAvailabilityAndWait( |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 163 service_ptr_->GetScreenAvailability( | 215 service_ptr_->GetScreenAvailability( |
| 164 presentation_url, | 216 presentation_url, |
| 165 base::Bind( | 217 base::Bind( |
| 166 &PresentationServiceImplTest::ScreenAvailabilityChangedCallback, | 218 &PresentationServiceImplTest::ScreenAvailabilityChangedCallback, |
| 167 base::Unretained(this), | 219 base::Unretained(this), |
| 168 false)); | 220 false)); |
| 169 SaveQuitClosureAndRunLoop(); | 221 SaveQuitClosureAndRunLoop(); |
| 170 EXPECT_EQ(2, callback_count_); | 222 EXPECT_EQ(2, callback_count_); |
| 171 } | 223 } |
| 172 | 224 |
| 173 TEST_F(PresentationServiceImplTest, RemoveAllListeners) { | 225 TEST_F(PresentationServiceImplTest, Reset) { |
| 174 std::string presentation_url("http://fooUrl"); | 226 std::string presentation_url("http://fooUrl"); |
| 175 GetScreenAvailabilityAndWait( | 227 GetScreenAvailabilityAndWait( |
| 176 presentation_url, | 228 presentation_url, |
| 177 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, | 229 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, |
| 178 base::Unretained(this)), | 230 base::Unretained(this)), |
| 179 true); | 231 true); |
| 180 | 232 |
| 181 service_impl_->RemoveAllListeners(); | 233 ExpectReset(); |
| 234 service_impl_->Reset(); | |
| 182 | 235 |
| 183 ExpectListenerDoesNotExist(presentation_url); | 236 ExpectListenerDoesNotExist(presentation_url); |
| 184 | 237 |
| 185 EXPECT_EQ(0, callback_count_); | 238 EXPECT_EQ(0, callback_count_); |
| 186 } | 239 } |
| 187 | 240 |
| 188 TEST_F(PresentationServiceImplTest, DidNavigateThisFrame) { | 241 TEST_F(PresentationServiceImplTest, DidNavigateThisFrame) { |
| 189 std::string presentation_url("http://fooUrl"); | 242 std::string presentation_url("http://fooUrl"); |
| 190 GetScreenAvailabilityAndWait( | 243 GetScreenAvailabilityAndWait( |
| 191 presentation_url, | 244 presentation_url, |
| 192 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, | 245 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, |
| 193 base::Unretained(this)), | 246 base::Unretained(this)), |
| 194 true); | 247 true); |
| 195 | 248 |
| 249 ExpectReset(); | |
| 196 service_impl_->DidNavigateAnyFrame( | 250 service_impl_->DidNavigateAnyFrame( |
| 197 contents()->GetMainFrame(), | 251 contents()->GetMainFrame(), |
| 198 content::LoadCommittedDetails(), | 252 content::LoadCommittedDetails(), |
| 199 content::FrameNavigateParams()); | 253 content::FrameNavigateParams()); |
| 200 | 254 |
| 201 ExpectListenerDoesNotExist(presentation_url); | 255 ExpectListenerDoesNotExist(presentation_url); |
| 202 } | 256 } |
| 203 | 257 |
| 204 TEST_F(PresentationServiceImplTest, DidNavigateNotThisFrame) { | 258 TEST_F(PresentationServiceImplTest, DidNavigateNotThisFrame) { |
| 205 std::string presentation_url("http://fooUrl"); | 259 std::string presentation_url("http://fooUrl"); |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 225 } | 279 } |
| 226 | 280 |
| 227 TEST_F(PresentationServiceImplTest, ThisRenderFrameDeleted) { | 281 TEST_F(PresentationServiceImplTest, ThisRenderFrameDeleted) { |
| 228 std::string presentation_url("http://fooUrl"); | 282 std::string presentation_url("http://fooUrl"); |
| 229 GetScreenAvailabilityAndWait( | 283 GetScreenAvailabilityAndWait( |
| 230 presentation_url, | 284 presentation_url, |
| 231 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, | 285 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, |
| 232 base::Unretained(this)), | 286 base::Unretained(this)), |
| 233 true); | 287 true); |
| 234 | 288 |
| 289 ExpectReset(); | |
| 235 service_impl_->RenderFrameDeleted(contents()->GetMainFrame()); | 290 service_impl_->RenderFrameDeleted(contents()->GetMainFrame()); |
| 236 | 291 |
| 237 ExpectListenerDoesNotExist(presentation_url); | 292 ExpectListenerDoesNotExist(presentation_url); |
| 238 } | 293 } |
| 239 | 294 |
| 240 TEST_F(PresentationServiceImplTest, NotThisRenderFrameDeleted) { | 295 TEST_F(PresentationServiceImplTest, NotThisRenderFrameDeleted) { |
| 241 std::string presentation_url("http://fooUrl"); | 296 std::string presentation_url("http://fooUrl"); |
| 242 GetScreenAvailabilityAndWait( | 297 GetScreenAvailabilityAndWait( |
| 243 presentation_url, | 298 presentation_url, |
| 244 base::Bind( | 299 base::Bind( |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 289 std::string presentation_url("http://fooUrl"); | 344 std::string presentation_url("http://fooUrl"); |
| 290 GetScreenAvailabilityAndWait( | 345 GetScreenAvailabilityAndWait( |
| 291 presentation_url, | 346 presentation_url, |
| 292 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, | 347 base::Bind(&PresentationServiceImplTest::ShouldNotBeCalled, |
| 293 base::Unretained(this)), | 348 base::Unretained(this)), |
| 294 false); | 349 false); |
| 295 | 350 |
| 296 ExpectListenerDoesNotExist(presentation_url); | 351 ExpectListenerDoesNotExist(presentation_url); |
| 297 } | 352 } |
| 298 | 353 |
| 354 TEST_F(PresentationServiceImplTest, SetDefaultPresentationUrl) { | |
| 355 std::string url1("http://fooUrl"); | |
| 356 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrl(_, _, Eq(url1))) | |
| 357 .Times(1); | |
| 358 service_impl_->SetDefaultPresentationUrl(url1); | |
| 359 | |
| 360 std::string url2("http://barUrl"); | |
| 361 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrl(_, _, Eq(url2))) | |
| 362 .Times(1); | |
| 363 service_impl_->SetDefaultPresentationUrl(url2); | |
| 364 } | |
| 365 | |
| 366 TEST_F(PresentationServiceImplTest, SetSameDefaultPresentationUrl) { | |
| 367 std::string url("http://fooUrl"); | |
| 368 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrl(_, _, Eq(url))) | |
| 369 .Times(1); | |
| 370 service_impl_->SetDefaultPresentationUrl(url); | |
| 371 EXPECT_TRUE(Mock::VerifyAndClearExpectations(&mock_delegate_)); | |
|
whywhat
2015/03/10 17:05:04
Shouldn't this be called (or even not called) afte
imcheng
2015/03/10 18:31:15
Of course, I added that after the second call.
| |
| 372 | |
| 373 // Same URL as before; no-ops. | |
| 374 service_impl_->SetDefaultPresentationUrl(url); | |
| 375 } | |
| 376 | |
| 377 TEST_F(PresentationServiceImplTest, ClearDefaultPresentationUrl) { | |
| 378 std::string url("http://fooUrl"); | |
| 379 EXPECT_CALL(mock_delegate_, SetDefaultPresentationUrl(_, _, Eq(url))) | |
|
whywhat
2015/03/10 17:05:04
I don't think you need this EXPECT_CALL here - you
imcheng
2015/03/10 18:31:16
I need the EXPECT_CALL to satisfy the mock. Otherw
| |
| 380 .Times(1); | |
| 381 service_impl_->SetDefaultPresentationUrl(url); | |
| 382 | |
| 383 // Same URL as before; no-ops. | |
|
whywhat
2015/03/10 17:05:05
The comment seems to be irrelevant to the actual t
imcheng
2015/03/10 18:31:16
Removed.
| |
| 384 EXPECT_CALL( | |
| 385 mock_delegate_, | |
| 386 SetDefaultPresentationUrl(_, _, Eq(std::string()))) | |
| 387 .Times(1); | |
|
whywhat
2015/03/10 17:05:05
The test doesn't show there's any difference betwe
imcheng
2015/03/10 18:31:16
How about checking default_presentation_url_ field
whywhat
2015/03/10 23:20:23
Hm, in the non-empty case, the default_presentatio
imcheng
2015/03/12 20:03:40
Ok, I will add the assertions that you mentioned.
| |
| 388 service_impl_->SetDefaultPresentationUrl(std::string()); | |
| 389 } | |
| 390 | |
| 391 TEST_F(PresentationServiceImplTest, StartSessionSuccess) { | |
| 392 std::string presentation_url("http://fooUrl"); | |
| 393 std::string presentation_id("presentationId"); | |
| 394 service_ptr_->StartSession( | |
| 395 presentation_url, | |
| 396 presentation_id, | |
| 397 base::Bind( | |
| 398 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackSuccess, | |
| 399 base::Unretained(this))); | |
| 400 base::Callback<void(const PresentationSessionInfo&)> success_cb; | |
| 401 EXPECT_CALL(mock_delegate_, StartSession( | |
| 402 _, _, Eq(presentation_url), Eq(presentation_id), _, _)) | |
| 403 .WillOnce(SaveArg<4>(&success_cb)); | |
|
whywhat
2015/03/10 17:05:04
Could you use InvokeArgument<4> here instead?
imcheng
2015/03/10 18:31:16
I tried this and unfortunately it does not work. I
whywhat
2015/03/10 23:20:23
I think you should leave it as it is then. Sorry m
imcheng
2015/03/12 20:03:41
Acknowledged.
| |
| 404 RunLoopUntilIdle(); | |
| 405 success_cb.Run(PresentationSessionInfo(presentation_url, presentation_id)); | |
| 406 SaveQuitClosureAndRunLoop(); | |
| 407 } | |
| 408 | |
| 409 TEST_F(PresentationServiceImplTest, StartSessionError) { | |
| 410 std::string presentation_url("http://fooUrl"); | |
| 411 std::string presentation_id("presentationId"); | |
| 412 service_ptr_->StartSession( | |
| 413 presentation_url, | |
| 414 presentation_id, | |
| 415 base::Bind( | |
| 416 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, | |
| 417 base::Unretained(this))); | |
| 418 base::Callback<void(const PresentationError&)> error_cb; | |
| 419 EXPECT_CALL(mock_delegate_, StartSession( | |
| 420 _, _, Eq(presentation_url), Eq(presentation_id), _, _)) | |
| 421 .WillOnce(SaveArg<5>(&error_cb)); | |
| 422 RunLoopUntilIdle(); | |
| 423 error_cb.Run(PresentationError(PRESENTATION_ERROR_UNKNOWN, "Error message")); | |
| 424 SaveQuitClosureAndRunLoop(); | |
| 425 } | |
| 426 | |
| 427 TEST_F(PresentationServiceImplTest, JoinSessionSuccess) { | |
| 428 std::string presentation_url("http://fooUrl"); | |
| 429 std::string presentation_id("presentationId"); | |
| 430 service_ptr_->JoinSession( | |
| 431 presentation_url, | |
| 432 presentation_id, | |
| 433 base::Bind( | |
| 434 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackSuccess, | |
| 435 base::Unretained(this))); | |
| 436 base::Callback<void(const PresentationSessionInfo&)> success_cb; | |
| 437 EXPECT_CALL(mock_delegate_, JoinSession( | |
| 438 _, _, Eq(presentation_url), Eq(presentation_id), _, _)) | |
| 439 .WillOnce(SaveArg<4>(&success_cb)); | |
| 440 RunLoopUntilIdle(); | |
| 441 success_cb.Run(PresentationSessionInfo(presentation_url, presentation_id)); | |
| 442 SaveQuitClosureAndRunLoop(); | |
| 443 } | |
| 444 | |
| 445 TEST_F(PresentationServiceImplTest, JoinSessionError) { | |
| 446 std::string presentation_url("http://fooUrl"); | |
| 447 std::string presentation_id("presentationId"); | |
| 448 service_ptr_->JoinSession( | |
| 449 presentation_url, | |
| 450 presentation_id, | |
| 451 base::Bind( | |
| 452 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackError, | |
| 453 base::Unretained(this))); | |
| 454 base::Callback<void(const PresentationError&)> error_cb; | |
| 455 EXPECT_CALL(mock_delegate_, JoinSession( | |
| 456 _, _, Eq(presentation_url), Eq(presentation_id), _, _)) | |
| 457 .WillOnce(SaveArg<5>(&error_cb)); | |
| 458 RunLoopUntilIdle(); | |
| 459 error_cb.Run(PresentationError(PRESENTATION_ERROR_UNKNOWN, "Error message")); | |
| 460 SaveQuitClosureAndRunLoop(); | |
| 461 } | |
| 462 | |
| 463 TEST_F(PresentationServiceImplTest, StartSessionInProgress) { | |
|
whywhat
2015/03/10 17:05:04
Perhaps add the same test case for JoinSession aft
imcheng
2015/03/10 18:31:16
I can add a test for multiple join sessions in pro
| |
| 464 std::string presentation_url("http://fooUrl"); | |
| 465 std::string presentation_id("presentationId"); | |
| 466 service_ptr_->StartSession( | |
| 467 presentation_url, | |
| 468 presentation_id, | |
| 469 base::Bind( | |
| 470 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackSuccess, | |
| 471 base::Unretained(this))); | |
| 472 service_ptr_->StartSession( | |
| 473 presentation_url, | |
| 474 presentation_id, | |
| 475 base::Bind( | |
| 476 &PresentationServiceImplTest::ExpectNewSessionMojoCallbackSuccess, | |
| 477 base::Unretained(this))); | |
| 478 EXPECT_CALL(mock_delegate_, StartSession( | |
| 479 _, _, Eq(presentation_url), Eq(presentation_id), _, _)) | |
| 480 .Times(1); | |
| 481 RunLoopUntilIdle(); | |
| 482 } | |
| 483 | |
| 299 } // namespace content | 484 } // namespace content |
| OLD | NEW |