OLD | NEW |
(Empty) | |
| 1 library googleapis.pagespeedonline.v2.test; |
| 2 |
| 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; |
| 7 |
| 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; |
| 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 |
| 15 import 'package:googleapis/pagespeedonline/v2.dart' as api; |
| 16 |
| 17 |
| 18 |
| 19 core.int buildCounterPagespeedApiFormatStringV2ArgsRects = 0; |
| 20 buildPagespeedApiFormatStringV2ArgsRects() { |
| 21 var o = new api.PagespeedApiFormatStringV2ArgsRects(); |
| 22 buildCounterPagespeedApiFormatStringV2ArgsRects++; |
| 23 if (buildCounterPagespeedApiFormatStringV2ArgsRects < 3) { |
| 24 o.height = 42; |
| 25 o.left = 42; |
| 26 o.top = 42; |
| 27 o.width = 42; |
| 28 } |
| 29 buildCounterPagespeedApiFormatStringV2ArgsRects--; |
| 30 return o; |
| 31 } |
| 32 |
| 33 checkPagespeedApiFormatStringV2ArgsRects(api.PagespeedApiFormatStringV2ArgsRects
o) { |
| 34 buildCounterPagespeedApiFormatStringV2ArgsRects++; |
| 35 if (buildCounterPagespeedApiFormatStringV2ArgsRects < 3) { |
| 36 unittest.expect(o.height, unittest.equals(42)); |
| 37 unittest.expect(o.left, unittest.equals(42)); |
| 38 unittest.expect(o.top, unittest.equals(42)); |
| 39 unittest.expect(o.width, unittest.equals(42)); |
| 40 } |
| 41 buildCounterPagespeedApiFormatStringV2ArgsRects--; |
| 42 } |
| 43 |
| 44 buildUnnamed1244() { |
| 45 var o = new core.List<api.PagespeedApiFormatStringV2ArgsRects>(); |
| 46 o.add(buildPagespeedApiFormatStringV2ArgsRects()); |
| 47 o.add(buildPagespeedApiFormatStringV2ArgsRects()); |
| 48 return o; |
| 49 } |
| 50 |
| 51 checkUnnamed1244(core.List<api.PagespeedApiFormatStringV2ArgsRects> o) { |
| 52 unittest.expect(o, unittest.hasLength(2)); |
| 53 checkPagespeedApiFormatStringV2ArgsRects(o[0]); |
| 54 checkPagespeedApiFormatStringV2ArgsRects(o[1]); |
| 55 } |
| 56 |
| 57 core.int buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects = 0; |
| 58 buildPagespeedApiFormatStringV2ArgsSecondaryRects() { |
| 59 var o = new api.PagespeedApiFormatStringV2ArgsSecondaryRects(); |
| 60 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects++; |
| 61 if (buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects < 3) { |
| 62 o.height = 42; |
| 63 o.left = 42; |
| 64 o.top = 42; |
| 65 o.width = 42; |
| 66 } |
| 67 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects--; |
| 68 return o; |
| 69 } |
| 70 |
| 71 checkPagespeedApiFormatStringV2ArgsSecondaryRects(api.PagespeedApiFormatStringV2
ArgsSecondaryRects o) { |
| 72 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects++; |
| 73 if (buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects < 3) { |
| 74 unittest.expect(o.height, unittest.equals(42)); |
| 75 unittest.expect(o.left, unittest.equals(42)); |
| 76 unittest.expect(o.top, unittest.equals(42)); |
| 77 unittest.expect(o.width, unittest.equals(42)); |
| 78 } |
| 79 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects--; |
| 80 } |
| 81 |
| 82 buildUnnamed1245() { |
| 83 var o = new core.List<api.PagespeedApiFormatStringV2ArgsSecondaryRects>(); |
| 84 o.add(buildPagespeedApiFormatStringV2ArgsSecondaryRects()); |
| 85 o.add(buildPagespeedApiFormatStringV2ArgsSecondaryRects()); |
| 86 return o; |
| 87 } |
| 88 |
| 89 checkUnnamed1245(core.List<api.PagespeedApiFormatStringV2ArgsSecondaryRects> o)
{ |
| 90 unittest.expect(o, unittest.hasLength(2)); |
| 91 checkPagespeedApiFormatStringV2ArgsSecondaryRects(o[0]); |
| 92 checkPagespeedApiFormatStringV2ArgsSecondaryRects(o[1]); |
| 93 } |
| 94 |
| 95 core.int buildCounterPagespeedApiFormatStringV2Args = 0; |
| 96 buildPagespeedApiFormatStringV2Args() { |
| 97 var o = new api.PagespeedApiFormatStringV2Args(); |
| 98 buildCounterPagespeedApiFormatStringV2Args++; |
| 99 if (buildCounterPagespeedApiFormatStringV2Args < 3) { |
| 100 o.key = "foo"; |
| 101 o.rects = buildUnnamed1244(); |
| 102 o.secondaryRects = buildUnnamed1245(); |
| 103 o.type = "foo"; |
| 104 o.value = "foo"; |
| 105 } |
| 106 buildCounterPagespeedApiFormatStringV2Args--; |
| 107 return o; |
| 108 } |
| 109 |
| 110 checkPagespeedApiFormatStringV2Args(api.PagespeedApiFormatStringV2Args o) { |
| 111 buildCounterPagespeedApiFormatStringV2Args++; |
| 112 if (buildCounterPagespeedApiFormatStringV2Args < 3) { |
| 113 unittest.expect(o.key, unittest.equals('foo')); |
| 114 checkUnnamed1244(o.rects); |
| 115 checkUnnamed1245(o.secondaryRects); |
| 116 unittest.expect(o.type, unittest.equals('foo')); |
| 117 unittest.expect(o.value, unittest.equals('foo')); |
| 118 } |
| 119 buildCounterPagespeedApiFormatStringV2Args--; |
| 120 } |
| 121 |
| 122 buildUnnamed1246() { |
| 123 var o = new core.List<api.PagespeedApiFormatStringV2Args>(); |
| 124 o.add(buildPagespeedApiFormatStringV2Args()); |
| 125 o.add(buildPagespeedApiFormatStringV2Args()); |
| 126 return o; |
| 127 } |
| 128 |
| 129 checkUnnamed1246(core.List<api.PagespeedApiFormatStringV2Args> o) { |
| 130 unittest.expect(o, unittest.hasLength(2)); |
| 131 checkPagespeedApiFormatStringV2Args(o[0]); |
| 132 checkPagespeedApiFormatStringV2Args(o[1]); |
| 133 } |
| 134 |
| 135 core.int buildCounterPagespeedApiFormatStringV2 = 0; |
| 136 buildPagespeedApiFormatStringV2() { |
| 137 var o = new api.PagespeedApiFormatStringV2(); |
| 138 buildCounterPagespeedApiFormatStringV2++; |
| 139 if (buildCounterPagespeedApiFormatStringV2 < 3) { |
| 140 o.args = buildUnnamed1246(); |
| 141 o.format = "foo"; |
| 142 } |
| 143 buildCounterPagespeedApiFormatStringV2--; |
| 144 return o; |
| 145 } |
| 146 |
| 147 checkPagespeedApiFormatStringV2(api.PagespeedApiFormatStringV2 o) { |
| 148 buildCounterPagespeedApiFormatStringV2++; |
| 149 if (buildCounterPagespeedApiFormatStringV2 < 3) { |
| 150 checkUnnamed1246(o.args); |
| 151 unittest.expect(o.format, unittest.equals('foo')); |
| 152 } |
| 153 buildCounterPagespeedApiFormatStringV2--; |
| 154 } |
| 155 |
| 156 core.int buildCounterPagespeedApiImageV2PageRect = 0; |
| 157 buildPagespeedApiImageV2PageRect() { |
| 158 var o = new api.PagespeedApiImageV2PageRect(); |
| 159 buildCounterPagespeedApiImageV2PageRect++; |
| 160 if (buildCounterPagespeedApiImageV2PageRect < 3) { |
| 161 o.height = 42; |
| 162 o.left = 42; |
| 163 o.top = 42; |
| 164 o.width = 42; |
| 165 } |
| 166 buildCounterPagespeedApiImageV2PageRect--; |
| 167 return o; |
| 168 } |
| 169 |
| 170 checkPagespeedApiImageV2PageRect(api.PagespeedApiImageV2PageRect o) { |
| 171 buildCounterPagespeedApiImageV2PageRect++; |
| 172 if (buildCounterPagespeedApiImageV2PageRect < 3) { |
| 173 unittest.expect(o.height, unittest.equals(42)); |
| 174 unittest.expect(o.left, unittest.equals(42)); |
| 175 unittest.expect(o.top, unittest.equals(42)); |
| 176 unittest.expect(o.width, unittest.equals(42)); |
| 177 } |
| 178 buildCounterPagespeedApiImageV2PageRect--; |
| 179 } |
| 180 |
| 181 core.int buildCounterPagespeedApiImageV2 = 0; |
| 182 buildPagespeedApiImageV2() { |
| 183 var o = new api.PagespeedApiImageV2(); |
| 184 buildCounterPagespeedApiImageV2++; |
| 185 if (buildCounterPagespeedApiImageV2 < 3) { |
| 186 o.data = "foo"; |
| 187 o.height = 42; |
| 188 o.key = "foo"; |
| 189 o.mimeType = "foo"; |
| 190 o.pageRect = buildPagespeedApiImageV2PageRect(); |
| 191 o.width = 42; |
| 192 } |
| 193 buildCounterPagespeedApiImageV2--; |
| 194 return o; |
| 195 } |
| 196 |
| 197 checkPagespeedApiImageV2(api.PagespeedApiImageV2 o) { |
| 198 buildCounterPagespeedApiImageV2++; |
| 199 if (buildCounterPagespeedApiImageV2 < 3) { |
| 200 unittest.expect(o.data, unittest.equals('foo')); |
| 201 unittest.expect(o.height, unittest.equals(42)); |
| 202 unittest.expect(o.key, unittest.equals('foo')); |
| 203 unittest.expect(o.mimeType, unittest.equals('foo')); |
| 204 checkPagespeedApiImageV2PageRect(o.pageRect); |
| 205 unittest.expect(o.width, unittest.equals(42)); |
| 206 } |
| 207 buildCounterPagespeedApiImageV2--; |
| 208 } |
| 209 |
| 210 buildUnnamed1247() { |
| 211 var o = new core.List<core.String>(); |
| 212 o.add("foo"); |
| 213 o.add("foo"); |
| 214 return o; |
| 215 } |
| 216 |
| 217 checkUnnamed1247(core.List<core.String> o) { |
| 218 unittest.expect(o, unittest.hasLength(2)); |
| 219 unittest.expect(o[0], unittest.equals('foo')); |
| 220 unittest.expect(o[1], unittest.equals('foo')); |
| 221 } |
| 222 |
| 223 buildUnnamed1248() { |
| 224 var o = new core.List<api.PagespeedApiFormatStringV2>(); |
| 225 o.add(buildPagespeedApiFormatStringV2()); |
| 226 o.add(buildPagespeedApiFormatStringV2()); |
| 227 return o; |
| 228 } |
| 229 |
| 230 checkUnnamed1248(core.List<api.PagespeedApiFormatStringV2> o) { |
| 231 unittest.expect(o, unittest.hasLength(2)); |
| 232 checkPagespeedApiFormatStringV2(o[0]); |
| 233 checkPagespeedApiFormatStringV2(o[1]); |
| 234 } |
| 235 |
| 236 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls = 0; |
| 237 buildResultFormattedResultsRuleResultsValueUrlBlocksUrls() { |
| 238 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls(); |
| 239 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; |
| 240 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { |
| 241 o.details = buildUnnamed1248(); |
| 242 o.result = buildPagespeedApiFormatStringV2(); |
| 243 } |
| 244 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; |
| 245 return o; |
| 246 } |
| 247 |
| 248 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(api.ResultFormattedResu
ltsRuleResultsValueUrlBlocksUrls o) { |
| 249 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; |
| 250 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { |
| 251 checkUnnamed1248(o.details); |
| 252 checkPagespeedApiFormatStringV2(o.result); |
| 253 } |
| 254 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; |
| 255 } |
| 256 |
| 257 buildUnnamed1249() { |
| 258 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls>
(); |
| 259 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); |
| 260 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); |
| 261 return o; |
| 262 } |
| 263 |
| 264 checkUnnamed1249(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUr
ls> o) { |
| 265 unittest.expect(o, unittest.hasLength(2)); |
| 266 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[0]); |
| 267 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[1]); |
| 268 } |
| 269 |
| 270 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocks = 0; |
| 271 buildResultFormattedResultsRuleResultsValueUrlBlocks() { |
| 272 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocks(); |
| 273 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; |
| 274 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { |
| 275 o.header = buildPagespeedApiFormatStringV2(); |
| 276 o.urls = buildUnnamed1249(); |
| 277 } |
| 278 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; |
| 279 return o; |
| 280 } |
| 281 |
| 282 checkResultFormattedResultsRuleResultsValueUrlBlocks(api.ResultFormattedResultsR
uleResultsValueUrlBlocks o) { |
| 283 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; |
| 284 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { |
| 285 checkPagespeedApiFormatStringV2(o.header); |
| 286 checkUnnamed1249(o.urls); |
| 287 } |
| 288 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; |
| 289 } |
| 290 |
| 291 buildUnnamed1250() { |
| 292 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>(); |
| 293 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); |
| 294 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); |
| 295 return o; |
| 296 } |
| 297 |
| 298 checkUnnamed1250(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>
o) { |
| 299 unittest.expect(o, unittest.hasLength(2)); |
| 300 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[0]); |
| 301 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[1]); |
| 302 } |
| 303 |
| 304 core.int buildCounterResultFormattedResultsRuleResultsValue = 0; |
| 305 buildResultFormattedResultsRuleResultsValue() { |
| 306 var o = new api.ResultFormattedResultsRuleResultsValue(); |
| 307 buildCounterResultFormattedResultsRuleResultsValue++; |
| 308 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { |
| 309 o.groups = buildUnnamed1247(); |
| 310 o.localizedRuleName = "foo"; |
| 311 o.ruleImpact = 42.0; |
| 312 o.summary = buildPagespeedApiFormatStringV2(); |
| 313 o.urlBlocks = buildUnnamed1250(); |
| 314 } |
| 315 buildCounterResultFormattedResultsRuleResultsValue--; |
| 316 return o; |
| 317 } |
| 318 |
| 319 checkResultFormattedResultsRuleResultsValue(api.ResultFormattedResultsRuleResult
sValue o) { |
| 320 buildCounterResultFormattedResultsRuleResultsValue++; |
| 321 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { |
| 322 checkUnnamed1247(o.groups); |
| 323 unittest.expect(o.localizedRuleName, unittest.equals('foo')); |
| 324 unittest.expect(o.ruleImpact, unittest.equals(42.0)); |
| 325 checkPagespeedApiFormatStringV2(o.summary); |
| 326 checkUnnamed1250(o.urlBlocks); |
| 327 } |
| 328 buildCounterResultFormattedResultsRuleResultsValue--; |
| 329 } |
| 330 |
| 331 buildUnnamed1251() { |
| 332 var o = new core.Map<core.String, api.ResultFormattedResultsRuleResultsValue>(
); |
| 333 o["x"] = buildResultFormattedResultsRuleResultsValue(); |
| 334 o["y"] = buildResultFormattedResultsRuleResultsValue(); |
| 335 return o; |
| 336 } |
| 337 |
| 338 checkUnnamed1251(core.Map<core.String, api.ResultFormattedResultsRuleResultsValu
e> o) { |
| 339 unittest.expect(o, unittest.hasLength(2)); |
| 340 checkResultFormattedResultsRuleResultsValue(o["x"]); |
| 341 checkResultFormattedResultsRuleResultsValue(o["y"]); |
| 342 } |
| 343 |
| 344 core.int buildCounterResultFormattedResults = 0; |
| 345 buildResultFormattedResults() { |
| 346 var o = new api.ResultFormattedResults(); |
| 347 buildCounterResultFormattedResults++; |
| 348 if (buildCounterResultFormattedResults < 3) { |
| 349 o.locale = "foo"; |
| 350 o.ruleResults = buildUnnamed1251(); |
| 351 } |
| 352 buildCounterResultFormattedResults--; |
| 353 return o; |
| 354 } |
| 355 |
| 356 checkResultFormattedResults(api.ResultFormattedResults o) { |
| 357 buildCounterResultFormattedResults++; |
| 358 if (buildCounterResultFormattedResults < 3) { |
| 359 unittest.expect(o.locale, unittest.equals('foo')); |
| 360 checkUnnamed1251(o.ruleResults); |
| 361 } |
| 362 buildCounterResultFormattedResults--; |
| 363 } |
| 364 |
| 365 buildUnnamed1252() { |
| 366 var o = new core.List<core.String>(); |
| 367 o.add("foo"); |
| 368 o.add("foo"); |
| 369 return o; |
| 370 } |
| 371 |
| 372 checkUnnamed1252(core.List<core.String> o) { |
| 373 unittest.expect(o, unittest.hasLength(2)); |
| 374 unittest.expect(o[0], unittest.equals('foo')); |
| 375 unittest.expect(o[1], unittest.equals('foo')); |
| 376 } |
| 377 |
| 378 core.int buildCounterResultPageStats = 0; |
| 379 buildResultPageStats() { |
| 380 var o = new api.ResultPageStats(); |
| 381 buildCounterResultPageStats++; |
| 382 if (buildCounterResultPageStats < 3) { |
| 383 o.cssResponseBytes = "foo"; |
| 384 o.flashResponseBytes = "foo"; |
| 385 o.htmlResponseBytes = "foo"; |
| 386 o.imageResponseBytes = "foo"; |
| 387 o.javascriptResponseBytes = "foo"; |
| 388 o.numberCssResources = 42; |
| 389 o.numberHosts = 42; |
| 390 o.numberJsResources = 42; |
| 391 o.numberResources = 42; |
| 392 o.numberStaticResources = 42; |
| 393 o.otherResponseBytes = "foo"; |
| 394 o.textResponseBytes = "foo"; |
| 395 o.totalRequestBytes = "foo"; |
| 396 } |
| 397 buildCounterResultPageStats--; |
| 398 return o; |
| 399 } |
| 400 |
| 401 checkResultPageStats(api.ResultPageStats o) { |
| 402 buildCounterResultPageStats++; |
| 403 if (buildCounterResultPageStats < 3) { |
| 404 unittest.expect(o.cssResponseBytes, unittest.equals('foo')); |
| 405 unittest.expect(o.flashResponseBytes, unittest.equals('foo')); |
| 406 unittest.expect(o.htmlResponseBytes, unittest.equals('foo')); |
| 407 unittest.expect(o.imageResponseBytes, unittest.equals('foo')); |
| 408 unittest.expect(o.javascriptResponseBytes, unittest.equals('foo')); |
| 409 unittest.expect(o.numberCssResources, unittest.equals(42)); |
| 410 unittest.expect(o.numberHosts, unittest.equals(42)); |
| 411 unittest.expect(o.numberJsResources, unittest.equals(42)); |
| 412 unittest.expect(o.numberResources, unittest.equals(42)); |
| 413 unittest.expect(o.numberStaticResources, unittest.equals(42)); |
| 414 unittest.expect(o.otherResponseBytes, unittest.equals('foo')); |
| 415 unittest.expect(o.textResponseBytes, unittest.equals('foo')); |
| 416 unittest.expect(o.totalRequestBytes, unittest.equals('foo')); |
| 417 } |
| 418 buildCounterResultPageStats--; |
| 419 } |
| 420 |
| 421 core.int buildCounterResultRuleGroupsValue = 0; |
| 422 buildResultRuleGroupsValue() { |
| 423 var o = new api.ResultRuleGroupsValue(); |
| 424 buildCounterResultRuleGroupsValue++; |
| 425 if (buildCounterResultRuleGroupsValue < 3) { |
| 426 o.score = 42; |
| 427 } |
| 428 buildCounterResultRuleGroupsValue--; |
| 429 return o; |
| 430 } |
| 431 |
| 432 checkResultRuleGroupsValue(api.ResultRuleGroupsValue o) { |
| 433 buildCounterResultRuleGroupsValue++; |
| 434 if (buildCounterResultRuleGroupsValue < 3) { |
| 435 unittest.expect(o.score, unittest.equals(42)); |
| 436 } |
| 437 buildCounterResultRuleGroupsValue--; |
| 438 } |
| 439 |
| 440 buildUnnamed1253() { |
| 441 var o = new core.Map<core.String, api.ResultRuleGroupsValue>(); |
| 442 o["x"] = buildResultRuleGroupsValue(); |
| 443 o["y"] = buildResultRuleGroupsValue(); |
| 444 return o; |
| 445 } |
| 446 |
| 447 checkUnnamed1253(core.Map<core.String, api.ResultRuleGroupsValue> o) { |
| 448 unittest.expect(o, unittest.hasLength(2)); |
| 449 checkResultRuleGroupsValue(o["x"]); |
| 450 checkResultRuleGroupsValue(o["y"]); |
| 451 } |
| 452 |
| 453 core.int buildCounterResultVersion = 0; |
| 454 buildResultVersion() { |
| 455 var o = new api.ResultVersion(); |
| 456 buildCounterResultVersion++; |
| 457 if (buildCounterResultVersion < 3) { |
| 458 o.major = 42; |
| 459 o.minor = 42; |
| 460 } |
| 461 buildCounterResultVersion--; |
| 462 return o; |
| 463 } |
| 464 |
| 465 checkResultVersion(api.ResultVersion o) { |
| 466 buildCounterResultVersion++; |
| 467 if (buildCounterResultVersion < 3) { |
| 468 unittest.expect(o.major, unittest.equals(42)); |
| 469 unittest.expect(o.minor, unittest.equals(42)); |
| 470 } |
| 471 buildCounterResultVersion--; |
| 472 } |
| 473 |
| 474 core.int buildCounterResult = 0; |
| 475 buildResult() { |
| 476 var o = new api.Result(); |
| 477 buildCounterResult++; |
| 478 if (buildCounterResult < 3) { |
| 479 o.formattedResults = buildResultFormattedResults(); |
| 480 o.id = "foo"; |
| 481 o.invalidRules = buildUnnamed1252(); |
| 482 o.kind = "foo"; |
| 483 o.pageStats = buildResultPageStats(); |
| 484 o.responseCode = 42; |
| 485 o.ruleGroups = buildUnnamed1253(); |
| 486 o.screenshot = buildPagespeedApiImageV2(); |
| 487 o.title = "foo"; |
| 488 o.version = buildResultVersion(); |
| 489 } |
| 490 buildCounterResult--; |
| 491 return o; |
| 492 } |
| 493 |
| 494 checkResult(api.Result o) { |
| 495 buildCounterResult++; |
| 496 if (buildCounterResult < 3) { |
| 497 checkResultFormattedResults(o.formattedResults); |
| 498 unittest.expect(o.id, unittest.equals('foo')); |
| 499 checkUnnamed1252(o.invalidRules); |
| 500 unittest.expect(o.kind, unittest.equals('foo')); |
| 501 checkResultPageStats(o.pageStats); |
| 502 unittest.expect(o.responseCode, unittest.equals(42)); |
| 503 checkUnnamed1253(o.ruleGroups); |
| 504 checkPagespeedApiImageV2(o.screenshot); |
| 505 unittest.expect(o.title, unittest.equals('foo')); |
| 506 checkResultVersion(o.version); |
| 507 } |
| 508 buildCounterResult--; |
| 509 } |
| 510 |
| 511 buildUnnamed1254() { |
| 512 var o = new core.List<core.String>(); |
| 513 o.add("foo"); |
| 514 o.add("foo"); |
| 515 return o; |
| 516 } |
| 517 |
| 518 checkUnnamed1254(core.List<core.String> o) { |
| 519 unittest.expect(o, unittest.hasLength(2)); |
| 520 unittest.expect(o[0], unittest.equals('foo')); |
| 521 unittest.expect(o[1], unittest.equals('foo')); |
| 522 } |
| 523 |
| 524 |
| 525 main() { |
| 526 unittest.group("obj-schema-PagespeedApiFormatStringV2ArgsRects", () { |
| 527 unittest.test("to-json--from-json", () { |
| 528 var o = buildPagespeedApiFormatStringV2ArgsRects(); |
| 529 var od = new api.PagespeedApiFormatStringV2ArgsRects.fromJson(o.toJson()); |
| 530 checkPagespeedApiFormatStringV2ArgsRects(od); |
| 531 }); |
| 532 }); |
| 533 |
| 534 |
| 535 unittest.group("obj-schema-PagespeedApiFormatStringV2ArgsSecondaryRects", () { |
| 536 unittest.test("to-json--from-json", () { |
| 537 var o = buildPagespeedApiFormatStringV2ArgsSecondaryRects(); |
| 538 var od = new api.PagespeedApiFormatStringV2ArgsSecondaryRects.fromJson(o.t
oJson()); |
| 539 checkPagespeedApiFormatStringV2ArgsSecondaryRects(od); |
| 540 }); |
| 541 }); |
| 542 |
| 543 |
| 544 unittest.group("obj-schema-PagespeedApiFormatStringV2Args", () { |
| 545 unittest.test("to-json--from-json", () { |
| 546 var o = buildPagespeedApiFormatStringV2Args(); |
| 547 var od = new api.PagespeedApiFormatStringV2Args.fromJson(o.toJson()); |
| 548 checkPagespeedApiFormatStringV2Args(od); |
| 549 }); |
| 550 }); |
| 551 |
| 552 |
| 553 unittest.group("obj-schema-PagespeedApiFormatStringV2", () { |
| 554 unittest.test("to-json--from-json", () { |
| 555 var o = buildPagespeedApiFormatStringV2(); |
| 556 var od = new api.PagespeedApiFormatStringV2.fromJson(o.toJson()); |
| 557 checkPagespeedApiFormatStringV2(od); |
| 558 }); |
| 559 }); |
| 560 |
| 561 |
| 562 unittest.group("obj-schema-PagespeedApiImageV2PageRect", () { |
| 563 unittest.test("to-json--from-json", () { |
| 564 var o = buildPagespeedApiImageV2PageRect(); |
| 565 var od = new api.PagespeedApiImageV2PageRect.fromJson(o.toJson()); |
| 566 checkPagespeedApiImageV2PageRect(od); |
| 567 }); |
| 568 }); |
| 569 |
| 570 |
| 571 unittest.group("obj-schema-PagespeedApiImageV2", () { |
| 572 unittest.test("to-json--from-json", () { |
| 573 var o = buildPagespeedApiImageV2(); |
| 574 var od = new api.PagespeedApiImageV2.fromJson(o.toJson()); |
| 575 checkPagespeedApiImageV2(od); |
| 576 }); |
| 577 }); |
| 578 |
| 579 |
| 580 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksUrls
", () { |
| 581 unittest.test("to-json--from-json", () { |
| 582 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksUrls(); |
| 583 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls.fromJ
son(o.toJson()); |
| 584 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(od); |
| 585 }); |
| 586 }); |
| 587 |
| 588 |
| 589 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocks", (
) { |
| 590 unittest.test("to-json--from-json", () { |
| 591 var o = buildResultFormattedResultsRuleResultsValueUrlBlocks(); |
| 592 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocks.fromJson(
o.toJson()); |
| 593 checkResultFormattedResultsRuleResultsValueUrlBlocks(od); |
| 594 }); |
| 595 }); |
| 596 |
| 597 |
| 598 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValue", () { |
| 599 unittest.test("to-json--from-json", () { |
| 600 var o = buildResultFormattedResultsRuleResultsValue(); |
| 601 var od = new api.ResultFormattedResultsRuleResultsValue.fromJson(o.toJson(
)); |
| 602 checkResultFormattedResultsRuleResultsValue(od); |
| 603 }); |
| 604 }); |
| 605 |
| 606 |
| 607 unittest.group("obj-schema-ResultFormattedResults", () { |
| 608 unittest.test("to-json--from-json", () { |
| 609 var o = buildResultFormattedResults(); |
| 610 var od = new api.ResultFormattedResults.fromJson(o.toJson()); |
| 611 checkResultFormattedResults(od); |
| 612 }); |
| 613 }); |
| 614 |
| 615 |
| 616 unittest.group("obj-schema-ResultPageStats", () { |
| 617 unittest.test("to-json--from-json", () { |
| 618 var o = buildResultPageStats(); |
| 619 var od = new api.ResultPageStats.fromJson(o.toJson()); |
| 620 checkResultPageStats(od); |
| 621 }); |
| 622 }); |
| 623 |
| 624 |
| 625 unittest.group("obj-schema-ResultRuleGroupsValue", () { |
| 626 unittest.test("to-json--from-json", () { |
| 627 var o = buildResultRuleGroupsValue(); |
| 628 var od = new api.ResultRuleGroupsValue.fromJson(o.toJson()); |
| 629 checkResultRuleGroupsValue(od); |
| 630 }); |
| 631 }); |
| 632 |
| 633 |
| 634 unittest.group("obj-schema-ResultVersion", () { |
| 635 unittest.test("to-json--from-json", () { |
| 636 var o = buildResultVersion(); |
| 637 var od = new api.ResultVersion.fromJson(o.toJson()); |
| 638 checkResultVersion(od); |
| 639 }); |
| 640 }); |
| 641 |
| 642 |
| 643 unittest.group("obj-schema-Result", () { |
| 644 unittest.test("to-json--from-json", () { |
| 645 var o = buildResult(); |
| 646 var od = new api.Result.fromJson(o.toJson()); |
| 647 checkResult(od); |
| 648 }); |
| 649 }); |
| 650 |
| 651 |
| 652 unittest.group("resource-PagespeedapiResourceApi", () { |
| 653 unittest.test("method--runpagespeed", () { |
| 654 |
| 655 var mock = new common_test.HttpServerMock(); |
| 656 api.PagespeedapiResourceApi res = new api.PagespeedonlineApi(mock).pagespe
edapi; |
| 657 var arg_url = "foo"; |
| 658 var arg_filterThirdPartyResources = true; |
| 659 var arg_locale = "foo"; |
| 660 var arg_rule = buildUnnamed1254(); |
| 661 var arg_screenshot = true; |
| 662 var arg_strategy = "foo"; |
| 663 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 664 var path = (req.url).path; |
| 665 var pathOffset = 0; |
| 666 var index; |
| 667 var subPart; |
| 668 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 669 pathOffset += 1; |
| 670 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("pagespeedonline/v2/")); |
| 671 pathOffset += 19; |
| 672 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("runPagespeed")); |
| 673 pathOffset += 12; |
| 674 |
| 675 var query = (req.url).query; |
| 676 var queryOffset = 0; |
| 677 var queryMap = {}; |
| 678 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); |
| 679 parseBool(n) { |
| 680 if (n == "true") return true; |
| 681 if (n == "false") return false; |
| 682 if (n == null) return null; |
| 683 throw new core.ArgumentError("Invalid boolean: $n"); |
| 684 } |
| 685 if (query.length > 0) { |
| 686 for (var part in query.split("&")) { |
| 687 var keyvalue = part.split("="); |
| 688 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); |
| 689 } |
| 690 } |
| 691 unittest.expect(queryMap["url"].first, unittest.equals(arg_url)); |
| 692 unittest.expect(queryMap["filter_third_party_resources"].first, unittest
.equals("$arg_filterThirdPartyResources")); |
| 693 unittest.expect(queryMap["locale"].first, unittest.equals(arg_locale)); |
| 694 unittest.expect(queryMap["rule"], unittest.equals(arg_rule)); |
| 695 unittest.expect(queryMap["screenshot"].first, unittest.equals("$arg_scre
enshot")); |
| 696 unittest.expect(queryMap["strategy"].first, unittest.equals(arg_strategy
)); |
| 697 |
| 698 |
| 699 var h = { |
| 700 "content-type" : "application/json; charset=utf-8", |
| 701 }; |
| 702 var resp = convert.JSON.encode(buildResult()); |
| 703 return new async.Future.value(common_test.stringResponse(200, h, resp)); |
| 704 }), true); |
| 705 res.runpagespeed(arg_url, filterThirdPartyResources: arg_filterThirdPartyR
esources, locale: arg_locale, rule: arg_rule, screenshot: arg_screenshot, strate
gy: arg_strategy).then(unittest.expectAsync(((api.Result response) { |
| 706 checkResult(response); |
| 707 }))); |
| 708 }); |
| 709 |
| 710 }); |
| 711 |
| 712 |
| 713 } |
| 714 |
OLD | NEW |