| OLD | NEW |
| 1 library googleapis.customsearch.v1.test; | 1 library googleapis.customsearch.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:unittest/unittest.dart' as unittest; |
| 11 import 'package:googleapis/common/common.dart' as common; | |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; | |
| 13 import '../common/common_internal_test.dart' as common_test; | |
| 14 | 11 |
| 15 import 'package:googleapis/customsearch/v1.dart' as api; | 12 import 'package:googleapis/customsearch/v1.dart' as api; |
| 16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 18 | 53 |
| 19 core.int buildCounterContextFacets = 0; | 54 core.int buildCounterContextFacets = 0; |
| 20 buildContextFacets() { | 55 buildContextFacets() { |
| 21 var o = new api.ContextFacets(); | 56 var o = new api.ContextFacets(); |
| 22 buildCounterContextFacets++; | 57 buildCounterContextFacets++; |
| 23 if (buildCounterContextFacets < 3) { | 58 if (buildCounterContextFacets < 3) { |
| 24 o.anchor = "foo"; | 59 o.anchor = "foo"; |
| 25 o.label = "foo"; | 60 o.label = "foo"; |
| 26 o.labelWithOp = "foo"; | 61 o.labelWithOp = "foo"; |
| 27 } | 62 } |
| 28 buildCounterContextFacets--; | 63 buildCounterContextFacets--; |
| 29 return o; | 64 return o; |
| 30 } | 65 } |
| 31 | 66 |
| 32 checkContextFacets(api.ContextFacets o) { | 67 checkContextFacets(api.ContextFacets o) { |
| 33 buildCounterContextFacets++; | 68 buildCounterContextFacets++; |
| 34 if (buildCounterContextFacets < 3) { | 69 if (buildCounterContextFacets < 3) { |
| 35 unittest.expect(o.anchor, unittest.equals('foo')); | 70 unittest.expect(o.anchor, unittest.equals('foo')); |
| 36 unittest.expect(o.label, unittest.equals('foo')); | 71 unittest.expect(o.label, unittest.equals('foo')); |
| 37 unittest.expect(o.labelWithOp, unittest.equals('foo')); | 72 unittest.expect(o.labelWithOp, unittest.equals('foo')); |
| 38 } | 73 } |
| 39 buildCounterContextFacets--; | 74 buildCounterContextFacets--; |
| 40 } | 75 } |
| 41 | 76 |
| 42 buildUnnamed273() { | 77 buildUnnamed632() { |
| 43 var o = new core.List<api.ContextFacets>(); | 78 var o = new core.List<api.ContextFacets>(); |
| 44 o.add(buildContextFacets()); | 79 o.add(buildContextFacets()); |
| 45 o.add(buildContextFacets()); | 80 o.add(buildContextFacets()); |
| 46 return o; | 81 return o; |
| 47 } | 82 } |
| 48 | 83 |
| 49 checkUnnamed273(core.List<api.ContextFacets> o) { | 84 checkUnnamed632(core.List<api.ContextFacets> o) { |
| 50 unittest.expect(o, unittest.hasLength(2)); | 85 unittest.expect(o, unittest.hasLength(2)); |
| 51 checkContextFacets(o[0]); | 86 checkContextFacets(o[0]); |
| 52 checkContextFacets(o[1]); | 87 checkContextFacets(o[1]); |
| 53 } | 88 } |
| 54 | 89 |
| 55 buildUnnamed274() { | 90 buildUnnamed633() { |
| 56 var o = new core.List<core.List<api.ContextFacets>>(); | 91 var o = new core.List<core.List<api.ContextFacets>>(); |
| 57 o.add(buildUnnamed273()); | 92 o.add(buildUnnamed632()); |
| 58 o.add(buildUnnamed273()); | 93 o.add(buildUnnamed632()); |
| 59 return o; | 94 return o; |
| 60 } | 95 } |
| 61 | 96 |
| 62 checkUnnamed274(core.List<core.List<api.ContextFacets>> o) { | 97 checkUnnamed633(core.List<core.List<api.ContextFacets>> o) { |
| 63 unittest.expect(o, unittest.hasLength(2)); | 98 unittest.expect(o, unittest.hasLength(2)); |
| 64 checkUnnamed273(o[0]); | 99 checkUnnamed632(o[0]); |
| 65 checkUnnamed273(o[1]); | 100 checkUnnamed632(o[1]); |
| 66 } | 101 } |
| 67 | 102 |
| 68 core.int buildCounterContext = 0; | 103 core.int buildCounterContext = 0; |
| 69 buildContext() { | 104 buildContext() { |
| 70 var o = new api.Context(); | 105 var o = new api.Context(); |
| 71 buildCounterContext++; | 106 buildCounterContext++; |
| 72 if (buildCounterContext < 3) { | 107 if (buildCounterContext < 3) { |
| 73 o.facets = buildUnnamed274(); | 108 o.facets = buildUnnamed633(); |
| 74 o.title = "foo"; | 109 o.title = "foo"; |
| 75 } | 110 } |
| 76 buildCounterContext--; | 111 buildCounterContext--; |
| 77 return o; | 112 return o; |
| 78 } | 113 } |
| 79 | 114 |
| 80 checkContext(api.Context o) { | 115 checkContext(api.Context o) { |
| 81 buildCounterContext++; | 116 buildCounterContext++; |
| 82 if (buildCounterContext < 3) { | 117 if (buildCounterContext < 3) { |
| 83 checkUnnamed274(o.facets); | 118 checkUnnamed633(o.facets); |
| 84 unittest.expect(o.title, unittest.equals('foo')); | 119 unittest.expect(o.title, unittest.equals('foo')); |
| 85 } | 120 } |
| 86 buildCounterContext--; | 121 buildCounterContext--; |
| 87 } | 122 } |
| 88 | 123 |
| 89 core.int buildCounterPromotionBodyLines = 0; | 124 core.int buildCounterPromotionBodyLines = 0; |
| 90 buildPromotionBodyLines() { | 125 buildPromotionBodyLines() { |
| 91 var o = new api.PromotionBodyLines(); | 126 var o = new api.PromotionBodyLines(); |
| 92 buildCounterPromotionBodyLines++; | 127 buildCounterPromotionBodyLines++; |
| 93 if (buildCounterPromotionBodyLines < 3) { | 128 if (buildCounterPromotionBodyLines < 3) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 104 buildCounterPromotionBodyLines++; | 139 buildCounterPromotionBodyLines++; |
| 105 if (buildCounterPromotionBodyLines < 3) { | 140 if (buildCounterPromotionBodyLines < 3) { |
| 106 unittest.expect(o.htmlTitle, unittest.equals('foo')); | 141 unittest.expect(o.htmlTitle, unittest.equals('foo')); |
| 107 unittest.expect(o.link, unittest.equals('foo')); | 142 unittest.expect(o.link, unittest.equals('foo')); |
| 108 unittest.expect(o.title, unittest.equals('foo')); | 143 unittest.expect(o.title, unittest.equals('foo')); |
| 109 unittest.expect(o.url, unittest.equals('foo')); | 144 unittest.expect(o.url, unittest.equals('foo')); |
| 110 } | 145 } |
| 111 buildCounterPromotionBodyLines--; | 146 buildCounterPromotionBodyLines--; |
| 112 } | 147 } |
| 113 | 148 |
| 114 buildUnnamed275() { | 149 buildUnnamed634() { |
| 115 var o = new core.List<api.PromotionBodyLines>(); | 150 var o = new core.List<api.PromotionBodyLines>(); |
| 116 o.add(buildPromotionBodyLines()); | 151 o.add(buildPromotionBodyLines()); |
| 117 o.add(buildPromotionBodyLines()); | 152 o.add(buildPromotionBodyLines()); |
| 118 return o; | 153 return o; |
| 119 } | 154 } |
| 120 | 155 |
| 121 checkUnnamed275(core.List<api.PromotionBodyLines> o) { | 156 checkUnnamed634(core.List<api.PromotionBodyLines> o) { |
| 122 unittest.expect(o, unittest.hasLength(2)); | 157 unittest.expect(o, unittest.hasLength(2)); |
| 123 checkPromotionBodyLines(o[0]); | 158 checkPromotionBodyLines(o[0]); |
| 124 checkPromotionBodyLines(o[1]); | 159 checkPromotionBodyLines(o[1]); |
| 125 } | 160 } |
| 126 | 161 |
| 127 core.int buildCounterPromotionImage = 0; | 162 core.int buildCounterPromotionImage = 0; |
| 128 buildPromotionImage() { | 163 buildPromotionImage() { |
| 129 var o = new api.PromotionImage(); | 164 var o = new api.PromotionImage(); |
| 130 buildCounterPromotionImage++; | 165 buildCounterPromotionImage++; |
| 131 if (buildCounterPromotionImage < 3) { | 166 if (buildCounterPromotionImage < 3) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 145 unittest.expect(o.width, unittest.equals(42)); | 180 unittest.expect(o.width, unittest.equals(42)); |
| 146 } | 181 } |
| 147 buildCounterPromotionImage--; | 182 buildCounterPromotionImage--; |
| 148 } | 183 } |
| 149 | 184 |
| 150 core.int buildCounterPromotion = 0; | 185 core.int buildCounterPromotion = 0; |
| 151 buildPromotion() { | 186 buildPromotion() { |
| 152 var o = new api.Promotion(); | 187 var o = new api.Promotion(); |
| 153 buildCounterPromotion++; | 188 buildCounterPromotion++; |
| 154 if (buildCounterPromotion < 3) { | 189 if (buildCounterPromotion < 3) { |
| 155 o.bodyLines = buildUnnamed275(); | 190 o.bodyLines = buildUnnamed634(); |
| 156 o.displayLink = "foo"; | 191 o.displayLink = "foo"; |
| 157 o.htmlTitle = "foo"; | 192 o.htmlTitle = "foo"; |
| 158 o.image = buildPromotionImage(); | 193 o.image = buildPromotionImage(); |
| 159 o.link = "foo"; | 194 o.link = "foo"; |
| 160 o.title = "foo"; | 195 o.title = "foo"; |
| 161 } | 196 } |
| 162 buildCounterPromotion--; | 197 buildCounterPromotion--; |
| 163 return o; | 198 return o; |
| 164 } | 199 } |
| 165 | 200 |
| 166 checkPromotion(api.Promotion o) { | 201 checkPromotion(api.Promotion o) { |
| 167 buildCounterPromotion++; | 202 buildCounterPromotion++; |
| 168 if (buildCounterPromotion < 3) { | 203 if (buildCounterPromotion < 3) { |
| 169 checkUnnamed275(o.bodyLines); | 204 checkUnnamed634(o.bodyLines); |
| 170 unittest.expect(o.displayLink, unittest.equals('foo')); | 205 unittest.expect(o.displayLink, unittest.equals('foo')); |
| 171 unittest.expect(o.htmlTitle, unittest.equals('foo')); | 206 unittest.expect(o.htmlTitle, unittest.equals('foo')); |
| 172 checkPromotionImage(o.image); | 207 checkPromotionImage(o.image); |
| 173 unittest.expect(o.link, unittest.equals('foo')); | 208 unittest.expect(o.link, unittest.equals('foo')); |
| 174 unittest.expect(o.title, unittest.equals('foo')); | 209 unittest.expect(o.title, unittest.equals('foo')); |
| 175 } | 210 } |
| 176 buildCounterPromotion--; | 211 buildCounterPromotion--; |
| 177 } | 212 } |
| 178 | 213 |
| 179 core.int buildCounterQuery = 0; | 214 core.int buildCounterQuery = 0; |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 checkResultLabels(api.ResultLabels o) { | 349 checkResultLabels(api.ResultLabels o) { |
| 315 buildCounterResultLabels++; | 350 buildCounterResultLabels++; |
| 316 if (buildCounterResultLabels < 3) { | 351 if (buildCounterResultLabels < 3) { |
| 317 unittest.expect(o.displayName, unittest.equals('foo')); | 352 unittest.expect(o.displayName, unittest.equals('foo')); |
| 318 unittest.expect(o.labelWithOp, unittest.equals('foo')); | 353 unittest.expect(o.labelWithOp, unittest.equals('foo')); |
| 319 unittest.expect(o.name, unittest.equals('foo')); | 354 unittest.expect(o.name, unittest.equals('foo')); |
| 320 } | 355 } |
| 321 buildCounterResultLabels--; | 356 buildCounterResultLabels--; |
| 322 } | 357 } |
| 323 | 358 |
| 324 buildUnnamed276() { | 359 buildUnnamed635() { |
| 325 var o = new core.List<api.ResultLabels>(); | 360 var o = new core.List<api.ResultLabels>(); |
| 326 o.add(buildResultLabels()); | 361 o.add(buildResultLabels()); |
| 327 o.add(buildResultLabels()); | 362 o.add(buildResultLabels()); |
| 328 return o; | 363 return o; |
| 329 } | 364 } |
| 330 | 365 |
| 331 checkUnnamed276(core.List<api.ResultLabels> o) { | 366 checkUnnamed635(core.List<api.ResultLabels> o) { |
| 332 unittest.expect(o, unittest.hasLength(2)); | 367 unittest.expect(o, unittest.hasLength(2)); |
| 333 checkResultLabels(o[0]); | 368 checkResultLabels(o[0]); |
| 334 checkResultLabels(o[1]); | 369 checkResultLabels(o[1]); |
| 335 } | 370 } |
| 336 | 371 |
| 337 buildUnnamed277() { | 372 buildUnnamed636() { |
| 338 var o = new core.Map<core.String, core.Object>(); | 373 var o = new core.Map<core.String, core.Object>(); |
| 339 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 374 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 340 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 375 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 341 return o; | 376 return o; |
| 342 } | 377 } |
| 343 | 378 |
| 344 checkUnnamed277(core.Map<core.String, core.Object> o) { | 379 checkUnnamed636(core.Map<core.String, core.Object> o) { |
| 345 unittest.expect(o, unittest.hasLength(2)); | 380 unittest.expect(o, unittest.hasLength(2)); |
| 346 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); | 381 var casted1 = (o["x"]) as core.Map; unittest.expect(casted1, unittest.hasLengt
h(3)); unittest.expect(casted1["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted1["bool"], unittest.equals(true)); unittest.expect(casted1["string"],
unittest.equals('foo')); |
| 347 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); | 382 var casted2 = (o["y"]) as core.Map; unittest.expect(casted2, unittest.hasLengt
h(3)); unittest.expect(casted2["list"], unittest.equals([1, 2, 3])); unittest.ex
pect(casted2["bool"], unittest.equals(true)); unittest.expect(casted2["string"],
unittest.equals('foo')); |
| 348 } | 383 } |
| 349 | 384 |
| 350 buildUnnamed278() { | 385 buildUnnamed637() { |
| 351 var o = new core.List<core.Map<core.String, core.Object>>(); | 386 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 352 o.add(buildUnnamed277()); | 387 o.add(buildUnnamed636()); |
| 353 o.add(buildUnnamed277()); | 388 o.add(buildUnnamed636()); |
| 354 return o; | 389 return o; |
| 355 } | 390 } |
| 356 | 391 |
| 357 checkUnnamed278(core.List<core.Map<core.String, core.Object>> o) { | 392 checkUnnamed637(core.List<core.Map<core.String, core.Object>> o) { |
| 358 unittest.expect(o, unittest.hasLength(2)); | 393 unittest.expect(o, unittest.hasLength(2)); |
| 359 checkUnnamed277(o[0]); | 394 checkUnnamed636(o[0]); |
| 360 checkUnnamed277(o[1]); | 395 checkUnnamed636(o[1]); |
| 361 } | 396 } |
| 362 | 397 |
| 363 buildUnnamed279() { | 398 buildUnnamed638() { |
| 364 var o = new core.Map<core.String, core.List<core.Map<core.String, core.Object>
>>(); | 399 var o = new core.Map<core.String, core.List<core.Map<core.String, core.Object>
>>(); |
| 365 o["x"] = buildUnnamed278(); | 400 o["x"] = buildUnnamed637(); |
| 366 o["y"] = buildUnnamed278(); | 401 o["y"] = buildUnnamed637(); |
| 367 return o; | 402 return o; |
| 368 } | 403 } |
| 369 | 404 |
| 370 checkUnnamed279(core.Map<core.String, core.List<core.Map<core.String, core.Objec
t>>> o) { | 405 checkUnnamed638(core.Map<core.String, core.List<core.Map<core.String, core.Objec
t>>> o) { |
| 371 unittest.expect(o, unittest.hasLength(2)); | 406 unittest.expect(o, unittest.hasLength(2)); |
| 372 checkUnnamed278(o["x"]); | 407 checkUnnamed637(o["x"]); |
| 373 checkUnnamed278(o["y"]); | 408 checkUnnamed637(o["y"]); |
| 374 } | 409 } |
| 375 | 410 |
| 376 core.int buildCounterResult = 0; | 411 core.int buildCounterResult = 0; |
| 377 buildResult() { | 412 buildResult() { |
| 378 var o = new api.Result(); | 413 var o = new api.Result(); |
| 379 buildCounterResult++; | 414 buildCounterResult++; |
| 380 if (buildCounterResult < 3) { | 415 if (buildCounterResult < 3) { |
| 381 o.cacheId = "foo"; | 416 o.cacheId = "foo"; |
| 382 o.displayLink = "foo"; | 417 o.displayLink = "foo"; |
| 383 o.fileFormat = "foo"; | 418 o.fileFormat = "foo"; |
| 384 o.formattedUrl = "foo"; | 419 o.formattedUrl = "foo"; |
| 385 o.htmlFormattedUrl = "foo"; | 420 o.htmlFormattedUrl = "foo"; |
| 386 o.htmlSnippet = "foo"; | 421 o.htmlSnippet = "foo"; |
| 387 o.htmlTitle = "foo"; | 422 o.htmlTitle = "foo"; |
| 388 o.image = buildResultImage(); | 423 o.image = buildResultImage(); |
| 389 o.kind = "foo"; | 424 o.kind = "foo"; |
| 390 o.labels = buildUnnamed276(); | 425 o.labels = buildUnnamed635(); |
| 391 o.link = "foo"; | 426 o.link = "foo"; |
| 392 o.mime = "foo"; | 427 o.mime = "foo"; |
| 393 o.pagemap = buildUnnamed279(); | 428 o.pagemap = buildUnnamed638(); |
| 394 o.snippet = "foo"; | 429 o.snippet = "foo"; |
| 395 o.title = "foo"; | 430 o.title = "foo"; |
| 396 } | 431 } |
| 397 buildCounterResult--; | 432 buildCounterResult--; |
| 398 return o; | 433 return o; |
| 399 } | 434 } |
| 400 | 435 |
| 401 checkResult(api.Result o) { | 436 checkResult(api.Result o) { |
| 402 buildCounterResult++; | 437 buildCounterResult++; |
| 403 if (buildCounterResult < 3) { | 438 if (buildCounterResult < 3) { |
| 404 unittest.expect(o.cacheId, unittest.equals('foo')); | 439 unittest.expect(o.cacheId, unittest.equals('foo')); |
| 405 unittest.expect(o.displayLink, unittest.equals('foo')); | 440 unittest.expect(o.displayLink, unittest.equals('foo')); |
| 406 unittest.expect(o.fileFormat, unittest.equals('foo')); | 441 unittest.expect(o.fileFormat, unittest.equals('foo')); |
| 407 unittest.expect(o.formattedUrl, unittest.equals('foo')); | 442 unittest.expect(o.formattedUrl, unittest.equals('foo')); |
| 408 unittest.expect(o.htmlFormattedUrl, unittest.equals('foo')); | 443 unittest.expect(o.htmlFormattedUrl, unittest.equals('foo')); |
| 409 unittest.expect(o.htmlSnippet, unittest.equals('foo')); | 444 unittest.expect(o.htmlSnippet, unittest.equals('foo')); |
| 410 unittest.expect(o.htmlTitle, unittest.equals('foo')); | 445 unittest.expect(o.htmlTitle, unittest.equals('foo')); |
| 411 checkResultImage(o.image); | 446 checkResultImage(o.image); |
| 412 unittest.expect(o.kind, unittest.equals('foo')); | 447 unittest.expect(o.kind, unittest.equals('foo')); |
| 413 checkUnnamed276(o.labels); | 448 checkUnnamed635(o.labels); |
| 414 unittest.expect(o.link, unittest.equals('foo')); | 449 unittest.expect(o.link, unittest.equals('foo')); |
| 415 unittest.expect(o.mime, unittest.equals('foo')); | 450 unittest.expect(o.mime, unittest.equals('foo')); |
| 416 checkUnnamed279(o.pagemap); | 451 checkUnnamed638(o.pagemap); |
| 417 unittest.expect(o.snippet, unittest.equals('foo')); | 452 unittest.expect(o.snippet, unittest.equals('foo')); |
| 418 unittest.expect(o.title, unittest.equals('foo')); | 453 unittest.expect(o.title, unittest.equals('foo')); |
| 419 } | 454 } |
| 420 buildCounterResult--; | 455 buildCounterResult--; |
| 421 } | 456 } |
| 422 | 457 |
| 423 buildUnnamed280() { | 458 buildUnnamed639() { |
| 424 var o = new core.List<api.Result>(); | 459 var o = new core.List<api.Result>(); |
| 425 o.add(buildResult()); | 460 o.add(buildResult()); |
| 426 o.add(buildResult()); | 461 o.add(buildResult()); |
| 427 return o; | 462 return o; |
| 428 } | 463 } |
| 429 | 464 |
| 430 checkUnnamed280(core.List<api.Result> o) { | 465 checkUnnamed639(core.List<api.Result> o) { |
| 431 unittest.expect(o, unittest.hasLength(2)); | 466 unittest.expect(o, unittest.hasLength(2)); |
| 432 checkResult(o[0]); | 467 checkResult(o[0]); |
| 433 checkResult(o[1]); | 468 checkResult(o[1]); |
| 434 } | 469 } |
| 435 | 470 |
| 436 buildUnnamed281() { | 471 buildUnnamed640() { |
| 437 var o = new core.List<api.Promotion>(); | 472 var o = new core.List<api.Promotion>(); |
| 438 o.add(buildPromotion()); | 473 o.add(buildPromotion()); |
| 439 o.add(buildPromotion()); | 474 o.add(buildPromotion()); |
| 440 return o; | 475 return o; |
| 441 } | 476 } |
| 442 | 477 |
| 443 checkUnnamed281(core.List<api.Promotion> o) { | 478 checkUnnamed640(core.List<api.Promotion> o) { |
| 444 unittest.expect(o, unittest.hasLength(2)); | 479 unittest.expect(o, unittest.hasLength(2)); |
| 445 checkPromotion(o[0]); | 480 checkPromotion(o[0]); |
| 446 checkPromotion(o[1]); | 481 checkPromotion(o[1]); |
| 447 } | 482 } |
| 448 | 483 |
| 449 buildUnnamed282() { | 484 buildUnnamed641() { |
| 450 var o = new core.List<api.Query>(); | 485 var o = new core.List<api.Query>(); |
| 451 o.add(buildQuery()); | 486 o.add(buildQuery()); |
| 452 o.add(buildQuery()); | 487 o.add(buildQuery()); |
| 453 return o; | 488 return o; |
| 454 } | 489 } |
| 455 | 490 |
| 456 checkUnnamed282(core.List<api.Query> o) { | 491 checkUnnamed641(core.List<api.Query> o) { |
| 457 unittest.expect(o, unittest.hasLength(2)); | 492 unittest.expect(o, unittest.hasLength(2)); |
| 458 checkQuery(o[0]); | 493 checkQuery(o[0]); |
| 459 checkQuery(o[1]); | 494 checkQuery(o[1]); |
| 460 } | 495 } |
| 461 | 496 |
| 462 buildUnnamed283() { | 497 buildUnnamed642() { |
| 463 var o = new core.Map<core.String, core.List<api.Query>>(); | 498 var o = new core.Map<core.String, core.List<api.Query>>(); |
| 464 o["x"] = buildUnnamed282(); | 499 o["x"] = buildUnnamed641(); |
| 465 o["y"] = buildUnnamed282(); | 500 o["y"] = buildUnnamed641(); |
| 466 return o; | 501 return o; |
| 467 } | 502 } |
| 468 | 503 |
| 469 checkUnnamed283(core.Map<core.String, core.List<api.Query>> o) { | 504 checkUnnamed642(core.Map<core.String, core.List<api.Query>> o) { |
| 470 unittest.expect(o, unittest.hasLength(2)); | 505 unittest.expect(o, unittest.hasLength(2)); |
| 471 checkUnnamed282(o["x"]); | 506 checkUnnamed641(o["x"]); |
| 472 checkUnnamed282(o["y"]); | 507 checkUnnamed641(o["y"]); |
| 473 } | 508 } |
| 474 | 509 |
| 475 core.int buildCounterSearchSearchInformation = 0; | 510 core.int buildCounterSearchSearchInformation = 0; |
| 476 buildSearchSearchInformation() { | 511 buildSearchSearchInformation() { |
| 477 var o = new api.SearchSearchInformation(); | 512 var o = new api.SearchSearchInformation(); |
| 478 buildCounterSearchSearchInformation++; | 513 buildCounterSearchSearchInformation++; |
| 479 if (buildCounterSearchSearchInformation < 3) { | 514 if (buildCounterSearchSearchInformation < 3) { |
| 480 o.formattedSearchTime = "foo"; | 515 o.formattedSearchTime = "foo"; |
| 481 o.formattedTotalResults = "foo"; | 516 o.formattedTotalResults = "foo"; |
| 482 o.searchTime = 42.0; | 517 o.searchTime = 42.0; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 } | 573 } |
| 539 buildCounterSearchUrl--; | 574 buildCounterSearchUrl--; |
| 540 } | 575 } |
| 541 | 576 |
| 542 core.int buildCounterSearch = 0; | 577 core.int buildCounterSearch = 0; |
| 543 buildSearch() { | 578 buildSearch() { |
| 544 var o = new api.Search(); | 579 var o = new api.Search(); |
| 545 buildCounterSearch++; | 580 buildCounterSearch++; |
| 546 if (buildCounterSearch < 3) { | 581 if (buildCounterSearch < 3) { |
| 547 o.context = buildContext(); | 582 o.context = buildContext(); |
| 548 o.items = buildUnnamed280(); | 583 o.items = buildUnnamed639(); |
| 549 o.kind = "foo"; | 584 o.kind = "foo"; |
| 550 o.promotions = buildUnnamed281(); | 585 o.promotions = buildUnnamed640(); |
| 551 o.queries = buildUnnamed283(); | 586 o.queries = buildUnnamed642(); |
| 552 o.searchInformation = buildSearchSearchInformation(); | 587 o.searchInformation = buildSearchSearchInformation(); |
| 553 o.spelling = buildSearchSpelling(); | 588 o.spelling = buildSearchSpelling(); |
| 554 o.url = buildSearchUrl(); | 589 o.url = buildSearchUrl(); |
| 555 } | 590 } |
| 556 buildCounterSearch--; | 591 buildCounterSearch--; |
| 557 return o; | 592 return o; |
| 558 } | 593 } |
| 559 | 594 |
| 560 checkSearch(api.Search o) { | 595 checkSearch(api.Search o) { |
| 561 buildCounterSearch++; | 596 buildCounterSearch++; |
| 562 if (buildCounterSearch < 3) { | 597 if (buildCounterSearch < 3) { |
| 563 checkContext(o.context); | 598 checkContext(o.context); |
| 564 checkUnnamed280(o.items); | 599 checkUnnamed639(o.items); |
| 565 unittest.expect(o.kind, unittest.equals('foo')); | 600 unittest.expect(o.kind, unittest.equals('foo')); |
| 566 checkUnnamed281(o.promotions); | 601 checkUnnamed640(o.promotions); |
| 567 checkUnnamed283(o.queries); | 602 checkUnnamed642(o.queries); |
| 568 checkSearchSearchInformation(o.searchInformation); | 603 checkSearchSearchInformation(o.searchInformation); |
| 569 checkSearchSpelling(o.spelling); | 604 checkSearchSpelling(o.spelling); |
| 570 checkSearchUrl(o.url); | 605 checkSearchUrl(o.url); |
| 571 } | 606 } |
| 572 buildCounterSearch--; | 607 buildCounterSearch--; |
| 573 } | 608 } |
| 574 | 609 |
| 575 | 610 |
| 576 main() { | 611 main() { |
| 577 unittest.group("obj-schema-ContextFacets", () { | 612 unittest.group("obj-schema-ContextFacets", () { |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 var o = buildSearch(); | 722 var o = buildSearch(); |
| 688 var od = new api.Search.fromJson(o.toJson()); | 723 var od = new api.Search.fromJson(o.toJson()); |
| 689 checkSearch(od); | 724 checkSearch(od); |
| 690 }); | 725 }); |
| 691 }); | 726 }); |
| 692 | 727 |
| 693 | 728 |
| 694 unittest.group("resource-CseResourceApi", () { | 729 unittest.group("resource-CseResourceApi", () { |
| 695 unittest.test("method--list", () { | 730 unittest.test("method--list", () { |
| 696 | 731 |
| 697 var mock = new common_test.HttpServerMock(); | 732 var mock = new HttpServerMock(); |
| 698 api.CseResourceApi res = new api.CustomsearchApi(mock).cse; | 733 api.CseResourceApi res = new api.CustomsearchApi(mock).cse; |
| 699 var arg_q = "foo"; | 734 var arg_q = "foo"; |
| 700 var arg_c2coff = "foo"; | 735 var arg_c2coff = "foo"; |
| 701 var arg_cr = "foo"; | 736 var arg_cr = "foo"; |
| 702 var arg_cref = "foo"; | 737 var arg_cref = "foo"; |
| 703 var arg_cx = "foo"; | 738 var arg_cx = "foo"; |
| 704 var arg_dateRestrict = "foo"; | 739 var arg_dateRestrict = "foo"; |
| 705 var arg_exactTerms = "foo"; | 740 var arg_exactTerms = "foo"; |
| 706 var arg_excludeTerms = "foo"; | 741 var arg_excludeTerms = "foo"; |
| 707 var arg_fileType = "foo"; | 742 var arg_fileType = "foo"; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 unittest.expect(queryMap["siteSearch"].first, unittest.equals(arg_siteSe
arch)); | 822 unittest.expect(queryMap["siteSearch"].first, unittest.equals(arg_siteSe
arch)); |
| 788 unittest.expect(queryMap["siteSearchFilter"].first, unittest.equals(arg_
siteSearchFilter)); | 823 unittest.expect(queryMap["siteSearchFilter"].first, unittest.equals(arg_
siteSearchFilter)); |
| 789 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); | 824 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); |
| 790 unittest.expect(core.int.parse(queryMap["start"].first), unittest.equals
(arg_start)); | 825 unittest.expect(core.int.parse(queryMap["start"].first), unittest.equals
(arg_start)); |
| 791 | 826 |
| 792 | 827 |
| 793 var h = { | 828 var h = { |
| 794 "content-type" : "application/json; charset=utf-8", | 829 "content-type" : "application/json; charset=utf-8", |
| 795 }; | 830 }; |
| 796 var resp = convert.JSON.encode(buildSearch()); | 831 var resp = convert.JSON.encode(buildSearch()); |
| 797 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 832 return new async.Future.value(stringResponse(200, h, resp)); |
| 798 }), true); | 833 }), true); |
| 799 res.list(arg_q, c2coff: arg_c2coff, cr: arg_cr, cref: arg_cref, cx: arg_cx
, dateRestrict: arg_dateRestrict, exactTerms: arg_exactTerms, excludeTerms: arg_
excludeTerms, fileType: arg_fileType, filter: arg_filter, gl: arg_gl, googlehost
: arg_googlehost, highRange: arg_highRange, hl: arg_hl, hq: arg_hq, imgColorType
: arg_imgColorType, imgDominantColor: arg_imgDominantColor, imgSize: arg_imgSize
, imgType: arg_imgType, linkSite: arg_linkSite, lowRange: arg_lowRange, lr: arg_
lr, num: arg_num, orTerms: arg_orTerms, relatedSite: arg_relatedSite, rights: ar
g_rights, safe: arg_safe, searchType: arg_searchType, siteSearch: arg_siteSearch
, siteSearchFilter: arg_siteSearchFilter, sort: arg_sort, start: arg_start).then
(unittest.expectAsync(((api.Search response) { | 834 res.list(arg_q, c2coff: arg_c2coff, cr: arg_cr, cref: arg_cref, cx: arg_cx
, dateRestrict: arg_dateRestrict, exactTerms: arg_exactTerms, excludeTerms: arg_
excludeTerms, fileType: arg_fileType, filter: arg_filter, gl: arg_gl, googlehost
: arg_googlehost, highRange: arg_highRange, hl: arg_hl, hq: arg_hq, imgColorType
: arg_imgColorType, imgDominantColor: arg_imgDominantColor, imgSize: arg_imgSize
, imgType: arg_imgType, linkSite: arg_linkSite, lowRange: arg_lowRange, lr: arg_
lr, num: arg_num, orTerms: arg_orTerms, relatedSite: arg_relatedSite, rights: ar
g_rights, safe: arg_safe, searchType: arg_searchType, siteSearch: arg_siteSearch
, siteSearchFilter: arg_siteSearchFilter, sort: arg_sort, start: arg_start).then
(unittest.expectAsync(((api.Search response) { |
| 800 checkSearch(response); | 835 checkSearch(response); |
| 801 }))); | 836 }))); |
| 802 }); | 837 }); |
| 803 | 838 |
| 804 }); | 839 }); |
| 805 | 840 |
| 806 | 841 |
| 807 } | 842 } |
| 808 | 843 |
| OLD | NEW |