| 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:test/test.dart' as unittest; |
| 11 | 11 |
| 12 import 'package:googleapis/customsearch/v1.dart' as api; | 12 import 'package:googleapis/customsearch/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 Loading... |
| 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 buildCounterContextFacets = 0; | 54 core.int buildCounterContextFacets = 0; |
| 55 buildContextFacets() { | 55 buildContextFacets() { |
| 56 var o = new api.ContextFacets(); | 56 var o = new api.ContextFacets(); |
| 57 buildCounterContextFacets++; | 57 buildCounterContextFacets++; |
| 58 if (buildCounterContextFacets < 3) { | 58 if (buildCounterContextFacets < 3) { |
| 59 o.anchor = "foo"; | 59 o.anchor = "foo"; |
| 60 o.label = "foo"; | 60 o.label = "foo"; |
| 61 o.labelWithOp = "foo"; | 61 o.labelWithOp = "foo"; |
| 62 } | 62 } |
| 63 buildCounterContextFacets--; | 63 buildCounterContextFacets--; |
| 64 return o; | 64 return o; |
| 65 } | 65 } |
| 66 | 66 |
| 67 checkContextFacets(api.ContextFacets o) { | 67 checkContextFacets(api.ContextFacets o) { |
| 68 buildCounterContextFacets++; | 68 buildCounterContextFacets++; |
| 69 if (buildCounterContextFacets < 3) { | 69 if (buildCounterContextFacets < 3) { |
| 70 unittest.expect(o.anchor, unittest.equals('foo')); | 70 unittest.expect(o.anchor, unittest.equals('foo')); |
| 71 unittest.expect(o.label, unittest.equals('foo')); | 71 unittest.expect(o.label, unittest.equals('foo')); |
| 72 unittest.expect(o.labelWithOp, unittest.equals('foo')); | 72 unittest.expect(o.labelWithOp, unittest.equals('foo')); |
| 73 } | 73 } |
| 74 buildCounterContextFacets--; | 74 buildCounterContextFacets--; |
| 75 } | 75 } |
| 76 | 76 |
| 77 buildUnnamed242() { | 77 buildUnnamed244() { |
| 78 var o = new core.List<api.ContextFacets>(); | 78 var o = new core.List<api.ContextFacets>(); |
| 79 o.add(buildContextFacets()); | 79 o.add(buildContextFacets()); |
| 80 o.add(buildContextFacets()); | 80 o.add(buildContextFacets()); |
| 81 return o; | 81 return o; |
| 82 } | 82 } |
| 83 | 83 |
| 84 checkUnnamed242(core.List<api.ContextFacets> o) { | 84 checkUnnamed244(core.List<api.ContextFacets> o) { |
| 85 unittest.expect(o, unittest.hasLength(2)); | 85 unittest.expect(o, unittest.hasLength(2)); |
| 86 checkContextFacets(o[0]); | 86 checkContextFacets(o[0]); |
| 87 checkContextFacets(o[1]); | 87 checkContextFacets(o[1]); |
| 88 } | 88 } |
| 89 | 89 |
| 90 buildUnnamed243() { | 90 buildUnnamed245() { |
| 91 var o = new core.List<core.List<api.ContextFacets>>(); | 91 var o = new core.List<core.List<api.ContextFacets>>(); |
| 92 o.add(buildUnnamed242()); | 92 o.add(buildUnnamed244()); |
| 93 o.add(buildUnnamed242()); | 93 o.add(buildUnnamed244()); |
| 94 return o; | 94 return o; |
| 95 } | 95 } |
| 96 | 96 |
| 97 checkUnnamed243(core.List<core.List<api.ContextFacets>> o) { | 97 checkUnnamed245(core.List<core.List<api.ContextFacets>> o) { |
| 98 unittest.expect(o, unittest.hasLength(2)); | 98 unittest.expect(o, unittest.hasLength(2)); |
| 99 checkUnnamed242(o[0]); | 99 checkUnnamed244(o[0]); |
| 100 checkUnnamed242(o[1]); | 100 checkUnnamed244(o[1]); |
| 101 } | 101 } |
| 102 | 102 |
| 103 core.int buildCounterContext = 0; | 103 core.int buildCounterContext = 0; |
| 104 buildContext() { | 104 buildContext() { |
| 105 var o = new api.Context(); | 105 var o = new api.Context(); |
| 106 buildCounterContext++; | 106 buildCounterContext++; |
| 107 if (buildCounterContext < 3) { | 107 if (buildCounterContext < 3) { |
| 108 o.facets = buildUnnamed243(); | 108 o.facets = buildUnnamed245(); |
| 109 o.title = "foo"; | 109 o.title = "foo"; |
| 110 } | 110 } |
| 111 buildCounterContext--; | 111 buildCounterContext--; |
| 112 return o; | 112 return o; |
| 113 } | 113 } |
| 114 | 114 |
| 115 checkContext(api.Context o) { | 115 checkContext(api.Context o) { |
| 116 buildCounterContext++; | 116 buildCounterContext++; |
| 117 if (buildCounterContext < 3) { | 117 if (buildCounterContext < 3) { |
| 118 checkUnnamed243(o.facets); | 118 checkUnnamed245(o.facets); |
| 119 unittest.expect(o.title, unittest.equals('foo')); | 119 unittest.expect(o.title, unittest.equals('foo')); |
| 120 } | 120 } |
| 121 buildCounterContext--; | 121 buildCounterContext--; |
| 122 } | 122 } |
| 123 | 123 |
| 124 core.int buildCounterPromotionBodyLines = 0; | 124 core.int buildCounterPromotionBodyLines = 0; |
| 125 buildPromotionBodyLines() { | 125 buildPromotionBodyLines() { |
| 126 var o = new api.PromotionBodyLines(); | 126 var o = new api.PromotionBodyLines(); |
| 127 buildCounterPromotionBodyLines++; | 127 buildCounterPromotionBodyLines++; |
| 128 if (buildCounterPromotionBodyLines < 3) { | 128 if (buildCounterPromotionBodyLines < 3) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 139 buildCounterPromotionBodyLines++; | 139 buildCounterPromotionBodyLines++; |
| 140 if (buildCounterPromotionBodyLines < 3) { | 140 if (buildCounterPromotionBodyLines < 3) { |
| 141 unittest.expect(o.htmlTitle, unittest.equals('foo')); | 141 unittest.expect(o.htmlTitle, unittest.equals('foo')); |
| 142 unittest.expect(o.link, unittest.equals('foo')); | 142 unittest.expect(o.link, unittest.equals('foo')); |
| 143 unittest.expect(o.title, unittest.equals('foo')); | 143 unittest.expect(o.title, unittest.equals('foo')); |
| 144 unittest.expect(o.url, unittest.equals('foo')); | 144 unittest.expect(o.url, unittest.equals('foo')); |
| 145 } | 145 } |
| 146 buildCounterPromotionBodyLines--; | 146 buildCounterPromotionBodyLines--; |
| 147 } | 147 } |
| 148 | 148 |
| 149 buildUnnamed244() { | 149 buildUnnamed246() { |
| 150 var o = new core.List<api.PromotionBodyLines>(); | 150 var o = new core.List<api.PromotionBodyLines>(); |
| 151 o.add(buildPromotionBodyLines()); | 151 o.add(buildPromotionBodyLines()); |
| 152 o.add(buildPromotionBodyLines()); | 152 o.add(buildPromotionBodyLines()); |
| 153 return o; | 153 return o; |
| 154 } | 154 } |
| 155 | 155 |
| 156 checkUnnamed244(core.List<api.PromotionBodyLines> o) { | 156 checkUnnamed246(core.List<api.PromotionBodyLines> o) { |
| 157 unittest.expect(o, unittest.hasLength(2)); | 157 unittest.expect(o, unittest.hasLength(2)); |
| 158 checkPromotionBodyLines(o[0]); | 158 checkPromotionBodyLines(o[0]); |
| 159 checkPromotionBodyLines(o[1]); | 159 checkPromotionBodyLines(o[1]); |
| 160 } | 160 } |
| 161 | 161 |
| 162 core.int buildCounterPromotionImage = 0; | 162 core.int buildCounterPromotionImage = 0; |
| 163 buildPromotionImage() { | 163 buildPromotionImage() { |
| 164 var o = new api.PromotionImage(); | 164 var o = new api.PromotionImage(); |
| 165 buildCounterPromotionImage++; | 165 buildCounterPromotionImage++; |
| 166 if (buildCounterPromotionImage < 3) { | 166 if (buildCounterPromotionImage < 3) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 180 unittest.expect(o.width, unittest.equals(42)); | 180 unittest.expect(o.width, unittest.equals(42)); |
| 181 } | 181 } |
| 182 buildCounterPromotionImage--; | 182 buildCounterPromotionImage--; |
| 183 } | 183 } |
| 184 | 184 |
| 185 core.int buildCounterPromotion = 0; | 185 core.int buildCounterPromotion = 0; |
| 186 buildPromotion() { | 186 buildPromotion() { |
| 187 var o = new api.Promotion(); | 187 var o = new api.Promotion(); |
| 188 buildCounterPromotion++; | 188 buildCounterPromotion++; |
| 189 if (buildCounterPromotion < 3) { | 189 if (buildCounterPromotion < 3) { |
| 190 o.bodyLines = buildUnnamed244(); | 190 o.bodyLines = buildUnnamed246(); |
| 191 o.displayLink = "foo"; | 191 o.displayLink = "foo"; |
| 192 o.htmlTitle = "foo"; | 192 o.htmlTitle = "foo"; |
| 193 o.image = buildPromotionImage(); | 193 o.image = buildPromotionImage(); |
| 194 o.link = "foo"; | 194 o.link = "foo"; |
| 195 o.title = "foo"; | 195 o.title = "foo"; |
| 196 } | 196 } |
| 197 buildCounterPromotion--; | 197 buildCounterPromotion--; |
| 198 return o; | 198 return o; |
| 199 } | 199 } |
| 200 | 200 |
| 201 checkPromotion(api.Promotion o) { | 201 checkPromotion(api.Promotion o) { |
| 202 buildCounterPromotion++; | 202 buildCounterPromotion++; |
| 203 if (buildCounterPromotion < 3) { | 203 if (buildCounterPromotion < 3) { |
| 204 checkUnnamed244(o.bodyLines); | 204 checkUnnamed246(o.bodyLines); |
| 205 unittest.expect(o.displayLink, unittest.equals('foo')); | 205 unittest.expect(o.displayLink, unittest.equals('foo')); |
| 206 unittest.expect(o.htmlTitle, unittest.equals('foo')); | 206 unittest.expect(o.htmlTitle, unittest.equals('foo')); |
| 207 checkPromotionImage(o.image); | 207 checkPromotionImage(o.image); |
| 208 unittest.expect(o.link, unittest.equals('foo')); | 208 unittest.expect(o.link, unittest.equals('foo')); |
| 209 unittest.expect(o.title, unittest.equals('foo')); | 209 unittest.expect(o.title, unittest.equals('foo')); |
| 210 } | 210 } |
| 211 buildCounterPromotion--; | 211 buildCounterPromotion--; |
| 212 } | 212 } |
| 213 | 213 |
| 214 core.int buildCounterQuery = 0; | 214 core.int buildCounterQuery = 0; |
| 215 buildQuery() { | 215 buildQuery() { |
| 216 var o = new api.Query(); | 216 var o = new api.Query(); |
| 217 buildCounterQuery++; | 217 buildCounterQuery++; |
| 218 if (buildCounterQuery < 3) { | 218 if (buildCounterQuery < 3) { |
| 219 o.count = 42; | 219 o.count = 42; |
| 220 o.cr = "foo"; | 220 o.cr = "foo"; |
| 221 o.cref = "foo"; | |
| 222 o.cx = "foo"; | 221 o.cx = "foo"; |
| 223 o.dateRestrict = "foo"; | 222 o.dateRestrict = "foo"; |
| 224 o.disableCnTwTranslation = "foo"; | 223 o.disableCnTwTranslation = "foo"; |
| 225 o.exactTerms = "foo"; | 224 o.exactTerms = "foo"; |
| 226 o.excludeTerms = "foo"; | 225 o.excludeTerms = "foo"; |
| 227 o.fileType = "foo"; | 226 o.fileType = "foo"; |
| 228 o.filter = "foo"; | 227 o.filter = "foo"; |
| 229 o.gl = "foo"; | 228 o.gl = "foo"; |
| 230 o.googleHost = "foo"; | 229 o.googleHost = "foo"; |
| 231 o.highRange = "foo"; | 230 o.highRange = "foo"; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 256 } | 255 } |
| 257 buildCounterQuery--; | 256 buildCounterQuery--; |
| 258 return o; | 257 return o; |
| 259 } | 258 } |
| 260 | 259 |
| 261 checkQuery(api.Query o) { | 260 checkQuery(api.Query o) { |
| 262 buildCounterQuery++; | 261 buildCounterQuery++; |
| 263 if (buildCounterQuery < 3) { | 262 if (buildCounterQuery < 3) { |
| 264 unittest.expect(o.count, unittest.equals(42)); | 263 unittest.expect(o.count, unittest.equals(42)); |
| 265 unittest.expect(o.cr, unittest.equals('foo')); | 264 unittest.expect(o.cr, unittest.equals('foo')); |
| 266 unittest.expect(o.cref, unittest.equals('foo')); | |
| 267 unittest.expect(o.cx, unittest.equals('foo')); | 265 unittest.expect(o.cx, unittest.equals('foo')); |
| 268 unittest.expect(o.dateRestrict, unittest.equals('foo')); | 266 unittest.expect(o.dateRestrict, unittest.equals('foo')); |
| 269 unittest.expect(o.disableCnTwTranslation, unittest.equals('foo')); | 267 unittest.expect(o.disableCnTwTranslation, unittest.equals('foo')); |
| 270 unittest.expect(o.exactTerms, unittest.equals('foo')); | 268 unittest.expect(o.exactTerms, unittest.equals('foo')); |
| 271 unittest.expect(o.excludeTerms, unittest.equals('foo')); | 269 unittest.expect(o.excludeTerms, unittest.equals('foo')); |
| 272 unittest.expect(o.fileType, unittest.equals('foo')); | 270 unittest.expect(o.fileType, unittest.equals('foo')); |
| 273 unittest.expect(o.filter, unittest.equals('foo')); | 271 unittest.expect(o.filter, unittest.equals('foo')); |
| 274 unittest.expect(o.gl, unittest.equals('foo')); | 272 unittest.expect(o.gl, unittest.equals('foo')); |
| 275 unittest.expect(o.googleHost, unittest.equals('foo')); | 273 unittest.expect(o.googleHost, unittest.equals('foo')); |
| 276 unittest.expect(o.highRange, unittest.equals('foo')); | 274 unittest.expect(o.highRange, unittest.equals('foo')); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 checkResultLabels(api.ResultLabels o) { | 347 checkResultLabels(api.ResultLabels o) { |
| 350 buildCounterResultLabels++; | 348 buildCounterResultLabels++; |
| 351 if (buildCounterResultLabels < 3) { | 349 if (buildCounterResultLabels < 3) { |
| 352 unittest.expect(o.displayName, unittest.equals('foo')); | 350 unittest.expect(o.displayName, unittest.equals('foo')); |
| 353 unittest.expect(o.labelWithOp, unittest.equals('foo')); | 351 unittest.expect(o.labelWithOp, unittest.equals('foo')); |
| 354 unittest.expect(o.name, unittest.equals('foo')); | 352 unittest.expect(o.name, unittest.equals('foo')); |
| 355 } | 353 } |
| 356 buildCounterResultLabels--; | 354 buildCounterResultLabels--; |
| 357 } | 355 } |
| 358 | 356 |
| 359 buildUnnamed245() { | 357 buildUnnamed247() { |
| 360 var o = new core.List<api.ResultLabels>(); | 358 var o = new core.List<api.ResultLabels>(); |
| 361 o.add(buildResultLabels()); | 359 o.add(buildResultLabels()); |
| 362 o.add(buildResultLabels()); | 360 o.add(buildResultLabels()); |
| 363 return o; | 361 return o; |
| 364 } | 362 } |
| 365 | 363 |
| 366 checkUnnamed245(core.List<api.ResultLabels> o) { | 364 checkUnnamed247(core.List<api.ResultLabels> o) { |
| 367 unittest.expect(o, unittest.hasLength(2)); | 365 unittest.expect(o, unittest.hasLength(2)); |
| 368 checkResultLabels(o[0]); | 366 checkResultLabels(o[0]); |
| 369 checkResultLabels(o[1]); | 367 checkResultLabels(o[1]); |
| 370 } | 368 } |
| 371 | 369 |
| 372 buildUnnamed246() { | 370 buildUnnamed248() { |
| 373 var o = new core.Map<core.String, core.Object>(); | 371 var o = new core.Map<core.String, core.Object>(); |
| 374 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 372 o["x"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 375 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; | 373 o["y"] = {'list' : [1, 2, 3], 'bool' : true, 'string' : 'foo'}; |
| 376 return o; | 374 return o; |
| 377 } | 375 } |
| 378 | 376 |
| 379 checkUnnamed246(core.Map<core.String, core.Object> o) { | 377 checkUnnamed248(core.Map<core.String, core.Object> o) { |
| 380 unittest.expect(o, unittest.hasLength(2)); | 378 unittest.expect(o, unittest.hasLength(2)); |
| 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')); | 379 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')); |
| 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')); | 380 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')); |
| 383 } | 381 } |
| 384 | 382 |
| 385 buildUnnamed247() { | 383 buildUnnamed249() { |
| 386 var o = new core.List<core.Map<core.String, core.Object>>(); | 384 var o = new core.List<core.Map<core.String, core.Object>>(); |
| 387 o.add(buildUnnamed246()); | 385 o.add(buildUnnamed248()); |
| 388 o.add(buildUnnamed246()); | 386 o.add(buildUnnamed248()); |
| 389 return o; | 387 return o; |
| 390 } | 388 } |
| 391 | 389 |
| 392 checkUnnamed247(core.List<core.Map<core.String, core.Object>> o) { | 390 checkUnnamed249(core.List<core.Map<core.String, core.Object>> o) { |
| 393 unittest.expect(o, unittest.hasLength(2)); | 391 unittest.expect(o, unittest.hasLength(2)); |
| 394 checkUnnamed246(o[0]); | 392 checkUnnamed248(o[0]); |
| 395 checkUnnamed246(o[1]); | 393 checkUnnamed248(o[1]); |
| 396 } | 394 } |
| 397 | 395 |
| 398 buildUnnamed248() { | 396 buildUnnamed250() { |
| 399 var o = new core.Map<core.String, core.List<core.Map<core.String, core.Object>
>>(); | 397 var o = new core.Map<core.String, core.List<core.Map<core.String, core.Object>
>>(); |
| 400 o["x"] = buildUnnamed247(); | 398 o["x"] = buildUnnamed249(); |
| 401 o["y"] = buildUnnamed247(); | 399 o["y"] = buildUnnamed249(); |
| 402 return o; | 400 return o; |
| 403 } | 401 } |
| 404 | 402 |
| 405 checkUnnamed248(core.Map<core.String, core.List<core.Map<core.String, core.Objec
t>>> o) { | 403 checkUnnamed250(core.Map<core.String, core.List<core.Map<core.String, core.Objec
t>>> o) { |
| 406 unittest.expect(o, unittest.hasLength(2)); | 404 unittest.expect(o, unittest.hasLength(2)); |
| 407 checkUnnamed247(o["x"]); | 405 checkUnnamed249(o["x"]); |
| 408 checkUnnamed247(o["y"]); | 406 checkUnnamed249(o["y"]); |
| 409 } | 407 } |
| 410 | 408 |
| 411 core.int buildCounterResult = 0; | 409 core.int buildCounterResult = 0; |
| 412 buildResult() { | 410 buildResult() { |
| 413 var o = new api.Result(); | 411 var o = new api.Result(); |
| 414 buildCounterResult++; | 412 buildCounterResult++; |
| 415 if (buildCounterResult < 3) { | 413 if (buildCounterResult < 3) { |
| 416 o.cacheId = "foo"; | 414 o.cacheId = "foo"; |
| 417 o.displayLink = "foo"; | 415 o.displayLink = "foo"; |
| 418 o.fileFormat = "foo"; | 416 o.fileFormat = "foo"; |
| 419 o.formattedUrl = "foo"; | 417 o.formattedUrl = "foo"; |
| 420 o.htmlFormattedUrl = "foo"; | 418 o.htmlFormattedUrl = "foo"; |
| 421 o.htmlSnippet = "foo"; | 419 o.htmlSnippet = "foo"; |
| 422 o.htmlTitle = "foo"; | 420 o.htmlTitle = "foo"; |
| 423 o.image = buildResultImage(); | 421 o.image = buildResultImage(); |
| 424 o.kind = "foo"; | 422 o.kind = "foo"; |
| 425 o.labels = buildUnnamed245(); | 423 o.labels = buildUnnamed247(); |
| 426 o.link = "foo"; | 424 o.link = "foo"; |
| 427 o.mime = "foo"; | 425 o.mime = "foo"; |
| 428 o.pagemap = buildUnnamed248(); | 426 o.pagemap = buildUnnamed250(); |
| 429 o.snippet = "foo"; | 427 o.snippet = "foo"; |
| 430 o.title = "foo"; | 428 o.title = "foo"; |
| 431 } | 429 } |
| 432 buildCounterResult--; | 430 buildCounterResult--; |
| 433 return o; | 431 return o; |
| 434 } | 432 } |
| 435 | 433 |
| 436 checkResult(api.Result o) { | 434 checkResult(api.Result o) { |
| 437 buildCounterResult++; | 435 buildCounterResult++; |
| 438 if (buildCounterResult < 3) { | 436 if (buildCounterResult < 3) { |
| 439 unittest.expect(o.cacheId, unittest.equals('foo')); | 437 unittest.expect(o.cacheId, unittest.equals('foo')); |
| 440 unittest.expect(o.displayLink, unittest.equals('foo')); | 438 unittest.expect(o.displayLink, unittest.equals('foo')); |
| 441 unittest.expect(o.fileFormat, unittest.equals('foo')); | 439 unittest.expect(o.fileFormat, unittest.equals('foo')); |
| 442 unittest.expect(o.formattedUrl, unittest.equals('foo')); | 440 unittest.expect(o.formattedUrl, unittest.equals('foo')); |
| 443 unittest.expect(o.htmlFormattedUrl, unittest.equals('foo')); | 441 unittest.expect(o.htmlFormattedUrl, unittest.equals('foo')); |
| 444 unittest.expect(o.htmlSnippet, unittest.equals('foo')); | 442 unittest.expect(o.htmlSnippet, unittest.equals('foo')); |
| 445 unittest.expect(o.htmlTitle, unittest.equals('foo')); | 443 unittest.expect(o.htmlTitle, unittest.equals('foo')); |
| 446 checkResultImage(o.image); | 444 checkResultImage(o.image); |
| 447 unittest.expect(o.kind, unittest.equals('foo')); | 445 unittest.expect(o.kind, unittest.equals('foo')); |
| 448 checkUnnamed245(o.labels); | 446 checkUnnamed247(o.labels); |
| 449 unittest.expect(o.link, unittest.equals('foo')); | 447 unittest.expect(o.link, unittest.equals('foo')); |
| 450 unittest.expect(o.mime, unittest.equals('foo')); | 448 unittest.expect(o.mime, unittest.equals('foo')); |
| 451 checkUnnamed248(o.pagemap); | 449 checkUnnamed250(o.pagemap); |
| 452 unittest.expect(o.snippet, unittest.equals('foo')); | 450 unittest.expect(o.snippet, unittest.equals('foo')); |
| 453 unittest.expect(o.title, unittest.equals('foo')); | 451 unittest.expect(o.title, unittest.equals('foo')); |
| 454 } | 452 } |
| 455 buildCounterResult--; | 453 buildCounterResult--; |
| 456 } | 454 } |
| 457 | 455 |
| 458 buildUnnamed249() { | 456 buildUnnamed251() { |
| 459 var o = new core.List<api.Result>(); | 457 var o = new core.List<api.Result>(); |
| 460 o.add(buildResult()); | 458 o.add(buildResult()); |
| 461 o.add(buildResult()); | 459 o.add(buildResult()); |
| 462 return o; | 460 return o; |
| 463 } | 461 } |
| 464 | 462 |
| 465 checkUnnamed249(core.List<api.Result> o) { | 463 checkUnnamed251(core.List<api.Result> o) { |
| 466 unittest.expect(o, unittest.hasLength(2)); | 464 unittest.expect(o, unittest.hasLength(2)); |
| 467 checkResult(o[0]); | 465 checkResult(o[0]); |
| 468 checkResult(o[1]); | 466 checkResult(o[1]); |
| 469 } | 467 } |
| 470 | 468 |
| 471 buildUnnamed250() { | 469 buildUnnamed252() { |
| 472 var o = new core.List<api.Promotion>(); | 470 var o = new core.List<api.Promotion>(); |
| 473 o.add(buildPromotion()); | 471 o.add(buildPromotion()); |
| 474 o.add(buildPromotion()); | 472 o.add(buildPromotion()); |
| 475 return o; | 473 return o; |
| 476 } | 474 } |
| 477 | 475 |
| 478 checkUnnamed250(core.List<api.Promotion> o) { | 476 checkUnnamed252(core.List<api.Promotion> o) { |
| 479 unittest.expect(o, unittest.hasLength(2)); | 477 unittest.expect(o, unittest.hasLength(2)); |
| 480 checkPromotion(o[0]); | 478 checkPromotion(o[0]); |
| 481 checkPromotion(o[1]); | 479 checkPromotion(o[1]); |
| 482 } | 480 } |
| 483 | 481 |
| 484 buildUnnamed251() { | 482 buildUnnamed253() { |
| 485 var o = new core.List<api.Query>(); | 483 var o = new core.List<api.Query>(); |
| 486 o.add(buildQuery()); | 484 o.add(buildQuery()); |
| 487 o.add(buildQuery()); | 485 o.add(buildQuery()); |
| 488 return o; | 486 return o; |
| 489 } | 487 } |
| 490 | 488 |
| 491 checkUnnamed251(core.List<api.Query> o) { | 489 checkUnnamed253(core.List<api.Query> o) { |
| 492 unittest.expect(o, unittest.hasLength(2)); | 490 unittest.expect(o, unittest.hasLength(2)); |
| 493 checkQuery(o[0]); | 491 checkQuery(o[0]); |
| 494 checkQuery(o[1]); | 492 checkQuery(o[1]); |
| 495 } | 493 } |
| 496 | 494 |
| 497 buildUnnamed252() { | 495 buildUnnamed254() { |
| 498 var o = new core.Map<core.String, core.List<api.Query>>(); | 496 var o = new core.Map<core.String, core.List<api.Query>>(); |
| 499 o["x"] = buildUnnamed251(); | 497 o["x"] = buildUnnamed253(); |
| 500 o["y"] = buildUnnamed251(); | 498 o["y"] = buildUnnamed253(); |
| 501 return o; | 499 return o; |
| 502 } | 500 } |
| 503 | 501 |
| 504 checkUnnamed252(core.Map<core.String, core.List<api.Query>> o) { | 502 checkUnnamed254(core.Map<core.String, core.List<api.Query>> o) { |
| 505 unittest.expect(o, unittest.hasLength(2)); | 503 unittest.expect(o, unittest.hasLength(2)); |
| 506 checkUnnamed251(o["x"]); | 504 checkUnnamed253(o["x"]); |
| 507 checkUnnamed251(o["y"]); | 505 checkUnnamed253(o["y"]); |
| 508 } | 506 } |
| 509 | 507 |
| 510 core.int buildCounterSearchSearchInformation = 0; | 508 core.int buildCounterSearchSearchInformation = 0; |
| 511 buildSearchSearchInformation() { | 509 buildSearchSearchInformation() { |
| 512 var o = new api.SearchSearchInformation(); | 510 var o = new api.SearchSearchInformation(); |
| 513 buildCounterSearchSearchInformation++; | 511 buildCounterSearchSearchInformation++; |
| 514 if (buildCounterSearchSearchInformation < 3) { | 512 if (buildCounterSearchSearchInformation < 3) { |
| 515 o.formattedSearchTime = "foo"; | 513 o.formattedSearchTime = "foo"; |
| 516 o.formattedTotalResults = "foo"; | 514 o.formattedTotalResults = "foo"; |
| 517 o.searchTime = 42.0; | 515 o.searchTime = 42.0; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 } | 571 } |
| 574 buildCounterSearchUrl--; | 572 buildCounterSearchUrl--; |
| 575 } | 573 } |
| 576 | 574 |
| 577 core.int buildCounterSearch = 0; | 575 core.int buildCounterSearch = 0; |
| 578 buildSearch() { | 576 buildSearch() { |
| 579 var o = new api.Search(); | 577 var o = new api.Search(); |
| 580 buildCounterSearch++; | 578 buildCounterSearch++; |
| 581 if (buildCounterSearch < 3) { | 579 if (buildCounterSearch < 3) { |
| 582 o.context = buildContext(); | 580 o.context = buildContext(); |
| 583 o.items = buildUnnamed249(); | 581 o.items = buildUnnamed251(); |
| 584 o.kind = "foo"; | 582 o.kind = "foo"; |
| 585 o.promotions = buildUnnamed250(); | 583 o.promotions = buildUnnamed252(); |
| 586 o.queries = buildUnnamed252(); | 584 o.queries = buildUnnamed254(); |
| 587 o.searchInformation = buildSearchSearchInformation(); | 585 o.searchInformation = buildSearchSearchInformation(); |
| 588 o.spelling = buildSearchSpelling(); | 586 o.spelling = buildSearchSpelling(); |
| 589 o.url = buildSearchUrl(); | 587 o.url = buildSearchUrl(); |
| 590 } | 588 } |
| 591 buildCounterSearch--; | 589 buildCounterSearch--; |
| 592 return o; | 590 return o; |
| 593 } | 591 } |
| 594 | 592 |
| 595 checkSearch(api.Search o) { | 593 checkSearch(api.Search o) { |
| 596 buildCounterSearch++; | 594 buildCounterSearch++; |
| 597 if (buildCounterSearch < 3) { | 595 if (buildCounterSearch < 3) { |
| 598 checkContext(o.context); | 596 checkContext(o.context); |
| 599 checkUnnamed249(o.items); | 597 checkUnnamed251(o.items); |
| 600 unittest.expect(o.kind, unittest.equals('foo')); | 598 unittest.expect(o.kind, unittest.equals('foo')); |
| 601 checkUnnamed250(o.promotions); | 599 checkUnnamed252(o.promotions); |
| 602 checkUnnamed252(o.queries); | 600 checkUnnamed254(o.queries); |
| 603 checkSearchSearchInformation(o.searchInformation); | 601 checkSearchSearchInformation(o.searchInformation); |
| 604 checkSearchSpelling(o.spelling); | 602 checkSearchSpelling(o.spelling); |
| 605 checkSearchUrl(o.url); | 603 checkSearchUrl(o.url); |
| 606 } | 604 } |
| 607 buildCounterSearch--; | 605 buildCounterSearch--; |
| 608 } | 606 } |
| 609 | 607 |
| 610 | 608 |
| 611 main() { | 609 main() { |
| 612 unittest.group("obj-schema-ContextFacets", () { | 610 unittest.group("obj-schema-ContextFacets", () { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 | 725 |
| 728 | 726 |
| 729 unittest.group("resource-CseResourceApi", () { | 727 unittest.group("resource-CseResourceApi", () { |
| 730 unittest.test("method--list", () { | 728 unittest.test("method--list", () { |
| 731 | 729 |
| 732 var mock = new HttpServerMock(); | 730 var mock = new HttpServerMock(); |
| 733 api.CseResourceApi res = new api.CustomsearchApi(mock).cse; | 731 api.CseResourceApi res = new api.CustomsearchApi(mock).cse; |
| 734 var arg_q = "foo"; | 732 var arg_q = "foo"; |
| 735 var arg_c2coff = "foo"; | 733 var arg_c2coff = "foo"; |
| 736 var arg_cr = "foo"; | 734 var arg_cr = "foo"; |
| 737 var arg_cref = "foo"; | |
| 738 var arg_cx = "foo"; | 735 var arg_cx = "foo"; |
| 739 var arg_dateRestrict = "foo"; | 736 var arg_dateRestrict = "foo"; |
| 740 var arg_exactTerms = "foo"; | 737 var arg_exactTerms = "foo"; |
| 741 var arg_excludeTerms = "foo"; | 738 var arg_excludeTerms = "foo"; |
| 742 var arg_fileType = "foo"; | 739 var arg_fileType = "foo"; |
| 743 var arg_filter = "foo"; | 740 var arg_filter = "foo"; |
| 744 var arg_gl = "foo"; | 741 var arg_gl = "foo"; |
| 745 var arg_googlehost = "foo"; | 742 var arg_googlehost = "foo"; |
| 746 var arg_highRange = "foo"; | 743 var arg_highRange = "foo"; |
| 747 var arg_hl = "foo"; | 744 var arg_hl = "foo"; |
| 748 var arg_hq = "foo"; | 745 var arg_hq = "foo"; |
| 749 var arg_imgColorType = "foo"; | 746 var arg_imgColorType = "foo"; |
| 750 var arg_imgDominantColor = "foo"; | 747 var arg_imgDominantColor = "foo"; |
| 751 var arg_imgSize = "foo"; | 748 var arg_imgSize = "foo"; |
| 752 var arg_imgType = "foo"; | 749 var arg_imgType = "foo"; |
| 753 var arg_linkSite = "foo"; | 750 var arg_linkSite = "foo"; |
| 754 var arg_lowRange = "foo"; | 751 var arg_lowRange = "foo"; |
| 755 var arg_lr = "foo"; | 752 var arg_lr = "foo"; |
| 756 var arg_num = 42; | 753 var arg_num = 42; |
| 757 var arg_orTerms = "foo"; | 754 var arg_orTerms = "foo"; |
| 758 var arg_relatedSite = "foo"; | 755 var arg_relatedSite = "foo"; |
| 759 var arg_rights = "foo"; | 756 var arg_rights = "foo"; |
| 760 var arg_safe = "foo"; | 757 var arg_safe = "foo"; |
| 761 var arg_searchType = "foo"; | 758 var arg_searchType = "foo"; |
| 762 var arg_siteSearch = "foo"; | 759 var arg_siteSearch = "foo"; |
| 763 var arg_siteSearchFilter = "foo"; | 760 var arg_siteSearchFilter = "foo"; |
| 764 var arg_sort = "foo"; | 761 var arg_sort = "foo"; |
| 765 var arg_start = 42; | 762 var arg_start = 42; |
| 766 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 763 mock.register(unittest.expectAsync2((http.BaseRequest req, json) { |
| 767 var path = (req.url).path; | 764 var path = (req.url).path; |
| 768 var pathOffset = 0; | 765 var pathOffset = 0; |
| 769 var index; | 766 var index; |
| 770 var subPart; | 767 var subPart; |
| 771 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 768 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 772 pathOffset += 1; | 769 pathOffset += 1; |
| 773 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("customsearch/")); | 770 unittest.expect(path.substring(pathOffset, pathOffset + 13), unittest.eq
uals("customsearch/")); |
| 774 pathOffset += 13; | 771 pathOffset += 13; |
| 775 unittest.expect(path.substring(pathOffset, pathOffset + 2), unittest.equ
als("v1")); | 772 unittest.expect(path.substring(pathOffset, pathOffset + 2), unittest.equ
als("v1")); |
| 776 pathOffset += 2; | 773 pathOffset += 2; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 787 } | 784 } |
| 788 if (query.length > 0) { | 785 if (query.length > 0) { |
| 789 for (var part in query.split("&")) { | 786 for (var part in query.split("&")) { |
| 790 var keyvalue = part.split("="); | 787 var keyvalue = part.split("="); |
| 791 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | 788 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 792 } | 789 } |
| 793 } | 790 } |
| 794 unittest.expect(queryMap["q"].first, unittest.equals(arg_q)); | 791 unittest.expect(queryMap["q"].first, unittest.equals(arg_q)); |
| 795 unittest.expect(queryMap["c2coff"].first, unittest.equals(arg_c2coff)); | 792 unittest.expect(queryMap["c2coff"].first, unittest.equals(arg_c2coff)); |
| 796 unittest.expect(queryMap["cr"].first, unittest.equals(arg_cr)); | 793 unittest.expect(queryMap["cr"].first, unittest.equals(arg_cr)); |
| 797 unittest.expect(queryMap["cref"].first, unittest.equals(arg_cref)); | |
| 798 unittest.expect(queryMap["cx"].first, unittest.equals(arg_cx)); | 794 unittest.expect(queryMap["cx"].first, unittest.equals(arg_cx)); |
| 799 unittest.expect(queryMap["dateRestrict"].first, unittest.equals(arg_date
Restrict)); | 795 unittest.expect(queryMap["dateRestrict"].first, unittest.equals(arg_date
Restrict)); |
| 800 unittest.expect(queryMap["exactTerms"].first, unittest.equals(arg_exactT
erms)); | 796 unittest.expect(queryMap["exactTerms"].first, unittest.equals(arg_exactT
erms)); |
| 801 unittest.expect(queryMap["excludeTerms"].first, unittest.equals(arg_excl
udeTerms)); | 797 unittest.expect(queryMap["excludeTerms"].first, unittest.equals(arg_excl
udeTerms)); |
| 802 unittest.expect(queryMap["fileType"].first, unittest.equals(arg_fileType
)); | 798 unittest.expect(queryMap["fileType"].first, unittest.equals(arg_fileType
)); |
| 803 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); | 799 unittest.expect(queryMap["filter"].first, unittest.equals(arg_filter)); |
| 804 unittest.expect(queryMap["gl"].first, unittest.equals(arg_gl)); | 800 unittest.expect(queryMap["gl"].first, unittest.equals(arg_gl)); |
| 805 unittest.expect(queryMap["googlehost"].first, unittest.equals(arg_google
host)); | 801 unittest.expect(queryMap["googlehost"].first, unittest.equals(arg_google
host)); |
| 806 unittest.expect(queryMap["highRange"].first, unittest.equals(arg_highRan
ge)); | 802 unittest.expect(queryMap["highRange"].first, unittest.equals(arg_highRan
ge)); |
| 807 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); | 803 unittest.expect(queryMap["hl"].first, unittest.equals(arg_hl)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 824 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); | 820 unittest.expect(queryMap["sort"].first, unittest.equals(arg_sort)); |
| 825 unittest.expect(core.int.parse(queryMap["start"].first), unittest.equals
(arg_start)); | 821 unittest.expect(core.int.parse(queryMap["start"].first), unittest.equals
(arg_start)); |
| 826 | 822 |
| 827 | 823 |
| 828 var h = { | 824 var h = { |
| 829 "content-type" : "application/json; charset=utf-8", | 825 "content-type" : "application/json; charset=utf-8", |
| 830 }; | 826 }; |
| 831 var resp = convert.JSON.encode(buildSearch()); | 827 var resp = convert.JSON.encode(buildSearch()); |
| 832 return new async.Future.value(stringResponse(200, h, resp)); | 828 return new async.Future.value(stringResponse(200, h, resp)); |
| 833 }), true); | 829 }), true); |
| 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) { | 830 res.list(arg_q, c2coff: arg_c2coff, cr: arg_cr, cx: arg_cx, dateRestrict:
arg_dateRestrict, exactTerms: arg_exactTerms, excludeTerms: arg_excludeTerms, fi
leType: arg_fileType, filter: arg_filter, gl: arg_gl, googlehost: arg_googlehost
, highRange: arg_highRange, hl: arg_hl, hq: arg_hq, imgColorType: arg_imgColorTy
pe, imgDominantColor: arg_imgDominantColor, imgSize: arg_imgSize, imgType: arg_i
mgType, linkSite: arg_linkSite, lowRange: arg_lowRange, lr: arg_lr, num: arg_num
, orTerms: arg_orTerms, relatedSite: arg_relatedSite, rights: arg_rights, safe:
arg_safe, searchType: arg_searchType, siteSearch: arg_siteSearch, siteSearchFilt
er: arg_siteSearchFilter, sort: arg_sort, start: arg_start).then(unittest.expect
Async1(((api.Search response) { |
| 835 checkSearch(response); | 831 checkSearch(response); |
| 836 }))); | 832 }))); |
| 837 }); | 833 }); |
| 838 | 834 |
| 839 }); | 835 }); |
| 840 | 836 |
| 841 | 837 |
| 842 } | 838 } |
| 843 | 839 |
| OLD | NEW |