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

Side by Side Diff: content/shell/renderer/test_runner/mock_web_user_media_client.cc

Issue 566833002: Update WebTask in chromium c++ style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolved build error 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/shell/renderer/test_runner/mock_web_user_media_client.h" 5 #include "content/shell/renderer/test_runner/mock_web_user_media_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
9 #include "content/shell/renderer/test_runner/mock_constraints.h" 9 #include "content/shell/renderer/test_runner/mock_constraints.h"
10 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 10 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
(...skipping 23 matching lines...) Expand all
34 public: 34 public:
35 UserMediaRequestTask(MockWebUserMediaClient* object, 35 UserMediaRequestTask(MockWebUserMediaClient* object,
36 const WebUserMediaRequest& request, 36 const WebUserMediaRequest& request,
37 const WebMediaStream result) 37 const WebMediaStream result)
38 : WebMethodTask<MockWebUserMediaClient>(object), 38 : WebMethodTask<MockWebUserMediaClient>(object),
39 request_(request), 39 request_(request),
40 result_(result) { 40 result_(result) {
41 DCHECK(!result_.isNull()); 41 DCHECK(!result_.isNull());
42 } 42 }
43 43
44 virtual void runIfValid() OVERRIDE { 44 virtual void RunIfValid() OVERRIDE { request_.requestSucceeded(result_); }
45 request_.requestSucceeded(result_);
46 }
47 45
48 private: 46 private:
49 WebUserMediaRequest request_; 47 WebUserMediaRequest request_;
50 WebMediaStream result_; 48 WebMediaStream result_;
51 }; 49 };
52 50
53 class UserMediaRequestConstraintFailedTask 51 class UserMediaRequestConstraintFailedTask
54 : public WebMethodTask<MockWebUserMediaClient> { 52 : public WebMethodTask<MockWebUserMediaClient> {
55 public: 53 public:
56 UserMediaRequestConstraintFailedTask(MockWebUserMediaClient* object, 54 UserMediaRequestConstraintFailedTask(MockWebUserMediaClient* object,
57 const WebUserMediaRequest& request, 55 const WebUserMediaRequest& request,
58 const WebString& constraint) 56 const WebString& constraint)
59 : WebMethodTask<MockWebUserMediaClient>(object), 57 : WebMethodTask<MockWebUserMediaClient>(object),
60 request_(request), 58 request_(request),
61 constraint_(constraint) {} 59 constraint_(constraint) {}
62 60
63 virtual void runIfValid() OVERRIDE { 61 virtual void RunIfValid() OVERRIDE {
64 request_.requestFailedConstraint(constraint_); 62 request_.requestFailedConstraint(constraint_);
65 } 63 }
66 64
67 private: 65 private:
68 WebUserMediaRequest request_; 66 WebUserMediaRequest request_;
69 WebString constraint_; 67 WebString constraint_;
70 }; 68 };
71 69
72 class UserMediaRequestPermissionDeniedTask 70 class UserMediaRequestPermissionDeniedTask
73 : public WebMethodTask<MockWebUserMediaClient> { 71 : public WebMethodTask<MockWebUserMediaClient> {
74 public: 72 public:
75 UserMediaRequestPermissionDeniedTask(MockWebUserMediaClient* object, 73 UserMediaRequestPermissionDeniedTask(MockWebUserMediaClient* object,
76 const WebUserMediaRequest& request) 74 const WebUserMediaRequest& request)
77 : WebMethodTask<MockWebUserMediaClient>(object), 75 : WebMethodTask<MockWebUserMediaClient>(object),
78 request_(request) {} 76 request_(request) {}
79 77
80 virtual void runIfValid() OVERRIDE { 78 virtual void RunIfValid() OVERRIDE { request_.requestFailed(); }
81 request_.requestFailed();
82 }
83 79
84 private: 80 private:
85 WebUserMediaRequest request_; 81 WebUserMediaRequest request_;
86 }; 82 };
87 83
88 class MediaDevicesRequestTask : public WebMethodTask<MockWebUserMediaClient> { 84 class MediaDevicesRequestTask : public WebMethodTask<MockWebUserMediaClient> {
89 public: 85 public:
90 MediaDevicesRequestTask(MockWebUserMediaClient* object, 86 MediaDevicesRequestTask(MockWebUserMediaClient* object,
91 const WebMediaDevicesRequest& request, 87 const WebMediaDevicesRequest& request,
92 const WebVector<WebMediaDeviceInfo>& result) 88 const WebVector<WebMediaDeviceInfo>& result)
93 : WebMethodTask<MockWebUserMediaClient>(object), 89 : WebMethodTask<MockWebUserMediaClient>(object),
94 request_(request), 90 request_(request),
95 result_(result) {} 91 result_(result) {}
96 92
97 virtual void runIfValid() OVERRIDE { 93 virtual void RunIfValid() OVERRIDE { request_.requestSucceeded(result_); }
98 request_.requestSucceeded(result_);
99 }
100 94
101 private: 95 private:
102 WebMediaDevicesRequest request_; 96 WebMediaDevicesRequest request_;
103 WebVector<WebMediaDeviceInfo> result_; 97 WebVector<WebMediaDeviceInfo> result_;
104 }; 98 };
105 99
106 class MockExtraData : public WebMediaStream::ExtraData { 100 class MockExtraData : public WebMediaStream::ExtraData {
107 public: 101 public:
108 int foo; 102 int foo;
109 }; 103 };
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 "group2"); 184 "group2");
191 185
192 delegate_->postTask(new MediaDevicesRequestTask(this, request, devices)); 186 delegate_->postTask(new MediaDevicesRequestTask(this, request, devices));
193 } 187 }
194 188
195 void MockWebUserMediaClient::cancelMediaDevicesRequest( 189 void MockWebUserMediaClient::cancelMediaDevicesRequest(
196 const WebMediaDevicesRequest&) { 190 const WebMediaDevicesRequest&) {
197 } 191 }
198 192
199 } // namespace content 193 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698