| OLD | NEW |
| (Empty) |
| 1 library googleapis.pagespeedonline.v1.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/v1.dart' as api; | |
| 16 | |
| 17 | |
| 18 | |
| 19 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs =
0; | |
| 20 buildResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs() { | |
| 21 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs(); | |
| 22 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs++; | |
| 23 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs < 3)
{ | |
| 24 o.type = "foo"; | |
| 25 o.value = "foo"; | |
| 26 } | |
| 27 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs--; | |
| 28 return o; | |
| 29 } | |
| 30 | |
| 31 checkResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs(api.ResultFormatt
edResultsRuleResultsValueUrlBlocksHeaderArgs o) { | |
| 32 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs++; | |
| 33 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs < 3)
{ | |
| 34 unittest.expect(o.type, unittest.equals('foo')); | |
| 35 unittest.expect(o.value, unittest.equals('foo')); | |
| 36 } | |
| 37 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs--; | |
| 38 } | |
| 39 | |
| 40 buildUnnamed944() { | |
| 41 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksHeade
rArgs>(); | |
| 42 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs()); | |
| 43 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs()); | |
| 44 return o; | |
| 45 } | |
| 46 | |
| 47 checkUnnamed944(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksHea
derArgs> o) { | |
| 48 unittest.expect(o, unittest.hasLength(2)); | |
| 49 checkResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs(o[0]); | |
| 50 checkResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs(o[1]); | |
| 51 } | |
| 52 | |
| 53 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader = 0; | |
| 54 buildResultFormattedResultsRuleResultsValueUrlBlocksHeader() { | |
| 55 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksHeader(); | |
| 56 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader++; | |
| 57 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader < 3) { | |
| 58 o.args = buildUnnamed944(); | |
| 59 o.format = "foo"; | |
| 60 } | |
| 61 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader--; | |
| 62 return o; | |
| 63 } | |
| 64 | |
| 65 checkResultFormattedResultsRuleResultsValueUrlBlocksHeader(api.ResultFormattedRe
sultsRuleResultsValueUrlBlocksHeader o) { | |
| 66 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader++; | |
| 67 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader < 3) { | |
| 68 checkUnnamed944(o.args); | |
| 69 unittest.expect(o.format, unittest.equals('foo')); | |
| 70 } | |
| 71 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksHeader--; | |
| 72 } | |
| 73 | |
| 74 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsA
rgs = 0; | |
| 75 buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs() { | |
| 76 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs
(); | |
| 77 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs++; | |
| 78 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs
< 3) { | |
| 79 o.type = "foo"; | |
| 80 o.value = "foo"; | |
| 81 } | |
| 82 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs--; | |
| 83 return o; | |
| 84 } | |
| 85 | |
| 86 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs(api.ResultFo
rmattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs o) { | |
| 87 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs++; | |
| 88 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs
< 3) { | |
| 89 unittest.expect(o.type, unittest.equals('foo')); | |
| 90 unittest.expect(o.value, unittest.equals('foo')); | |
| 91 } | |
| 92 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs--; | |
| 93 } | |
| 94 | |
| 95 buildUnnamed945() { | |
| 96 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsD
etailsArgs>(); | |
| 97 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs()); | |
| 98 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs()); | |
| 99 return o; | |
| 100 } | |
| 101 | |
| 102 checkUnnamed945(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrl
sDetailsArgs> o) { | |
| 103 unittest.expect(o, unittest.hasLength(2)); | |
| 104 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs(o[0]); | |
| 105 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs(o[1]); | |
| 106 } | |
| 107 | |
| 108 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails
= 0; | |
| 109 buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails() { | |
| 110 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails(); | |
| 111 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails++; | |
| 112 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails < 3
) { | |
| 113 o.args = buildUnnamed945(); | |
| 114 o.format = "foo"; | |
| 115 } | |
| 116 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails--; | |
| 117 return o; | |
| 118 } | |
| 119 | |
| 120 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails(api.ResultFormat
tedResultsRuleResultsValueUrlBlocksUrlsDetails o) { | |
| 121 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails++; | |
| 122 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails < 3
) { | |
| 123 checkUnnamed945(o.args); | |
| 124 unittest.expect(o.format, unittest.equals('foo')); | |
| 125 } | |
| 126 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails--; | |
| 127 } | |
| 128 | |
| 129 buildUnnamed946() { | |
| 130 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsD
etails>(); | |
| 131 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails()); | |
| 132 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails()); | |
| 133 return o; | |
| 134 } | |
| 135 | |
| 136 checkUnnamed946(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrl
sDetails> o) { | |
| 137 unittest.expect(o, unittest.hasLength(2)); | |
| 138 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails(o[0]); | |
| 139 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails(o[1]); | |
| 140 } | |
| 141 | |
| 142 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultAr
gs = 0; | |
| 143 buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs() { | |
| 144 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs(
); | |
| 145 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs++; | |
| 146 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs
< 3) { | |
| 147 o.type = "foo"; | |
| 148 o.value = "foo"; | |
| 149 } | |
| 150 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs--; | |
| 151 return o; | |
| 152 } | |
| 153 | |
| 154 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs(api.ResultFor
mattedResultsRuleResultsValueUrlBlocksUrlsResultArgs o) { | |
| 155 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs++; | |
| 156 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs
< 3) { | |
| 157 unittest.expect(o.type, unittest.equals('foo')); | |
| 158 unittest.expect(o.value, unittest.equals('foo')); | |
| 159 } | |
| 160 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs--; | |
| 161 } | |
| 162 | |
| 163 buildUnnamed947() { | |
| 164 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsR
esultArgs>(); | |
| 165 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs()); | |
| 166 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs()); | |
| 167 return o; | |
| 168 } | |
| 169 | |
| 170 checkUnnamed947(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrl
sResultArgs> o) { | |
| 171 unittest.expect(o, unittest.hasLength(2)); | |
| 172 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs(o[0]); | |
| 173 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs(o[1]); | |
| 174 } | |
| 175 | |
| 176 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult =
0; | |
| 177 buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult() { | |
| 178 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult(); | |
| 179 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult++; | |
| 180 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult < 3)
{ | |
| 181 o.args = buildUnnamed947(); | |
| 182 o.format = "foo"; | |
| 183 } | |
| 184 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult--; | |
| 185 return o; | |
| 186 } | |
| 187 | |
| 188 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult(api.ResultFormatt
edResultsRuleResultsValueUrlBlocksUrlsResult o) { | |
| 189 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult++; | |
| 190 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult < 3)
{ | |
| 191 checkUnnamed947(o.args); | |
| 192 unittest.expect(o.format, unittest.equals('foo')); | |
| 193 } | |
| 194 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult--; | |
| 195 } | |
| 196 | |
| 197 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls = 0; | |
| 198 buildResultFormattedResultsRuleResultsValueUrlBlocksUrls() { | |
| 199 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls(); | |
| 200 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; | |
| 201 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { | |
| 202 o.details = buildUnnamed946(); | |
| 203 o.result = buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult(); | |
| 204 } | |
| 205 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; | |
| 206 return o; | |
| 207 } | |
| 208 | |
| 209 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(api.ResultFormattedResu
ltsRuleResultsValueUrlBlocksUrls o) { | |
| 210 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; | |
| 211 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { | |
| 212 checkUnnamed946(o.details); | |
| 213 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult(o.result); | |
| 214 } | |
| 215 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; | |
| 216 } | |
| 217 | |
| 218 buildUnnamed948() { | |
| 219 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls>
(); | |
| 220 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); | |
| 221 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); | |
| 222 return o; | |
| 223 } | |
| 224 | |
| 225 checkUnnamed948(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrl
s> o) { | |
| 226 unittest.expect(o, unittest.hasLength(2)); | |
| 227 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[0]); | |
| 228 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[1]); | |
| 229 } | |
| 230 | |
| 231 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocks = 0; | |
| 232 buildResultFormattedResultsRuleResultsValueUrlBlocks() { | |
| 233 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocks(); | |
| 234 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; | |
| 235 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { | |
| 236 o.header = buildResultFormattedResultsRuleResultsValueUrlBlocksHeader(); | |
| 237 o.urls = buildUnnamed948(); | |
| 238 } | |
| 239 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; | |
| 240 return o; | |
| 241 } | |
| 242 | |
| 243 checkResultFormattedResultsRuleResultsValueUrlBlocks(api.ResultFormattedResultsR
uleResultsValueUrlBlocks o) { | |
| 244 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; | |
| 245 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { | |
| 246 checkResultFormattedResultsRuleResultsValueUrlBlocksHeader(o.header); | |
| 247 checkUnnamed948(o.urls); | |
| 248 } | |
| 249 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; | |
| 250 } | |
| 251 | |
| 252 buildUnnamed949() { | |
| 253 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>(); | |
| 254 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); | |
| 255 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); | |
| 256 return o; | |
| 257 } | |
| 258 | |
| 259 checkUnnamed949(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks> o
) { | |
| 260 unittest.expect(o, unittest.hasLength(2)); | |
| 261 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[0]); | |
| 262 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[1]); | |
| 263 } | |
| 264 | |
| 265 core.int buildCounterResultFormattedResultsRuleResultsValue = 0; | |
| 266 buildResultFormattedResultsRuleResultsValue() { | |
| 267 var o = new api.ResultFormattedResultsRuleResultsValue(); | |
| 268 buildCounterResultFormattedResultsRuleResultsValue++; | |
| 269 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { | |
| 270 o.localizedRuleName = "foo"; | |
| 271 o.ruleImpact = 42.0; | |
| 272 o.urlBlocks = buildUnnamed949(); | |
| 273 } | |
| 274 buildCounterResultFormattedResultsRuleResultsValue--; | |
| 275 return o; | |
| 276 } | |
| 277 | |
| 278 checkResultFormattedResultsRuleResultsValue(api.ResultFormattedResultsRuleResult
sValue o) { | |
| 279 buildCounterResultFormattedResultsRuleResultsValue++; | |
| 280 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { | |
| 281 unittest.expect(o.localizedRuleName, unittest.equals('foo')); | |
| 282 unittest.expect(o.ruleImpact, unittest.equals(42.0)); | |
| 283 checkUnnamed949(o.urlBlocks); | |
| 284 } | |
| 285 buildCounterResultFormattedResultsRuleResultsValue--; | |
| 286 } | |
| 287 | |
| 288 buildUnnamed950() { | |
| 289 var o = new core.Map<core.String, api.ResultFormattedResultsRuleResultsValue>(
); | |
| 290 o["x"] = buildResultFormattedResultsRuleResultsValue(); | |
| 291 o["y"] = buildResultFormattedResultsRuleResultsValue(); | |
| 292 return o; | |
| 293 } | |
| 294 | |
| 295 checkUnnamed950(core.Map<core.String, api.ResultFormattedResultsRuleResultsValue
> o) { | |
| 296 unittest.expect(o, unittest.hasLength(2)); | |
| 297 checkResultFormattedResultsRuleResultsValue(o["x"]); | |
| 298 checkResultFormattedResultsRuleResultsValue(o["y"]); | |
| 299 } | |
| 300 | |
| 301 core.int buildCounterResultFormattedResults = 0; | |
| 302 buildResultFormattedResults() { | |
| 303 var o = new api.ResultFormattedResults(); | |
| 304 buildCounterResultFormattedResults++; | |
| 305 if (buildCounterResultFormattedResults < 3) { | |
| 306 o.locale = "foo"; | |
| 307 o.ruleResults = buildUnnamed950(); | |
| 308 } | |
| 309 buildCounterResultFormattedResults--; | |
| 310 return o; | |
| 311 } | |
| 312 | |
| 313 checkResultFormattedResults(api.ResultFormattedResults o) { | |
| 314 buildCounterResultFormattedResults++; | |
| 315 if (buildCounterResultFormattedResults < 3) { | |
| 316 unittest.expect(o.locale, unittest.equals('foo')); | |
| 317 checkUnnamed950(o.ruleResults); | |
| 318 } | |
| 319 buildCounterResultFormattedResults--; | |
| 320 } | |
| 321 | |
| 322 buildUnnamed951() { | |
| 323 var o = new core.List<core.String>(); | |
| 324 o.add("foo"); | |
| 325 o.add("foo"); | |
| 326 return o; | |
| 327 } | |
| 328 | |
| 329 checkUnnamed951(core.List<core.String> o) { | |
| 330 unittest.expect(o, unittest.hasLength(2)); | |
| 331 unittest.expect(o[0], unittest.equals('foo')); | |
| 332 unittest.expect(o[1], unittest.equals('foo')); | |
| 333 } | |
| 334 | |
| 335 core.int buildCounterResultPageStats = 0; | |
| 336 buildResultPageStats() { | |
| 337 var o = new api.ResultPageStats(); | |
| 338 buildCounterResultPageStats++; | |
| 339 if (buildCounterResultPageStats < 3) { | |
| 340 o.cssResponseBytes = "foo"; | |
| 341 o.flashResponseBytes = "foo"; | |
| 342 o.htmlResponseBytes = "foo"; | |
| 343 o.imageResponseBytes = "foo"; | |
| 344 o.javascriptResponseBytes = "foo"; | |
| 345 o.numberCssResources = 42; | |
| 346 o.numberHosts = 42; | |
| 347 o.numberJsResources = 42; | |
| 348 o.numberResources = 42; | |
| 349 o.numberStaticResources = 42; | |
| 350 o.otherResponseBytes = "foo"; | |
| 351 o.textResponseBytes = "foo"; | |
| 352 o.totalRequestBytes = "foo"; | |
| 353 } | |
| 354 buildCounterResultPageStats--; | |
| 355 return o; | |
| 356 } | |
| 357 | |
| 358 checkResultPageStats(api.ResultPageStats o) { | |
| 359 buildCounterResultPageStats++; | |
| 360 if (buildCounterResultPageStats < 3) { | |
| 361 unittest.expect(o.cssResponseBytes, unittest.equals('foo')); | |
| 362 unittest.expect(o.flashResponseBytes, unittest.equals('foo')); | |
| 363 unittest.expect(o.htmlResponseBytes, unittest.equals('foo')); | |
| 364 unittest.expect(o.imageResponseBytes, unittest.equals('foo')); | |
| 365 unittest.expect(o.javascriptResponseBytes, unittest.equals('foo')); | |
| 366 unittest.expect(o.numberCssResources, unittest.equals(42)); | |
| 367 unittest.expect(o.numberHosts, unittest.equals(42)); | |
| 368 unittest.expect(o.numberJsResources, unittest.equals(42)); | |
| 369 unittest.expect(o.numberResources, unittest.equals(42)); | |
| 370 unittest.expect(o.numberStaticResources, unittest.equals(42)); | |
| 371 unittest.expect(o.otherResponseBytes, unittest.equals('foo')); | |
| 372 unittest.expect(o.textResponseBytes, unittest.equals('foo')); | |
| 373 unittest.expect(o.totalRequestBytes, unittest.equals('foo')); | |
| 374 } | |
| 375 buildCounterResultPageStats--; | |
| 376 } | |
| 377 | |
| 378 core.int buildCounterResultScreenshot = 0; | |
| 379 buildResultScreenshot() { | |
| 380 var o = new api.ResultScreenshot(); | |
| 381 buildCounterResultScreenshot++; | |
| 382 if (buildCounterResultScreenshot < 3) { | |
| 383 o.data = "foo"; | |
| 384 o.height = 42; | |
| 385 o.mimeType = "foo"; | |
| 386 o.width = 42; | |
| 387 } | |
| 388 buildCounterResultScreenshot--; | |
| 389 return o; | |
| 390 } | |
| 391 | |
| 392 checkResultScreenshot(api.ResultScreenshot o) { | |
| 393 buildCounterResultScreenshot++; | |
| 394 if (buildCounterResultScreenshot < 3) { | |
| 395 unittest.expect(o.data, unittest.equals('foo')); | |
| 396 unittest.expect(o.height, unittest.equals(42)); | |
| 397 unittest.expect(o.mimeType, unittest.equals('foo')); | |
| 398 unittest.expect(o.width, unittest.equals(42)); | |
| 399 } | |
| 400 buildCounterResultScreenshot--; | |
| 401 } | |
| 402 | |
| 403 core.int buildCounterResultVersion = 0; | |
| 404 buildResultVersion() { | |
| 405 var o = new api.ResultVersion(); | |
| 406 buildCounterResultVersion++; | |
| 407 if (buildCounterResultVersion < 3) { | |
| 408 o.major = 42; | |
| 409 o.minor = 42; | |
| 410 } | |
| 411 buildCounterResultVersion--; | |
| 412 return o; | |
| 413 } | |
| 414 | |
| 415 checkResultVersion(api.ResultVersion o) { | |
| 416 buildCounterResultVersion++; | |
| 417 if (buildCounterResultVersion < 3) { | |
| 418 unittest.expect(o.major, unittest.equals(42)); | |
| 419 unittest.expect(o.minor, unittest.equals(42)); | |
| 420 } | |
| 421 buildCounterResultVersion--; | |
| 422 } | |
| 423 | |
| 424 core.int buildCounterResult = 0; | |
| 425 buildResult() { | |
| 426 var o = new api.Result(); | |
| 427 buildCounterResult++; | |
| 428 if (buildCounterResult < 3) { | |
| 429 o.formattedResults = buildResultFormattedResults(); | |
| 430 o.id = "foo"; | |
| 431 o.invalidRules = buildUnnamed951(); | |
| 432 o.kind = "foo"; | |
| 433 o.pageStats = buildResultPageStats(); | |
| 434 o.responseCode = 42; | |
| 435 o.score = 42; | |
| 436 o.screenshot = buildResultScreenshot(); | |
| 437 o.title = "foo"; | |
| 438 o.version = buildResultVersion(); | |
| 439 } | |
| 440 buildCounterResult--; | |
| 441 return o; | |
| 442 } | |
| 443 | |
| 444 checkResult(api.Result o) { | |
| 445 buildCounterResult++; | |
| 446 if (buildCounterResult < 3) { | |
| 447 checkResultFormattedResults(o.formattedResults); | |
| 448 unittest.expect(o.id, unittest.equals('foo')); | |
| 449 checkUnnamed951(o.invalidRules); | |
| 450 unittest.expect(o.kind, unittest.equals('foo')); | |
| 451 checkResultPageStats(o.pageStats); | |
| 452 unittest.expect(o.responseCode, unittest.equals(42)); | |
| 453 unittest.expect(o.score, unittest.equals(42)); | |
| 454 checkResultScreenshot(o.screenshot); | |
| 455 unittest.expect(o.title, unittest.equals('foo')); | |
| 456 checkResultVersion(o.version); | |
| 457 } | |
| 458 buildCounterResult--; | |
| 459 } | |
| 460 | |
| 461 buildUnnamed952() { | |
| 462 var o = new core.List<core.String>(); | |
| 463 o.add("foo"); | |
| 464 o.add("foo"); | |
| 465 return o; | |
| 466 } | |
| 467 | |
| 468 checkUnnamed952(core.List<core.String> o) { | |
| 469 unittest.expect(o, unittest.hasLength(2)); | |
| 470 unittest.expect(o[0], unittest.equals('foo')); | |
| 471 unittest.expect(o[1], unittest.equals('foo')); | |
| 472 } | |
| 473 | |
| 474 | |
| 475 main() { | |
| 476 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksHead
erArgs", () { | |
| 477 unittest.test("to-json--from-json", () { | |
| 478 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs(); | |
| 479 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs
.fromJson(o.toJson()); | |
| 480 checkResultFormattedResultsRuleResultsValueUrlBlocksHeaderArgs(od); | |
| 481 }); | |
| 482 }); | |
| 483 | |
| 484 | |
| 485 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksHead
er", () { | |
| 486 unittest.test("to-json--from-json", () { | |
| 487 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksHeader(); | |
| 488 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksHeader.fro
mJson(o.toJson()); | |
| 489 checkResultFormattedResultsRuleResultsValueUrlBlocksHeader(od); | |
| 490 }); | |
| 491 }); | |
| 492 | |
| 493 | |
| 494 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksUrls
DetailsArgs", () { | |
| 495 unittest.test("to-json--from-json", () { | |
| 496 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArg
s(); | |
| 497 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetail
sArgs.fromJson(o.toJson()); | |
| 498 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetailsArgs(od); | |
| 499 }); | |
| 500 }); | |
| 501 | |
| 502 | |
| 503 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksUrls
Details", () { | |
| 504 unittest.test("to-json--from-json", () { | |
| 505 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails(); | |
| 506 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetail
s.fromJson(o.toJson()); | |
| 507 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsDetails(od); | |
| 508 }); | |
| 509 }); | |
| 510 | |
| 511 | |
| 512 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksUrls
ResultArgs", () { | |
| 513 unittest.test("to-json--from-json", () { | |
| 514 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs
(); | |
| 515 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult
Args.fromJson(o.toJson()); | |
| 516 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResultArgs(od); | |
| 517 }); | |
| 518 }); | |
| 519 | |
| 520 | |
| 521 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksUrls
Result", () { | |
| 522 unittest.test("to-json--from-json", () { | |
| 523 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult(); | |
| 524 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult
.fromJson(o.toJson()); | |
| 525 checkResultFormattedResultsRuleResultsValueUrlBlocksUrlsResult(od); | |
| 526 }); | |
| 527 }); | |
| 528 | |
| 529 | |
| 530 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocksUrls
", () { | |
| 531 unittest.test("to-json--from-json", () { | |
| 532 var o = buildResultFormattedResultsRuleResultsValueUrlBlocksUrls(); | |
| 533 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls.fromJ
son(o.toJson()); | |
| 534 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(od); | |
| 535 }); | |
| 536 }); | |
| 537 | |
| 538 | |
| 539 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValueUrlBlocks", (
) { | |
| 540 unittest.test("to-json--from-json", () { | |
| 541 var o = buildResultFormattedResultsRuleResultsValueUrlBlocks(); | |
| 542 var od = new api.ResultFormattedResultsRuleResultsValueUrlBlocks.fromJson(
o.toJson()); | |
| 543 checkResultFormattedResultsRuleResultsValueUrlBlocks(od); | |
| 544 }); | |
| 545 }); | |
| 546 | |
| 547 | |
| 548 unittest.group("obj-schema-ResultFormattedResultsRuleResultsValue", () { | |
| 549 unittest.test("to-json--from-json", () { | |
| 550 var o = buildResultFormattedResultsRuleResultsValue(); | |
| 551 var od = new api.ResultFormattedResultsRuleResultsValue.fromJson(o.toJson(
)); | |
| 552 checkResultFormattedResultsRuleResultsValue(od); | |
| 553 }); | |
| 554 }); | |
| 555 | |
| 556 | |
| 557 unittest.group("obj-schema-ResultFormattedResults", () { | |
| 558 unittest.test("to-json--from-json", () { | |
| 559 var o = buildResultFormattedResults(); | |
| 560 var od = new api.ResultFormattedResults.fromJson(o.toJson()); | |
| 561 checkResultFormattedResults(od); | |
| 562 }); | |
| 563 }); | |
| 564 | |
| 565 | |
| 566 unittest.group("obj-schema-ResultPageStats", () { | |
| 567 unittest.test("to-json--from-json", () { | |
| 568 var o = buildResultPageStats(); | |
| 569 var od = new api.ResultPageStats.fromJson(o.toJson()); | |
| 570 checkResultPageStats(od); | |
| 571 }); | |
| 572 }); | |
| 573 | |
| 574 | |
| 575 unittest.group("obj-schema-ResultScreenshot", () { | |
| 576 unittest.test("to-json--from-json", () { | |
| 577 var o = buildResultScreenshot(); | |
| 578 var od = new api.ResultScreenshot.fromJson(o.toJson()); | |
| 579 checkResultScreenshot(od); | |
| 580 }); | |
| 581 }); | |
| 582 | |
| 583 | |
| 584 unittest.group("obj-schema-ResultVersion", () { | |
| 585 unittest.test("to-json--from-json", () { | |
| 586 var o = buildResultVersion(); | |
| 587 var od = new api.ResultVersion.fromJson(o.toJson()); | |
| 588 checkResultVersion(od); | |
| 589 }); | |
| 590 }); | |
| 591 | |
| 592 | |
| 593 unittest.group("obj-schema-Result", () { | |
| 594 unittest.test("to-json--from-json", () { | |
| 595 var o = buildResult(); | |
| 596 var od = new api.Result.fromJson(o.toJson()); | |
| 597 checkResult(od); | |
| 598 }); | |
| 599 }); | |
| 600 | |
| 601 | |
| 602 unittest.group("resource-PagespeedapiResourceApi", () { | |
| 603 unittest.test("method--runpagespeed", () { | |
| 604 | |
| 605 var mock = new common_test.HttpServerMock(); | |
| 606 api.PagespeedapiResourceApi res = new api.PagespeedonlineApi(mock).pagespe
edapi; | |
| 607 var arg_url = "foo"; | |
| 608 var arg_filterThirdPartyResources = true; | |
| 609 var arg_locale = "foo"; | |
| 610 var arg_rule = buildUnnamed952(); | |
| 611 var arg_screenshot = true; | |
| 612 var arg_strategy = "foo"; | |
| 613 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
| 614 var path = (req.url).path; | |
| 615 var pathOffset = 0; | |
| 616 var index; | |
| 617 var subPart; | |
| 618 unittest.expect(path.substring(pathOffset, pathOffset + 20), unittest.eq
uals("/pagespeedonline/v1/")); | |
| 619 pathOffset += 20; | |
| 620 unittest.expect(path.substring(pathOffset, pathOffset + 12), unittest.eq
uals("runPagespeed")); | |
| 621 pathOffset += 12; | |
| 622 | |
| 623 var query = (req.url).query; | |
| 624 var queryOffset = 0; | |
| 625 var queryMap = {}; | |
| 626 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
| 627 parseBool(n) { | |
| 628 if (n == "true") return true; | |
| 629 if (n == "false") return false; | |
| 630 if (n == null) return null; | |
| 631 throw new core.ArgumentError("Invalid boolean: $n"); | |
| 632 } | |
| 633 if (query.length > 0) { | |
| 634 for (var part in query.split("&")) { | |
| 635 var keyvalue = part.split("="); | |
| 636 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
| 637 } | |
| 638 } | |
| 639 unittest.expect(queryMap["url"].first, unittest.equals(arg_url)); | |
| 640 unittest.expect(queryMap["filter_third_party_resources"].first, unittest
.equals("$arg_filterThirdPartyResources")); | |
| 641 unittest.expect(queryMap["locale"].first, unittest.equals(arg_locale)); | |
| 642 unittest.expect(queryMap["rule"], unittest.equals(arg_rule)); | |
| 643 unittest.expect(queryMap["screenshot"].first, unittest.equals("$arg_scre
enshot")); | |
| 644 unittest.expect(queryMap["strategy"].first, unittest.equals(arg_strategy
)); | |
| 645 | |
| 646 | |
| 647 var h = { | |
| 648 "content-type" : "application/json; charset=utf-8", | |
| 649 }; | |
| 650 var resp = convert.JSON.encode(buildResult()); | |
| 651 return new async.Future.value(common_test.stringResponse(200, h, resp)); | |
| 652 }), true); | |
| 653 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) { | |
| 654 checkResult(response); | |
| 655 }))); | |
| 656 }); | |
| 657 | |
| 658 }); | |
| 659 | |
| 660 | |
| 661 } | |
| 662 | |
| OLD | NEW |