OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, | 452 Opened(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, |
453 session_id)) | 453 session_id)) |
454 .Times(1); | 454 .Times(1); |
455 message_loop_->RunAllPending(); | 455 message_loop_->RunAllPending(); |
456 | 456 |
457 // Starts a non-opened device. | 457 // Starts a non-opened device. |
458 // This should fail and trigger error code 'kDeviceNotAvailable'. | 458 // This should fail and trigger error code 'kDeviceNotAvailable'. |
459 int invalid_session_id = session_id + 1; | 459 int invalid_session_id = session_id + 1; |
460 manager_->Start(invalid_session_id, audio_input_event_handler.get()); | 460 manager_->Start(invalid_session_id, audio_input_event_handler.get()); |
461 EXPECT_CALL(*audio_input_event_handler, | 461 EXPECT_CALL(*audio_input_event_handler, |
462 DeviceStarted(invalid_session_id, | 462 DeviceStarted(invalid_session_id, std::string())) |
463 AudioInputDeviceManager::kInvalidDeviceId)) | |
464 .Times(1); | 463 .Times(1); |
465 message_loop_->RunAllPending(); | 464 message_loop_->RunAllPending(); |
466 | 465 |
467 manager_->Close(session_id); | 466 manager_->Close(session_id); |
468 EXPECT_CALL(*audio_input_listener_, | 467 EXPECT_CALL(*audio_input_listener_, |
469 Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, | 468 Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, |
470 session_id)) | 469 session_id)) |
471 .Times(1); | 470 .Times(1); |
472 message_loop_->RunAllPending(); | 471 message_loop_->RunAllPending(); |
473 } | 472 } |
(...skipping 24 matching lines...) Expand all Loading... |
498 manager_->Start(session_id, audio_input_event_handler.get()); | 497 manager_->Start(session_id, audio_input_event_handler.get()); |
499 EXPECT_CALL(*audio_input_event_handler, | 498 EXPECT_CALL(*audio_input_event_handler, |
500 DeviceStarted(session_id, | 499 DeviceStarted(session_id, |
501 media::AudioManagerBase::kDefaultDeviceId)) | 500 media::AudioManagerBase::kDefaultDeviceId)) |
502 .Times(1); | 501 .Times(1); |
503 message_loop_->RunAllPending(); | 502 message_loop_->RunAllPending(); |
504 | 503 |
505 // Starts the session for the second time, it should fail. | 504 // Starts the session for the second time, it should fail. |
506 manager_->Start(session_id, audio_input_event_handler.get()); | 505 manager_->Start(session_id, audio_input_event_handler.get()); |
507 EXPECT_CALL(*audio_input_event_handler, | 506 EXPECT_CALL(*audio_input_event_handler, |
508 DeviceStarted(session_id, | 507 DeviceStarted(session_id, std::string())) |
509 AudioInputDeviceManager::kInvalidDeviceId)) | |
510 .Times(1); | 508 .Times(1); |
511 | 509 |
512 manager_->Stop(session_id); | 510 manager_->Stop(session_id); |
513 manager_->Close(session_id); | 511 manager_->Close(session_id); |
514 EXPECT_CALL(*audio_input_listener_, | 512 EXPECT_CALL(*audio_input_listener_, |
515 Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, | 513 Closed(content::MEDIA_STREAM_DEVICE_TYPE_AUDIO_CAPTURE, |
516 session_id)) | 514 session_id)) |
517 .Times(1); | 515 .Times(1); |
518 message_loop_->RunAllPending(); | 516 message_loop_->RunAllPending(); |
519 } | 517 } |
520 | 518 |
521 } // namespace media_stream | 519 } // namespace media_stream |
OLD | NEW |