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

Side by Side Diff: generated/googleapis/test/searchconsole/v1_test.dart

Issue 2936613002: Api-Roll 50: 2017-06-12 (Closed)
Patch Set: Created 3 years, 6 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 library googleapis.searchconsole.v1.test; 1 library googleapis.searchconsole.v1.test;
2 2
3 import "dart:core" as core; 3 import "dart:core" as core;
4 import "dart:collection" as collection; 4 import "dart:collection" as collection;
5 import "dart:async" as async; 5 import "dart:async" as async;
6 import "dart:convert" as convert; 6 import "dart:convert" as convert;
7 7
8 import 'package:http/http.dart' as http; 8 import 'package:http/http.dart' as http;
9 import 'package:http/testing.dart' as http_testing; 9 import 'package:http/testing.dart' as http_testing;
10 import 'package:unittest/unittest.dart' as unittest; 10 import 'package:test/test.dart' as unittest;
11 11
12 import 'package:googleapis/searchconsole/v1.dart' as api; 12 import 'package:googleapis/searchconsole/v1.dart' as api;
13 13
14 class HttpServerMock extends http.BaseClient { 14 class HttpServerMock extends http.BaseClient {
15 core.Function _callback; 15 core.Function _callback;
16 core.bool _expectJson; 16 core.bool _expectJson;
17 17
18 void register(core.Function callback, core.bool expectJson) { 18 void register(core.Function callback, core.bool expectJson) {
19 _callback = callback; 19 _callback = callback;
20 _expectJson = expectJson; 20 _expectJson = expectJson;
(...skipping 18 matching lines...) Expand all
39 } else { 39 } else {
40 return stream.toBytes().then((data) { 40 return stream.toBytes().then((data) {
41 return _callback(request, data); 41 return _callback(request, data);
42 }); 42 });
43 } 43 }
44 } 44 }
45 } 45 }
46 } 46 }
47 47
48 http.StreamedResponse stringResponse( 48 http.StreamedResponse stringResponse(
49 core.int status, core.Map headers, core.String body) { 49 core.int status, core.Map<core.String, core.String> headers, core.String bod y) {
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
51 return new http.StreamedResponse(stream, status, headers: headers); 51 return new http.StreamedResponse(stream, status, headers: headers);
52 } 52 }
53 53
54 core.int buildCounterBlockedResource = 0; 54 core.int buildCounterBlockedResource = 0;
55 buildBlockedResource() { 55 buildBlockedResource() {
56 var o = new api.BlockedResource(); 56 var o = new api.BlockedResource();
57 buildCounterBlockedResource++; 57 buildCounterBlockedResource++;
58 if (buildCounterBlockedResource < 3) { 58 if (buildCounterBlockedResource < 3) {
59 o.url = "foo"; 59 o.url = "foo";
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 checkRunMobileFriendlyTestRequest(api.RunMobileFriendlyTestRequest o) { 144 checkRunMobileFriendlyTestRequest(api.RunMobileFriendlyTestRequest o) {
145 buildCounterRunMobileFriendlyTestRequest++; 145 buildCounterRunMobileFriendlyTestRequest++;
146 if (buildCounterRunMobileFriendlyTestRequest < 3) { 146 if (buildCounterRunMobileFriendlyTestRequest < 3) {
147 unittest.expect(o.requestScreenshot, unittest.isTrue); 147 unittest.expect(o.requestScreenshot, unittest.isTrue);
148 unittest.expect(o.url, unittest.equals('foo')); 148 unittest.expect(o.url, unittest.equals('foo'));
149 } 149 }
150 buildCounterRunMobileFriendlyTestRequest--; 150 buildCounterRunMobileFriendlyTestRequest--;
151 } 151 }
152 152
153 buildUnnamed1150() { 153 buildUnnamed1157() {
154 var o = new core.List<api.MobileFriendlyIssue>(); 154 var o = new core.List<api.MobileFriendlyIssue>();
155 o.add(buildMobileFriendlyIssue()); 155 o.add(buildMobileFriendlyIssue());
156 o.add(buildMobileFriendlyIssue()); 156 o.add(buildMobileFriendlyIssue());
157 return o; 157 return o;
158 } 158 }
159 159
160 checkUnnamed1150(core.List<api.MobileFriendlyIssue> o) { 160 checkUnnamed1157(core.List<api.MobileFriendlyIssue> o) {
161 unittest.expect(o, unittest.hasLength(2)); 161 unittest.expect(o, unittest.hasLength(2));
162 checkMobileFriendlyIssue(o[0]); 162 checkMobileFriendlyIssue(o[0]);
163 checkMobileFriendlyIssue(o[1]); 163 checkMobileFriendlyIssue(o[1]);
164 } 164 }
165 165
166 buildUnnamed1151() { 166 buildUnnamed1158() {
167 var o = new core.List<api.ResourceIssue>(); 167 var o = new core.List<api.ResourceIssue>();
168 o.add(buildResourceIssue()); 168 o.add(buildResourceIssue());
169 o.add(buildResourceIssue()); 169 o.add(buildResourceIssue());
170 return o; 170 return o;
171 } 171 }
172 172
173 checkUnnamed1151(core.List<api.ResourceIssue> o) { 173 checkUnnamed1158(core.List<api.ResourceIssue> o) {
174 unittest.expect(o, unittest.hasLength(2)); 174 unittest.expect(o, unittest.hasLength(2));
175 checkResourceIssue(o[0]); 175 checkResourceIssue(o[0]);
176 checkResourceIssue(o[1]); 176 checkResourceIssue(o[1]);
177 } 177 }
178 178
179 core.int buildCounterRunMobileFriendlyTestResponse = 0; 179 core.int buildCounterRunMobileFriendlyTestResponse = 0;
180 buildRunMobileFriendlyTestResponse() { 180 buildRunMobileFriendlyTestResponse() {
181 var o = new api.RunMobileFriendlyTestResponse(); 181 var o = new api.RunMobileFriendlyTestResponse();
182 buildCounterRunMobileFriendlyTestResponse++; 182 buildCounterRunMobileFriendlyTestResponse++;
183 if (buildCounterRunMobileFriendlyTestResponse < 3) { 183 if (buildCounterRunMobileFriendlyTestResponse < 3) {
184 o.mobileFriendliness = "foo"; 184 o.mobileFriendliness = "foo";
185 o.mobileFriendlyIssues = buildUnnamed1150(); 185 o.mobileFriendlyIssues = buildUnnamed1157();
186 o.resourceIssues = buildUnnamed1151(); 186 o.resourceIssues = buildUnnamed1158();
187 o.screenshot = buildImage(); 187 o.screenshot = buildImage();
188 o.testStatus = buildTestStatus(); 188 o.testStatus = buildTestStatus();
189 } 189 }
190 buildCounterRunMobileFriendlyTestResponse--; 190 buildCounterRunMobileFriendlyTestResponse--;
191 return o; 191 return o;
192 } 192 }
193 193
194 checkRunMobileFriendlyTestResponse(api.RunMobileFriendlyTestResponse o) { 194 checkRunMobileFriendlyTestResponse(api.RunMobileFriendlyTestResponse o) {
195 buildCounterRunMobileFriendlyTestResponse++; 195 buildCounterRunMobileFriendlyTestResponse++;
196 if (buildCounterRunMobileFriendlyTestResponse < 3) { 196 if (buildCounterRunMobileFriendlyTestResponse < 3) {
197 unittest.expect(o.mobileFriendliness, unittest.equals('foo')); 197 unittest.expect(o.mobileFriendliness, unittest.equals('foo'));
198 checkUnnamed1150(o.mobileFriendlyIssues); 198 checkUnnamed1157(o.mobileFriendlyIssues);
199 checkUnnamed1151(o.resourceIssues); 199 checkUnnamed1158(o.resourceIssues);
200 checkImage(o.screenshot); 200 checkImage(o.screenshot);
201 checkTestStatus(o.testStatus); 201 checkTestStatus(o.testStatus);
202 } 202 }
203 buildCounterRunMobileFriendlyTestResponse--; 203 buildCounterRunMobileFriendlyTestResponse--;
204 } 204 }
205 205
206 core.int buildCounterTestStatus = 0; 206 core.int buildCounterTestStatus = 0;
207 buildTestStatus() { 207 buildTestStatus() {
208 var o = new api.TestStatus(); 208 var o = new api.TestStatus();
209 buildCounterTestStatus++; 209 buildCounterTestStatus++;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 }); 288 });
289 }); 289 });
290 290
291 291
292 unittest.group("resource-UrlTestingToolsMobileFriendlyTestResourceApi", () { 292 unittest.group("resource-UrlTestingToolsMobileFriendlyTestResourceApi", () {
293 unittest.test("method--run", () { 293 unittest.test("method--run", () {
294 294
295 var mock = new HttpServerMock(); 295 var mock = new HttpServerMock();
296 api.UrlTestingToolsMobileFriendlyTestResourceApi res = new api.Searchconso leApi(mock).urlTestingTools.mobileFriendlyTest; 296 api.UrlTestingToolsMobileFriendlyTestResourceApi res = new api.Searchconso leApi(mock).urlTestingTools.mobileFriendlyTest;
297 var arg_request = buildRunMobileFriendlyTestRequest(); 297 var arg_request = buildRunMobileFriendlyTestRequest();
298 mock.register(unittest.expectAsync((http.BaseRequest req, json) { 298 mock.register(unittest.expectAsync2((http.BaseRequest req, json) {
299 var obj = new api.RunMobileFriendlyTestRequest.fromJson(json); 299 var obj = new api.RunMobileFriendlyTestRequest.fromJson(json);
300 checkRunMobileFriendlyTestRequest(obj); 300 checkRunMobileFriendlyTestRequest(obj);
301 301
302 var path = (req.url).path; 302 var path = (req.url).path;
303 var pathOffset = 0; 303 var pathOffset = 0;
304 var index; 304 var index;
305 var subPart; 305 var subPart;
306 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/")); 306 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ als("/"));
307 pathOffset += 1; 307 pathOffset += 1;
308 unittest.expect(path.substring(pathOffset, pathOffset + 41), unittest.eq uals("v1/urlTestingTools/mobileFriendlyTest:run")); 308 unittest.expect(path.substring(pathOffset, pathOffset + 41), unittest.eq uals("v1/urlTestingTools/mobileFriendlyTest:run"));
(...skipping 16 matching lines...) Expand all
325 } 325 }
326 } 326 }
327 327
328 328
329 var h = { 329 var h = {
330 "content-type" : "application/json; charset=utf-8", 330 "content-type" : "application/json; charset=utf-8",
331 }; 331 };
332 var resp = convert.JSON.encode(buildRunMobileFriendlyTestResponse()); 332 var resp = convert.JSON.encode(buildRunMobileFriendlyTestResponse());
333 return new async.Future.value(stringResponse(200, h, resp)); 333 return new async.Future.value(stringResponse(200, h, resp));
334 }), true); 334 }), true);
335 res.run(arg_request).then(unittest.expectAsync(((api.RunMobileFriendlyTest Response response) { 335 res.run(arg_request).then(unittest.expectAsync1(((api.RunMobileFriendlyTes tResponse response) {
336 checkRunMobileFriendlyTestResponse(response); 336 checkRunMobileFriendlyTestResponse(response);
337 }))); 337 })));
338 }); 338 });
339 339
340 }); 340 });
341 341
342 342
343 } 343 }
344 344
OLDNEW
« no previous file with comments | « generated/googleapis/test/script/v1_test.dart ('k') | generated/googleapis/test/servicecontrol/v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698