| 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 "content/renderer/media/user_media_client_impl.h" | 5 #include "content/renderer/media/user_media_client_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 state_(REQUEST_NOT_STARTED), | 103 state_(REQUEST_NOT_STARTED), |
| 104 result_(NUM_MEDIA_REQUEST_RESULTS), | 104 result_(NUM_MEDIA_REQUEST_RESULTS), |
| 105 result_name_(""), | 105 result_name_(""), |
| 106 factory_(dependency_factory), | 106 factory_(dependency_factory), |
| 107 create_source_that_fails_(false), | 107 create_source_that_fails_(false), |
| 108 video_source_(NULL) {} | 108 video_source_(NULL) {} |
| 109 | 109 |
| 110 void RequestUserMedia(const blink::WebUserMediaRequest& user_media_request) { | 110 void RequestUserMedia(const blink::WebUserMediaRequest& user_media_request) { |
| 111 state_ = REQUEST_NOT_COMPLETE; | 111 state_ = REQUEST_NOT_COMPLETE; |
| 112 requestUserMedia(user_media_request); | 112 requestUserMedia(user_media_request); |
| 113 base::RunLoop().RunUntilIdle(); |
| 113 } | 114 } |
| 114 | 115 |
| 115 void RequestUserMedia() { | 116 void RequestUserMedia() { |
| 116 blink::WebUserMediaRequest user_media_request; | 117 blink::WebUserMediaRequest user_media_request; |
| 117 RequestUserMedia(user_media_request); | 118 RequestUserMedia(user_media_request); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void RequestMediaDevices() { | 121 void RequestMediaDevices() { |
| 121 blink::WebMediaDevicesRequest media_devices_request; | 122 blink::WebMediaDevicesRequest media_devices_request; |
| 122 state_ = REQUEST_NOT_COMPLETE; | 123 state_ = REQUEST_NOT_COMPLETE; |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 // Now we load a new document in the web frame. If in the above Stop() call, | 714 // Now we load a new document in the web frame. If in the above Stop() call, |
| 714 // UserMediaClientImpl accidentally removed audio track, then video track will | 715 // UserMediaClientImpl accidentally removed audio track, then video track will |
| 715 // be removed again here, which is incorrect. | 716 // be removed again here, which is incorrect. |
| 716 LoadNewDocumentInFrame(); | 717 LoadNewDocumentInFrame(); |
| 717 blink::WebHeap::collectAllGarbageForTesting(); | 718 blink::WebHeap::collectAllGarbageForTesting(); |
| 718 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); | 719 EXPECT_EQ(1, ms_dispatcher_->stop_video_device_counter()); |
| 719 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); | 720 EXPECT_EQ(1, ms_dispatcher_->stop_audio_device_counter()); |
| 720 } | 721 } |
| 721 | 722 |
| 722 } // namespace content | 723 } // namespace content |
| OLD | NEW |