| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0); | 382 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0); |
| 383 std::string label = media_stream_manager_->EnumerateDevices( | 383 std::string label = media_stream_manager_->EnumerateDevices( |
| 384 &requester, render_process_id, render_frame_id, kMockSalt, | 384 &requester, render_process_id, render_frame_id, kMockSalt, |
| 385 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); | 385 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); |
| 386 run_loop_enumeration.Run(); | 386 run_loop_enumeration.Run(); |
| 387 media_stream_manager_->CancelRequest(label); | 387 media_stream_manager_->CancelRequest(label); |
| 388 | 388 |
| 389 // Simulate device change | 389 // Simulate device change |
| 390 EXPECT_CALL(requester, MockDevicesChanged(_)); | 390 EXPECT_CALL(requester, MockDevicesChanged(_)); |
| 391 audio_manager_->SetNumAudioInputDevices(3); | 391 audio_manager_->SetNumAudioInputDevices(3); |
| 392 media_stream_manager_->OnDevicesChanged( | 392 media_stream_manager_->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO); |
| 393 base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); | |
| 394 run_loop_device_change.Run(); | 393 run_loop_device_change.Run(); |
| 395 } | 394 } |
| 396 | 395 |
| 397 // Check that bogus device changes where devices have not changed | 396 // Check that bogus device changes where devices have not changed |
| 398 // do not trigger a notification. | 397 // do not trigger a notification. |
| 399 { | 398 { |
| 400 base::RunLoop run_loop; | 399 base::RunLoop run_loop; |
| 401 MockMediaStreamRequester requester(media_stream_manager_.get(), &run_loop, | 400 MockMediaStreamRequester requester(media_stream_manager_.get(), &run_loop, |
| 402 4, &run_loop); | 401 4, &run_loop); |
| 403 requester.SubscribeToDeviceChangeNotifications(); | 402 requester.SubscribeToDeviceChangeNotifications(); |
| 404 | 403 |
| 405 // Bogus OnDeviceChange, as devices have not changed. Should not trigger | 404 // Bogus OnDeviceChange, as devices have not changed. Should not trigger |
| 406 // notification. | 405 // notification. |
| 407 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0); | 406 EXPECT_CALL(requester, MockDevicesChanged(_)).Times(0); |
| 408 media_stream_manager_->OnDevicesChanged( | 407 media_stream_manager_->OnDevicesChanged(base::SystemMonitor::DEVTYPE_AUDIO); |
| 409 base::SystemMonitor::DEVTYPE_AUDIO_CAPTURE); | |
| 410 | 408 |
| 411 // Do enumeration to be able to quit the RunLoop. | 409 // Do enumeration to be able to quit the RunLoop. |
| 412 EXPECT_CALL(requester, | 410 EXPECT_CALL(requester, |
| 413 MockDevicesEnumerated(render_frame_id, page_request_id, _, _)); | 411 MockDevicesEnumerated(render_frame_id, page_request_id, _, _)); |
| 414 std::string label = media_stream_manager_->EnumerateDevices( | 412 std::string label = media_stream_manager_->EnumerateDevices( |
| 415 &requester, render_process_id, render_frame_id, kMockSalt, | 413 &requester, render_process_id, render_frame_id, kMockSalt, |
| 416 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); | 414 page_request_id, MEDIA_DEVICE_AUDIO_CAPTURE, security_origin); |
| 417 run_loop.Run(); | 415 run_loop.Run(); |
| 418 media_stream_manager_->CancelRequest(label); | 416 media_stream_manager_->CancelRequest(label); |
| 419 } | 417 } |
| 420 } | 418 } |
| 421 | 419 |
| 422 } // namespace content | 420 } // namespace content |
| OLD | NEW |