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

Unified Diff: components/test_runner/mock_web_user_media_client.cc

Issue 2481263004: Revert of Remove MediaStreamTrack.getSources(). (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/test_runner/mock_web_user_media_client.h ('k') | content/renderer/media/media_stream_center.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/mock_web_user_media_client.cc
diff --git a/components/test_runner/mock_web_user_media_client.cc b/components/test_runner/mock_web_user_media_client.cc
index 3eace861e01485854accfc885643644b0eeed7f9..bc4e1bba4f93de639cfd361ce42ddbd23213900f 100644
--- a/components/test_runner/mock_web_user_media_client.cc
+++ b/components/test_runner/mock_web_user_media_client.cc
@@ -16,6 +16,8 @@
#include "third_party/WebKit/public/platform/WebMediaStream.h"
#include "third_party/WebKit/public/platform/WebMediaStreamSource.h"
#include "third_party/WebKit/public/platform/WebMediaStreamTrack.h"
+#include "third_party/WebKit/public/platform/WebMediaStreamTrackSourcesRequest.h"
+#include "third_party/WebKit/public/platform/WebSourceInfo.h"
#include "third_party/WebKit/public/platform/WebVector.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebMediaDevicesRequest.h"
@@ -27,6 +29,8 @@
using blink::WebMediaStream;
using blink::WebMediaStreamSource;
using blink::WebMediaStreamTrack;
+using blink::WebMediaStreamTrackSourcesRequest;
+using blink::WebSourceInfo;
using blink::WebString;
using blink::WebUserMediaRequest;
using blink::WebVector;
@@ -147,6 +151,41 @@
media_device_change_observer_.didChangeMediaDevices();
}
+void MockWebUserMediaClient::requestSources(
+ const blink::WebMediaStreamTrackSourcesRequest& request) {
+ struct {
+ const char* id;
+ WebSourceInfo::SourceKind kind;
+ const char* label;
+ WebSourceInfo::VideoFacingMode facing;
+ } test_sources[] = {
+ {
+ "device1",
+ WebSourceInfo::SourceKindAudio,
+ "Built-in microphone",
+ WebSourceInfo::VideoFacingModeNone,
+ },
+ {
+ "device2",
+ WebSourceInfo::SourceKindVideo,
+ "Build-in webcam",
+ WebSourceInfo::VideoFacingModeEnvironment,
+ },
+ };
+
+ WebVector<WebSourceInfo> sources(arraysize(test_sources));
+ for (size_t i = 0; i < arraysize(test_sources); ++i) {
+ sources[i].initialize(WebString::fromUTF8(test_sources[i].id),
+ test_sources[i].kind,
+ WebString::fromUTF8(test_sources[i].label),
+ test_sources[i].facing);
+ }
+
+ delegate_->PostTask(base::Bind(
+ &WebMediaStreamTrackSourcesRequest::requestSucceeded,
+ base::Owned(new WebMediaStreamTrackSourcesRequest(request)), sources));
+}
+
void MockWebUserMediaClient::setMediaDeviceChangeObserver(
const blink::WebMediaDeviceChangeObserver& observer) {
media_device_change_observer_ = observer;
« no previous file with comments | « components/test_runner/mock_web_user_media_client.h ('k') | content/renderer/media/media_stream_center.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698