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

Unified Diff: content/shell/renderer/test_runner/mock_web_user_media_client.cc

Issue 564423002: Update MockWebUserMediaClient for requestSources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months 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
Index: content/shell/renderer/test_runner/mock_web_user_media_client.cc
diff --git a/content/shell/renderer/test_runner/mock_web_user_media_client.cc b/content/shell/renderer/test_runner/mock_web_user_media_client.cc
index 10cc4de1aa0495eafe61e8bcbf1aed769e8a096d..82c207121b74a1516177cc8ca24ff1aa499a2052 100644
--- a/content/shell/renderer/test_runner/mock_web_user_media_client.cc
+++ b/content/shell/renderer/test_runner/mock_web_user_media_client.cc
@@ -12,6 +12,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"
@@ -24,6 +26,8 @@ using blink::WebMediaDevicesRequest;
using blink::WebMediaStream;
using blink::WebMediaStreamSource;
using blink::WebMediaStreamTrack;
+using blink::WebMediaStreamTrackSourcesRequest;
+using blink::WebSourceInfo;
using blink::WebString;
using blink::WebUserMediaRequest;
using blink::WebVector;
@@ -97,6 +101,22 @@ class MediaDevicesRequestTask : public WebMethodTask<MockWebUserMediaClient> {
WebVector<WebMediaDeviceInfo> result_;
};
+class SourcesRequestTask : public WebMethodTask<MockWebUserMediaClient> {
+ public:
+ SourcesRequestTask(MockWebUserMediaClient* object,
+ const WebMediaStreamTrackSourcesRequest& request,
+ const WebVector<WebSourceInfo>& result)
+ : WebMethodTask<MockWebUserMediaClient>(object),
+ request_(request),
+ result_(result) {}
+
+ virtual void RunIfValid() OVERRIDE { request_.requestSucceeded(result_); }
+
+ private:
+ WebMediaStreamTrackSourcesRequest request_;
+ WebVector<WebSourceInfo> result_;
+};
jochen (gone - plz use gerrit) 2014/09/16 14:19:14 nit. disallow_copy_and_assign
Henrik Grunell 2014/09/16 15:18:48 Done.
+
class MockExtraData : public WebMediaStream::ExtraData {
public:
int foo;
@@ -190,4 +210,21 @@ void MockWebUserMediaClient::cancelMediaDevicesRequest(
const WebMediaDevicesRequest&) {
}
+void MockWebUserMediaClient::requestSources(
+ const blink::WebMediaStreamTrackSourcesRequest& request) {
+ const size_t size = 2;
Mike West 2014/09/16 12:56:09 I see that other bits of this file use the same pa
Henrik Grunell 2014/09/16 13:22:35 This will be used in layout tests, can it be contr
Mike West 2014/09/16 13:36:29 No. My point was that if you're going to hard-code
Henrik Grunell 2014/09/16 15:18:48 Ah, of course. :) Done.
+ WebVector<WebSourceInfo> sources(size);
+
+ sources[0].initialize("device1",
+ WebSourceInfo::SourceKindAudio,
+ "Built-in microphone",
+ WebSourceInfo::VideoFacingModeNone);
+ sources[1].initialize("device2",
+ WebSourceInfo::SourceKindVideo,
+ "Build-in webcam",
+ WebSourceInfo::VideoFacingModeEnvironment);
Mike West 2014/09/16 12:56:09 Is this enough flexibility for you? It might make
Henrik Grunell 2014/09/16 13:22:35 Well, this will be used in layout tests, can it be
Mike West 2014/09/16 13:36:29 There are a number of mocks with setter methods th
Henrik Grunell 2014/09/16 15:18:48 OK, thanks for the pointer.
+
+ delegate_->postTask(new SourcesRequestTask(this, request, sources));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698