| OLD | NEW |
| 1 library googleapis.pagespeedonline.v2.test; | 1 library googleapis.pagespeedonline.v2.test; |
| 2 | 2 |
| 3 import "dart:core" as core; | 3 import "dart:core" as core; |
| 4 import "dart:collection" as collection; | 4 import "dart:collection" as collection; |
| 5 import "dart:async" as async; | 5 import "dart:async" as async; |
| 6 import "dart:convert" as convert; | 6 import "dart:convert" as convert; |
| 7 | 7 |
| 8 import 'package:http/http.dart' as http; | 8 import 'package:http/http.dart' as http; |
| 9 import 'package:http/testing.dart' as http_testing; | 9 import 'package:http/testing.dart' as http_testing; |
| 10 import 'package:unittest/unittest.dart' as unittest; | 10 import 'package:unittest/unittest.dart' as unittest; |
| 11 import 'package:googleapis/common/common.dart' as common; | |
| 12 import 'package:googleapis/src/common_internal.dart' as common_internal; | |
| 13 import '../common/common_internal_test.dart' as common_test; | |
| 14 | 11 |
| 15 import 'package:googleapis/pagespeedonline/v2.dart' as api; | 12 import 'package:googleapis/pagespeedonline/v2.dart' as api; |
| 16 | 13 |
| 14 class HttpServerMock extends http.BaseClient { |
| 15 core.Function _callback; |
| 16 core.bool _expectJson; |
| 17 | 17 |
| 18 void register(core.Function callback, core.bool expectJson) { |
| 19 _callback = callback; |
| 20 _expectJson = expectJson; |
| 21 } |
| 22 |
| 23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { |
| 24 if (_expectJson) { |
| 25 return request.finalize() |
| 26 .transform(convert.UTF8.decoder) |
| 27 .join('') |
| 28 .then((core.String jsonString) { |
| 29 if (jsonString.isEmpty) { |
| 30 return _callback(request, null); |
| 31 } else { |
| 32 return _callback(request, convert.JSON.decode(jsonString)); |
| 33 } |
| 34 }); |
| 35 } else { |
| 36 var stream = request.finalize(); |
| 37 if (stream == null) { |
| 38 return _callback(request, []); |
| 39 } else { |
| 40 return stream.toBytes().then((data) { |
| 41 return _callback(request, data); |
| 42 }); |
| 43 } |
| 44 } |
| 45 } |
| 46 } |
| 47 |
| 48 http.StreamedResponse stringResponse( |
| 49 core.int status, core.Map headers, core.String body) { |
| 50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); |
| 51 return new http.StreamedResponse(stream, status, headers: headers); |
| 52 } |
| 18 | 53 |
| 19 core.int buildCounterPagespeedApiFormatStringV2ArgsRects = 0; | 54 core.int buildCounterPagespeedApiFormatStringV2ArgsRects = 0; |
| 20 buildPagespeedApiFormatStringV2ArgsRects() { | 55 buildPagespeedApiFormatStringV2ArgsRects() { |
| 21 var o = new api.PagespeedApiFormatStringV2ArgsRects(); | 56 var o = new api.PagespeedApiFormatStringV2ArgsRects(); |
| 22 buildCounterPagespeedApiFormatStringV2ArgsRects++; | 57 buildCounterPagespeedApiFormatStringV2ArgsRects++; |
| 23 if (buildCounterPagespeedApiFormatStringV2ArgsRects < 3) { | 58 if (buildCounterPagespeedApiFormatStringV2ArgsRects < 3) { |
| 24 o.height = 42; | 59 o.height = 42; |
| 25 o.left = 42; | 60 o.left = 42; |
| 26 o.top = 42; | 61 o.top = 42; |
| 27 o.width = 42; | 62 o.width = 42; |
| 28 } | 63 } |
| 29 buildCounterPagespeedApiFormatStringV2ArgsRects--; | 64 buildCounterPagespeedApiFormatStringV2ArgsRects--; |
| 30 return o; | 65 return o; |
| 31 } | 66 } |
| 32 | 67 |
| 33 checkPagespeedApiFormatStringV2ArgsRects(api.PagespeedApiFormatStringV2ArgsRects
o) { | 68 checkPagespeedApiFormatStringV2ArgsRects(api.PagespeedApiFormatStringV2ArgsRects
o) { |
| 34 buildCounterPagespeedApiFormatStringV2ArgsRects++; | 69 buildCounterPagespeedApiFormatStringV2ArgsRects++; |
| 35 if (buildCounterPagespeedApiFormatStringV2ArgsRects < 3) { | 70 if (buildCounterPagespeedApiFormatStringV2ArgsRects < 3) { |
| 36 unittest.expect(o.height, unittest.equals(42)); | 71 unittest.expect(o.height, unittest.equals(42)); |
| 37 unittest.expect(o.left, unittest.equals(42)); | 72 unittest.expect(o.left, unittest.equals(42)); |
| 38 unittest.expect(o.top, unittest.equals(42)); | 73 unittest.expect(o.top, unittest.equals(42)); |
| 39 unittest.expect(o.width, unittest.equals(42)); | 74 unittest.expect(o.width, unittest.equals(42)); |
| 40 } | 75 } |
| 41 buildCounterPagespeedApiFormatStringV2ArgsRects--; | 76 buildCounterPagespeedApiFormatStringV2ArgsRects--; |
| 42 } | 77 } |
| 43 | 78 |
| 44 buildUnnamed1005() { | 79 buildUnnamed1243() { |
| 45 var o = new core.List<api.PagespeedApiFormatStringV2ArgsRects>(); | 80 var o = new core.List<api.PagespeedApiFormatStringV2ArgsRects>(); |
| 46 o.add(buildPagespeedApiFormatStringV2ArgsRects()); | 81 o.add(buildPagespeedApiFormatStringV2ArgsRects()); |
| 47 o.add(buildPagespeedApiFormatStringV2ArgsRects()); | 82 o.add(buildPagespeedApiFormatStringV2ArgsRects()); |
| 48 return o; | 83 return o; |
| 49 } | 84 } |
| 50 | 85 |
| 51 checkUnnamed1005(core.List<api.PagespeedApiFormatStringV2ArgsRects> o) { | 86 checkUnnamed1243(core.List<api.PagespeedApiFormatStringV2ArgsRects> o) { |
| 52 unittest.expect(o, unittest.hasLength(2)); | 87 unittest.expect(o, unittest.hasLength(2)); |
| 53 checkPagespeedApiFormatStringV2ArgsRects(o[0]); | 88 checkPagespeedApiFormatStringV2ArgsRects(o[0]); |
| 54 checkPagespeedApiFormatStringV2ArgsRects(o[1]); | 89 checkPagespeedApiFormatStringV2ArgsRects(o[1]); |
| 55 } | 90 } |
| 56 | 91 |
| 57 core.int buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects = 0; | 92 core.int buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects = 0; |
| 58 buildPagespeedApiFormatStringV2ArgsSecondaryRects() { | 93 buildPagespeedApiFormatStringV2ArgsSecondaryRects() { |
| 59 var o = new api.PagespeedApiFormatStringV2ArgsSecondaryRects(); | 94 var o = new api.PagespeedApiFormatStringV2ArgsSecondaryRects(); |
| 60 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects++; | 95 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects++; |
| 61 if (buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects < 3) { | 96 if (buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects < 3) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects++; | 107 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects++; |
| 73 if (buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects < 3) { | 108 if (buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects < 3) { |
| 74 unittest.expect(o.height, unittest.equals(42)); | 109 unittest.expect(o.height, unittest.equals(42)); |
| 75 unittest.expect(o.left, unittest.equals(42)); | 110 unittest.expect(o.left, unittest.equals(42)); |
| 76 unittest.expect(o.top, unittest.equals(42)); | 111 unittest.expect(o.top, unittest.equals(42)); |
| 77 unittest.expect(o.width, unittest.equals(42)); | 112 unittest.expect(o.width, unittest.equals(42)); |
| 78 } | 113 } |
| 79 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects--; | 114 buildCounterPagespeedApiFormatStringV2ArgsSecondaryRects--; |
| 80 } | 115 } |
| 81 | 116 |
| 82 buildUnnamed1006() { | 117 buildUnnamed1244() { |
| 83 var o = new core.List<api.PagespeedApiFormatStringV2ArgsSecondaryRects>(); | 118 var o = new core.List<api.PagespeedApiFormatStringV2ArgsSecondaryRects>(); |
| 84 o.add(buildPagespeedApiFormatStringV2ArgsSecondaryRects()); | 119 o.add(buildPagespeedApiFormatStringV2ArgsSecondaryRects()); |
| 85 o.add(buildPagespeedApiFormatStringV2ArgsSecondaryRects()); | 120 o.add(buildPagespeedApiFormatStringV2ArgsSecondaryRects()); |
| 86 return o; | 121 return o; |
| 87 } | 122 } |
| 88 | 123 |
| 89 checkUnnamed1006(core.List<api.PagespeedApiFormatStringV2ArgsSecondaryRects> o)
{ | 124 checkUnnamed1244(core.List<api.PagespeedApiFormatStringV2ArgsSecondaryRects> o)
{ |
| 90 unittest.expect(o, unittest.hasLength(2)); | 125 unittest.expect(o, unittest.hasLength(2)); |
| 91 checkPagespeedApiFormatStringV2ArgsSecondaryRects(o[0]); | 126 checkPagespeedApiFormatStringV2ArgsSecondaryRects(o[0]); |
| 92 checkPagespeedApiFormatStringV2ArgsSecondaryRects(o[1]); | 127 checkPagespeedApiFormatStringV2ArgsSecondaryRects(o[1]); |
| 93 } | 128 } |
| 94 | 129 |
| 95 core.int buildCounterPagespeedApiFormatStringV2Args = 0; | 130 core.int buildCounterPagespeedApiFormatStringV2Args = 0; |
| 96 buildPagespeedApiFormatStringV2Args() { | 131 buildPagespeedApiFormatStringV2Args() { |
| 97 var o = new api.PagespeedApiFormatStringV2Args(); | 132 var o = new api.PagespeedApiFormatStringV2Args(); |
| 98 buildCounterPagespeedApiFormatStringV2Args++; | 133 buildCounterPagespeedApiFormatStringV2Args++; |
| 99 if (buildCounterPagespeedApiFormatStringV2Args < 3) { | 134 if (buildCounterPagespeedApiFormatStringV2Args < 3) { |
| 100 o.key = "foo"; | 135 o.key = "foo"; |
| 101 o.rects = buildUnnamed1005(); | 136 o.rects = buildUnnamed1243(); |
| 102 o.secondaryRects = buildUnnamed1006(); | 137 o.secondaryRects = buildUnnamed1244(); |
| 103 o.type = "foo"; | 138 o.type = "foo"; |
| 104 o.value = "foo"; | 139 o.value = "foo"; |
| 105 } | 140 } |
| 106 buildCounterPagespeedApiFormatStringV2Args--; | 141 buildCounterPagespeedApiFormatStringV2Args--; |
| 107 return o; | 142 return o; |
| 108 } | 143 } |
| 109 | 144 |
| 110 checkPagespeedApiFormatStringV2Args(api.PagespeedApiFormatStringV2Args o) { | 145 checkPagespeedApiFormatStringV2Args(api.PagespeedApiFormatStringV2Args o) { |
| 111 buildCounterPagespeedApiFormatStringV2Args++; | 146 buildCounterPagespeedApiFormatStringV2Args++; |
| 112 if (buildCounterPagespeedApiFormatStringV2Args < 3) { | 147 if (buildCounterPagespeedApiFormatStringV2Args < 3) { |
| 113 unittest.expect(o.key, unittest.equals('foo')); | 148 unittest.expect(o.key, unittest.equals('foo')); |
| 114 checkUnnamed1005(o.rects); | 149 checkUnnamed1243(o.rects); |
| 115 checkUnnamed1006(o.secondaryRects); | 150 checkUnnamed1244(o.secondaryRects); |
| 116 unittest.expect(o.type, unittest.equals('foo')); | 151 unittest.expect(o.type, unittest.equals('foo')); |
| 117 unittest.expect(o.value, unittest.equals('foo')); | 152 unittest.expect(o.value, unittest.equals('foo')); |
| 118 } | 153 } |
| 119 buildCounterPagespeedApiFormatStringV2Args--; | 154 buildCounterPagespeedApiFormatStringV2Args--; |
| 120 } | 155 } |
| 121 | 156 |
| 122 buildUnnamed1007() { | 157 buildUnnamed1245() { |
| 123 var o = new core.List<api.PagespeedApiFormatStringV2Args>(); | 158 var o = new core.List<api.PagespeedApiFormatStringV2Args>(); |
| 124 o.add(buildPagespeedApiFormatStringV2Args()); | 159 o.add(buildPagespeedApiFormatStringV2Args()); |
| 125 o.add(buildPagespeedApiFormatStringV2Args()); | 160 o.add(buildPagespeedApiFormatStringV2Args()); |
| 126 return o; | 161 return o; |
| 127 } | 162 } |
| 128 | 163 |
| 129 checkUnnamed1007(core.List<api.PagespeedApiFormatStringV2Args> o) { | 164 checkUnnamed1245(core.List<api.PagespeedApiFormatStringV2Args> o) { |
| 130 unittest.expect(o, unittest.hasLength(2)); | 165 unittest.expect(o, unittest.hasLength(2)); |
| 131 checkPagespeedApiFormatStringV2Args(o[0]); | 166 checkPagespeedApiFormatStringV2Args(o[0]); |
| 132 checkPagespeedApiFormatStringV2Args(o[1]); | 167 checkPagespeedApiFormatStringV2Args(o[1]); |
| 133 } | 168 } |
| 134 | 169 |
| 135 core.int buildCounterPagespeedApiFormatStringV2 = 0; | 170 core.int buildCounterPagespeedApiFormatStringV2 = 0; |
| 136 buildPagespeedApiFormatStringV2() { | 171 buildPagespeedApiFormatStringV2() { |
| 137 var o = new api.PagespeedApiFormatStringV2(); | 172 var o = new api.PagespeedApiFormatStringV2(); |
| 138 buildCounterPagespeedApiFormatStringV2++; | 173 buildCounterPagespeedApiFormatStringV2++; |
| 139 if (buildCounterPagespeedApiFormatStringV2 < 3) { | 174 if (buildCounterPagespeedApiFormatStringV2 < 3) { |
| 140 o.args = buildUnnamed1007(); | 175 o.args = buildUnnamed1245(); |
| 141 o.format = "foo"; | 176 o.format = "foo"; |
| 142 } | 177 } |
| 143 buildCounterPagespeedApiFormatStringV2--; | 178 buildCounterPagespeedApiFormatStringV2--; |
| 144 return o; | 179 return o; |
| 145 } | 180 } |
| 146 | 181 |
| 147 checkPagespeedApiFormatStringV2(api.PagespeedApiFormatStringV2 o) { | 182 checkPagespeedApiFormatStringV2(api.PagespeedApiFormatStringV2 o) { |
| 148 buildCounterPagespeedApiFormatStringV2++; | 183 buildCounterPagespeedApiFormatStringV2++; |
| 149 if (buildCounterPagespeedApiFormatStringV2 < 3) { | 184 if (buildCounterPagespeedApiFormatStringV2 < 3) { |
| 150 checkUnnamed1007(o.args); | 185 checkUnnamed1245(o.args); |
| 151 unittest.expect(o.format, unittest.equals('foo')); | 186 unittest.expect(o.format, unittest.equals('foo')); |
| 152 } | 187 } |
| 153 buildCounterPagespeedApiFormatStringV2--; | 188 buildCounterPagespeedApiFormatStringV2--; |
| 154 } | 189 } |
| 155 | 190 |
| 156 core.int buildCounterPagespeedApiImageV2PageRect = 0; | 191 core.int buildCounterPagespeedApiImageV2PageRect = 0; |
| 157 buildPagespeedApiImageV2PageRect() { | 192 buildPagespeedApiImageV2PageRect() { |
| 158 var o = new api.PagespeedApiImageV2PageRect(); | 193 var o = new api.PagespeedApiImageV2PageRect(); |
| 159 buildCounterPagespeedApiImageV2PageRect++; | 194 buildCounterPagespeedApiImageV2PageRect++; |
| 160 if (buildCounterPagespeedApiImageV2PageRect < 3) { | 195 if (buildCounterPagespeedApiImageV2PageRect < 3) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 unittest.expect(o.data, unittest.equals('foo')); | 235 unittest.expect(o.data, unittest.equals('foo')); |
| 201 unittest.expect(o.height, unittest.equals(42)); | 236 unittest.expect(o.height, unittest.equals(42)); |
| 202 unittest.expect(o.key, unittest.equals('foo')); | 237 unittest.expect(o.key, unittest.equals('foo')); |
| 203 unittest.expect(o.mimeType, unittest.equals('foo')); | 238 unittest.expect(o.mimeType, unittest.equals('foo')); |
| 204 checkPagespeedApiImageV2PageRect(o.pageRect); | 239 checkPagespeedApiImageV2PageRect(o.pageRect); |
| 205 unittest.expect(o.width, unittest.equals(42)); | 240 unittest.expect(o.width, unittest.equals(42)); |
| 206 } | 241 } |
| 207 buildCounterPagespeedApiImageV2--; | 242 buildCounterPagespeedApiImageV2--; |
| 208 } | 243 } |
| 209 | 244 |
| 210 buildUnnamed1008() { | 245 buildUnnamed1246() { |
| 211 var o = new core.List<core.String>(); | 246 var o = new core.List<core.String>(); |
| 212 o.add("foo"); | 247 o.add("foo"); |
| 213 o.add("foo"); | 248 o.add("foo"); |
| 214 return o; | 249 return o; |
| 215 } | 250 } |
| 216 | 251 |
| 217 checkUnnamed1008(core.List<core.String> o) { | 252 checkUnnamed1246(core.List<core.String> o) { |
| 218 unittest.expect(o, unittest.hasLength(2)); | 253 unittest.expect(o, unittest.hasLength(2)); |
| 219 unittest.expect(o[0], unittest.equals('foo')); | 254 unittest.expect(o[0], unittest.equals('foo')); |
| 220 unittest.expect(o[1], unittest.equals('foo')); | 255 unittest.expect(o[1], unittest.equals('foo')); |
| 221 } | 256 } |
| 222 | 257 |
| 223 buildUnnamed1009() { | 258 buildUnnamed1247() { |
| 224 var o = new core.List<api.PagespeedApiFormatStringV2>(); | 259 var o = new core.List<api.PagespeedApiFormatStringV2>(); |
| 225 o.add(buildPagespeedApiFormatStringV2()); | 260 o.add(buildPagespeedApiFormatStringV2()); |
| 226 o.add(buildPagespeedApiFormatStringV2()); | 261 o.add(buildPagespeedApiFormatStringV2()); |
| 227 return o; | 262 return o; |
| 228 } | 263 } |
| 229 | 264 |
| 230 checkUnnamed1009(core.List<api.PagespeedApiFormatStringV2> o) { | 265 checkUnnamed1247(core.List<api.PagespeedApiFormatStringV2> o) { |
| 231 unittest.expect(o, unittest.hasLength(2)); | 266 unittest.expect(o, unittest.hasLength(2)); |
| 232 checkPagespeedApiFormatStringV2(o[0]); | 267 checkPagespeedApiFormatStringV2(o[0]); |
| 233 checkPagespeedApiFormatStringV2(o[1]); | 268 checkPagespeedApiFormatStringV2(o[1]); |
| 234 } | 269 } |
| 235 | 270 |
| 236 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls = 0; | 271 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls = 0; |
| 237 buildResultFormattedResultsRuleResultsValueUrlBlocksUrls() { | 272 buildResultFormattedResultsRuleResultsValueUrlBlocksUrls() { |
| 238 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls(); | 273 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls(); |
| 239 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; | 274 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; |
| 240 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { | 275 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { |
| 241 o.details = buildUnnamed1009(); | 276 o.details = buildUnnamed1247(); |
| 242 o.result = buildPagespeedApiFormatStringV2(); | 277 o.result = buildPagespeedApiFormatStringV2(); |
| 243 } | 278 } |
| 244 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; | 279 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; |
| 245 return o; | 280 return o; |
| 246 } | 281 } |
| 247 | 282 |
| 248 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(api.ResultFormattedResu
ltsRuleResultsValueUrlBlocksUrls o) { | 283 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(api.ResultFormattedResu
ltsRuleResultsValueUrlBlocksUrls o) { |
| 249 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; | 284 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls++; |
| 250 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { | 285 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls < 3) { |
| 251 checkUnnamed1009(o.details); | 286 checkUnnamed1247(o.details); |
| 252 checkPagespeedApiFormatStringV2(o.result); | 287 checkPagespeedApiFormatStringV2(o.result); |
| 253 } | 288 } |
| 254 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; | 289 buildCounterResultFormattedResultsRuleResultsValueUrlBlocksUrls--; |
| 255 } | 290 } |
| 256 | 291 |
| 257 buildUnnamed1010() { | 292 buildUnnamed1248() { |
| 258 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls>
(); | 293 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUrls>
(); |
| 259 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); | 294 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); |
| 260 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); | 295 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocksUrls()); |
| 261 return o; | 296 return o; |
| 262 } | 297 } |
| 263 | 298 |
| 264 checkUnnamed1010(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUr
ls> o) { | 299 checkUnnamed1248(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocksUr
ls> o) { |
| 265 unittest.expect(o, unittest.hasLength(2)); | 300 unittest.expect(o, unittest.hasLength(2)); |
| 266 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[0]); | 301 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[0]); |
| 267 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[1]); | 302 checkResultFormattedResultsRuleResultsValueUrlBlocksUrls(o[1]); |
| 268 } | 303 } |
| 269 | 304 |
| 270 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocks = 0; | 305 core.int buildCounterResultFormattedResultsRuleResultsValueUrlBlocks = 0; |
| 271 buildResultFormattedResultsRuleResultsValueUrlBlocks() { | 306 buildResultFormattedResultsRuleResultsValueUrlBlocks() { |
| 272 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocks(); | 307 var o = new api.ResultFormattedResultsRuleResultsValueUrlBlocks(); |
| 273 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; | 308 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; |
| 274 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { | 309 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { |
| 275 o.header = buildPagespeedApiFormatStringV2(); | 310 o.header = buildPagespeedApiFormatStringV2(); |
| 276 o.urls = buildUnnamed1010(); | 311 o.urls = buildUnnamed1248(); |
| 277 } | 312 } |
| 278 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; | 313 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; |
| 279 return o; | 314 return o; |
| 280 } | 315 } |
| 281 | 316 |
| 282 checkResultFormattedResultsRuleResultsValueUrlBlocks(api.ResultFormattedResultsR
uleResultsValueUrlBlocks o) { | 317 checkResultFormattedResultsRuleResultsValueUrlBlocks(api.ResultFormattedResultsR
uleResultsValueUrlBlocks o) { |
| 283 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; | 318 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks++; |
| 284 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { | 319 if (buildCounterResultFormattedResultsRuleResultsValueUrlBlocks < 3) { |
| 285 checkPagespeedApiFormatStringV2(o.header); | 320 checkPagespeedApiFormatStringV2(o.header); |
| 286 checkUnnamed1010(o.urls); | 321 checkUnnamed1248(o.urls); |
| 287 } | 322 } |
| 288 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; | 323 buildCounterResultFormattedResultsRuleResultsValueUrlBlocks--; |
| 289 } | 324 } |
| 290 | 325 |
| 291 buildUnnamed1011() { | 326 buildUnnamed1249() { |
| 292 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>(); | 327 var o = new core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>(); |
| 293 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); | 328 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); |
| 294 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); | 329 o.add(buildResultFormattedResultsRuleResultsValueUrlBlocks()); |
| 295 return o; | 330 return o; |
| 296 } | 331 } |
| 297 | 332 |
| 298 checkUnnamed1011(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>
o) { | 333 checkUnnamed1249(core.List<api.ResultFormattedResultsRuleResultsValueUrlBlocks>
o) { |
| 299 unittest.expect(o, unittest.hasLength(2)); | 334 unittest.expect(o, unittest.hasLength(2)); |
| 300 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[0]); | 335 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[0]); |
| 301 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[1]); | 336 checkResultFormattedResultsRuleResultsValueUrlBlocks(o[1]); |
| 302 } | 337 } |
| 303 | 338 |
| 304 core.int buildCounterResultFormattedResultsRuleResultsValue = 0; | 339 core.int buildCounterResultFormattedResultsRuleResultsValue = 0; |
| 305 buildResultFormattedResultsRuleResultsValue() { | 340 buildResultFormattedResultsRuleResultsValue() { |
| 306 var o = new api.ResultFormattedResultsRuleResultsValue(); | 341 var o = new api.ResultFormattedResultsRuleResultsValue(); |
| 307 buildCounterResultFormattedResultsRuleResultsValue++; | 342 buildCounterResultFormattedResultsRuleResultsValue++; |
| 308 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { | 343 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { |
| 309 o.groups = buildUnnamed1008(); | 344 o.groups = buildUnnamed1246(); |
| 310 o.localizedRuleName = "foo"; | 345 o.localizedRuleName = "foo"; |
| 311 o.ruleImpact = 42.0; | 346 o.ruleImpact = 42.0; |
| 312 o.summary = buildPagespeedApiFormatStringV2(); | 347 o.summary = buildPagespeedApiFormatStringV2(); |
| 313 o.urlBlocks = buildUnnamed1011(); | 348 o.urlBlocks = buildUnnamed1249(); |
| 314 } | 349 } |
| 315 buildCounterResultFormattedResultsRuleResultsValue--; | 350 buildCounterResultFormattedResultsRuleResultsValue--; |
| 316 return o; | 351 return o; |
| 317 } | 352 } |
| 318 | 353 |
| 319 checkResultFormattedResultsRuleResultsValue(api.ResultFormattedResultsRuleResult
sValue o) { | 354 checkResultFormattedResultsRuleResultsValue(api.ResultFormattedResultsRuleResult
sValue o) { |
| 320 buildCounterResultFormattedResultsRuleResultsValue++; | 355 buildCounterResultFormattedResultsRuleResultsValue++; |
| 321 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { | 356 if (buildCounterResultFormattedResultsRuleResultsValue < 3) { |
| 322 checkUnnamed1008(o.groups); | 357 checkUnnamed1246(o.groups); |
| 323 unittest.expect(o.localizedRuleName, unittest.equals('foo')); | 358 unittest.expect(o.localizedRuleName, unittest.equals('foo')); |
| 324 unittest.expect(o.ruleImpact, unittest.equals(42.0)); | 359 unittest.expect(o.ruleImpact, unittest.equals(42.0)); |
| 325 checkPagespeedApiFormatStringV2(o.summary); | 360 checkPagespeedApiFormatStringV2(o.summary); |
| 326 checkUnnamed1011(o.urlBlocks); | 361 checkUnnamed1249(o.urlBlocks); |
| 327 } | 362 } |
| 328 buildCounterResultFormattedResultsRuleResultsValue--; | 363 buildCounterResultFormattedResultsRuleResultsValue--; |
| 329 } | 364 } |
| 330 | 365 |
| 331 buildUnnamed1012() { | 366 buildUnnamed1250() { |
| 332 var o = new core.Map<core.String, api.ResultFormattedResultsRuleResultsValue>(
); | 367 var o = new core.Map<core.String, api.ResultFormattedResultsRuleResultsValue>(
); |
| 333 o["x"] = buildResultFormattedResultsRuleResultsValue(); | 368 o["x"] = buildResultFormattedResultsRuleResultsValue(); |
| 334 o["y"] = buildResultFormattedResultsRuleResultsValue(); | 369 o["y"] = buildResultFormattedResultsRuleResultsValue(); |
| 335 return o; | 370 return o; |
| 336 } | 371 } |
| 337 | 372 |
| 338 checkUnnamed1012(core.Map<core.String, api.ResultFormattedResultsRuleResultsValu
e> o) { | 373 checkUnnamed1250(core.Map<core.String, api.ResultFormattedResultsRuleResultsValu
e> o) { |
| 339 unittest.expect(o, unittest.hasLength(2)); | 374 unittest.expect(o, unittest.hasLength(2)); |
| 340 checkResultFormattedResultsRuleResultsValue(o["x"]); | 375 checkResultFormattedResultsRuleResultsValue(o["x"]); |
| 341 checkResultFormattedResultsRuleResultsValue(o["y"]); | 376 checkResultFormattedResultsRuleResultsValue(o["y"]); |
| 342 } | 377 } |
| 343 | 378 |
| 344 core.int buildCounterResultFormattedResults = 0; | 379 core.int buildCounterResultFormattedResults = 0; |
| 345 buildResultFormattedResults() { | 380 buildResultFormattedResults() { |
| 346 var o = new api.ResultFormattedResults(); | 381 var o = new api.ResultFormattedResults(); |
| 347 buildCounterResultFormattedResults++; | 382 buildCounterResultFormattedResults++; |
| 348 if (buildCounterResultFormattedResults < 3) { | 383 if (buildCounterResultFormattedResults < 3) { |
| 349 o.locale = "foo"; | 384 o.locale = "foo"; |
| 350 o.ruleResults = buildUnnamed1012(); | 385 o.ruleResults = buildUnnamed1250(); |
| 351 } | 386 } |
| 352 buildCounterResultFormattedResults--; | 387 buildCounterResultFormattedResults--; |
| 353 return o; | 388 return o; |
| 354 } | 389 } |
| 355 | 390 |
| 356 checkResultFormattedResults(api.ResultFormattedResults o) { | 391 checkResultFormattedResults(api.ResultFormattedResults o) { |
| 357 buildCounterResultFormattedResults++; | 392 buildCounterResultFormattedResults++; |
| 358 if (buildCounterResultFormattedResults < 3) { | 393 if (buildCounterResultFormattedResults < 3) { |
| 359 unittest.expect(o.locale, unittest.equals('foo')); | 394 unittest.expect(o.locale, unittest.equals('foo')); |
| 360 checkUnnamed1012(o.ruleResults); | 395 checkUnnamed1250(o.ruleResults); |
| 361 } | 396 } |
| 362 buildCounterResultFormattedResults--; | 397 buildCounterResultFormattedResults--; |
| 363 } | 398 } |
| 364 | 399 |
| 365 buildUnnamed1013() { | 400 buildUnnamed1251() { |
| 366 var o = new core.List<core.String>(); | 401 var o = new core.List<core.String>(); |
| 367 o.add("foo"); | 402 o.add("foo"); |
| 368 o.add("foo"); | 403 o.add("foo"); |
| 369 return o; | 404 return o; |
| 370 } | 405 } |
| 371 | 406 |
| 372 checkUnnamed1013(core.List<core.String> o) { | 407 checkUnnamed1251(core.List<core.String> o) { |
| 373 unittest.expect(o, unittest.hasLength(2)); | 408 unittest.expect(o, unittest.hasLength(2)); |
| 374 unittest.expect(o[0], unittest.equals('foo')); | 409 unittest.expect(o[0], unittest.equals('foo')); |
| 375 unittest.expect(o[1], unittest.equals('foo')); | 410 unittest.expect(o[1], unittest.equals('foo')); |
| 376 } | 411 } |
| 377 | 412 |
| 378 core.int buildCounterResultPageStats = 0; | 413 core.int buildCounterResultPageStats = 0; |
| 379 buildResultPageStats() { | 414 buildResultPageStats() { |
| 380 var o = new api.ResultPageStats(); | 415 var o = new api.ResultPageStats(); |
| 381 buildCounterResultPageStats++; | 416 buildCounterResultPageStats++; |
| 382 if (buildCounterResultPageStats < 3) { | 417 if (buildCounterResultPageStats < 3) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 } | 465 } |
| 431 | 466 |
| 432 checkResultRuleGroupsValue(api.ResultRuleGroupsValue o) { | 467 checkResultRuleGroupsValue(api.ResultRuleGroupsValue o) { |
| 433 buildCounterResultRuleGroupsValue++; | 468 buildCounterResultRuleGroupsValue++; |
| 434 if (buildCounterResultRuleGroupsValue < 3) { | 469 if (buildCounterResultRuleGroupsValue < 3) { |
| 435 unittest.expect(o.score, unittest.equals(42)); | 470 unittest.expect(o.score, unittest.equals(42)); |
| 436 } | 471 } |
| 437 buildCounterResultRuleGroupsValue--; | 472 buildCounterResultRuleGroupsValue--; |
| 438 } | 473 } |
| 439 | 474 |
| 440 buildUnnamed1014() { | 475 buildUnnamed1252() { |
| 441 var o = new core.Map<core.String, api.ResultRuleGroupsValue>(); | 476 var o = new core.Map<core.String, api.ResultRuleGroupsValue>(); |
| 442 o["x"] = buildResultRuleGroupsValue(); | 477 o["x"] = buildResultRuleGroupsValue(); |
| 443 o["y"] = buildResultRuleGroupsValue(); | 478 o["y"] = buildResultRuleGroupsValue(); |
| 444 return o; | 479 return o; |
| 445 } | 480 } |
| 446 | 481 |
| 447 checkUnnamed1014(core.Map<core.String, api.ResultRuleGroupsValue> o) { | 482 checkUnnamed1252(core.Map<core.String, api.ResultRuleGroupsValue> o) { |
| 448 unittest.expect(o, unittest.hasLength(2)); | 483 unittest.expect(o, unittest.hasLength(2)); |
| 449 checkResultRuleGroupsValue(o["x"]); | 484 checkResultRuleGroupsValue(o["x"]); |
| 450 checkResultRuleGroupsValue(o["y"]); | 485 checkResultRuleGroupsValue(o["y"]); |
| 451 } | 486 } |
| 452 | 487 |
| 453 core.int buildCounterResultVersion = 0; | 488 core.int buildCounterResultVersion = 0; |
| 454 buildResultVersion() { | 489 buildResultVersion() { |
| 455 var o = new api.ResultVersion(); | 490 var o = new api.ResultVersion(); |
| 456 buildCounterResultVersion++; | 491 buildCounterResultVersion++; |
| 457 if (buildCounterResultVersion < 3) { | 492 if (buildCounterResultVersion < 3) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 471 buildCounterResultVersion--; | 506 buildCounterResultVersion--; |
| 472 } | 507 } |
| 473 | 508 |
| 474 core.int buildCounterResult = 0; | 509 core.int buildCounterResult = 0; |
| 475 buildResult() { | 510 buildResult() { |
| 476 var o = new api.Result(); | 511 var o = new api.Result(); |
| 477 buildCounterResult++; | 512 buildCounterResult++; |
| 478 if (buildCounterResult < 3) { | 513 if (buildCounterResult < 3) { |
| 479 o.formattedResults = buildResultFormattedResults(); | 514 o.formattedResults = buildResultFormattedResults(); |
| 480 o.id = "foo"; | 515 o.id = "foo"; |
| 481 o.invalidRules = buildUnnamed1013(); | 516 o.invalidRules = buildUnnamed1251(); |
| 482 o.kind = "foo"; | 517 o.kind = "foo"; |
| 483 o.pageStats = buildResultPageStats(); | 518 o.pageStats = buildResultPageStats(); |
| 484 o.responseCode = 42; | 519 o.responseCode = 42; |
| 485 o.ruleGroups = buildUnnamed1014(); | 520 o.ruleGroups = buildUnnamed1252(); |
| 486 o.screenshot = buildPagespeedApiImageV2(); | 521 o.screenshot = buildPagespeedApiImageV2(); |
| 487 o.title = "foo"; | 522 o.title = "foo"; |
| 488 o.version = buildResultVersion(); | 523 o.version = buildResultVersion(); |
| 489 } | 524 } |
| 490 buildCounterResult--; | 525 buildCounterResult--; |
| 491 return o; | 526 return o; |
| 492 } | 527 } |
| 493 | 528 |
| 494 checkResult(api.Result o) { | 529 checkResult(api.Result o) { |
| 495 buildCounterResult++; | 530 buildCounterResult++; |
| 496 if (buildCounterResult < 3) { | 531 if (buildCounterResult < 3) { |
| 497 checkResultFormattedResults(o.formattedResults); | 532 checkResultFormattedResults(o.formattedResults); |
| 498 unittest.expect(o.id, unittest.equals('foo')); | 533 unittest.expect(o.id, unittest.equals('foo')); |
| 499 checkUnnamed1013(o.invalidRules); | 534 checkUnnamed1251(o.invalidRules); |
| 500 unittest.expect(o.kind, unittest.equals('foo')); | 535 unittest.expect(o.kind, unittest.equals('foo')); |
| 501 checkResultPageStats(o.pageStats); | 536 checkResultPageStats(o.pageStats); |
| 502 unittest.expect(o.responseCode, unittest.equals(42)); | 537 unittest.expect(o.responseCode, unittest.equals(42)); |
| 503 checkUnnamed1014(o.ruleGroups); | 538 checkUnnamed1252(o.ruleGroups); |
| 504 checkPagespeedApiImageV2(o.screenshot); | 539 checkPagespeedApiImageV2(o.screenshot); |
| 505 unittest.expect(o.title, unittest.equals('foo')); | 540 unittest.expect(o.title, unittest.equals('foo')); |
| 506 checkResultVersion(o.version); | 541 checkResultVersion(o.version); |
| 507 } | 542 } |
| 508 buildCounterResult--; | 543 buildCounterResult--; |
| 509 } | 544 } |
| 510 | 545 |
| 511 buildUnnamed1015() { | 546 buildUnnamed1253() { |
| 512 var o = new core.List<core.String>(); | 547 var o = new core.List<core.String>(); |
| 513 o.add("foo"); | 548 o.add("foo"); |
| 514 o.add("foo"); | 549 o.add("foo"); |
| 515 return o; | 550 return o; |
| 516 } | 551 } |
| 517 | 552 |
| 518 checkUnnamed1015(core.List<core.String> o) { | 553 checkUnnamed1253(core.List<core.String> o) { |
| 519 unittest.expect(o, unittest.hasLength(2)); | 554 unittest.expect(o, unittest.hasLength(2)); |
| 520 unittest.expect(o[0], unittest.equals('foo')); | 555 unittest.expect(o[0], unittest.equals('foo')); |
| 521 unittest.expect(o[1], unittest.equals('foo')); | 556 unittest.expect(o[1], unittest.equals('foo')); |
| 522 } | 557 } |
| 523 | 558 |
| 524 | 559 |
| 525 main() { | 560 main() { |
| 526 unittest.group("obj-schema-PagespeedApiFormatStringV2ArgsRects", () { | 561 unittest.group("obj-schema-PagespeedApiFormatStringV2ArgsRects", () { |
| 527 unittest.test("to-json--from-json", () { | 562 unittest.test("to-json--from-json", () { |
| 528 var o = buildPagespeedApiFormatStringV2ArgsRects(); | 563 var o = buildPagespeedApiFormatStringV2ArgsRects(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 var o = buildResult(); | 680 var o = buildResult(); |
| 646 var od = new api.Result.fromJson(o.toJson()); | 681 var od = new api.Result.fromJson(o.toJson()); |
| 647 checkResult(od); | 682 checkResult(od); |
| 648 }); | 683 }); |
| 649 }); | 684 }); |
| 650 | 685 |
| 651 | 686 |
| 652 unittest.group("resource-PagespeedapiResourceApi", () { | 687 unittest.group("resource-PagespeedapiResourceApi", () { |
| 653 unittest.test("method--runpagespeed", () { | 688 unittest.test("method--runpagespeed", () { |
| 654 | 689 |
| 655 var mock = new common_test.HttpServerMock(); | 690 var mock = new HttpServerMock(); |
| 656 api.PagespeedapiResourceApi res = new api.PagespeedonlineApi(mock).pagespe
edapi; | 691 api.PagespeedapiResourceApi res = new api.PagespeedonlineApi(mock).pagespe
edapi; |
| 657 var arg_url = "foo"; | 692 var arg_url = "foo"; |
| 658 var arg_filterThirdPartyResources = true; | 693 var arg_filterThirdPartyResources = true; |
| 659 var arg_locale = "foo"; | 694 var arg_locale = "foo"; |
| 660 var arg_rule = buildUnnamed1015(); | 695 var arg_rule = buildUnnamed1253(); |
| 661 var arg_screenshot = true; | 696 var arg_screenshot = true; |
| 662 var arg_strategy = "foo"; | 697 var arg_strategy = "foo"; |
| 663 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | 698 mock.register(unittest.expectAsync((http.BaseRequest req, json) { |
| 664 var path = (req.url).path; | 699 var path = (req.url).path; |
| 665 var pathOffset = 0; | 700 var pathOffset = 0; |
| 666 var index; | 701 var index; |
| 667 var subPart; | 702 var subPart; |
| 668 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | 703 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); |
| 669 pathOffset += 1; | 704 pathOffset += 1; |
| 670 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("pagespeedonline/v2/")); | 705 unittest.expect(path.substring(pathOffset, pathOffset + 19), unittest.eq
uals("pagespeedonline/v2/")); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 693 unittest.expect(queryMap["locale"].first, unittest.equals(arg_locale)); | 728 unittest.expect(queryMap["locale"].first, unittest.equals(arg_locale)); |
| 694 unittest.expect(queryMap["rule"], unittest.equals(arg_rule)); | 729 unittest.expect(queryMap["rule"], unittest.equals(arg_rule)); |
| 695 unittest.expect(queryMap["screenshot"].first, unittest.equals("$arg_scre
enshot")); | 730 unittest.expect(queryMap["screenshot"].first, unittest.equals("$arg_scre
enshot")); |
| 696 unittest.expect(queryMap["strategy"].first, unittest.equals(arg_strategy
)); | 731 unittest.expect(queryMap["strategy"].first, unittest.equals(arg_strategy
)); |
| 697 | 732 |
| 698 | 733 |
| 699 var h = { | 734 var h = { |
| 700 "content-type" : "application/json; charset=utf-8", | 735 "content-type" : "application/json; charset=utf-8", |
| 701 }; | 736 }; |
| 702 var resp = convert.JSON.encode(buildResult()); | 737 var resp = convert.JSON.encode(buildResult()); |
| 703 return new async.Future.value(common_test.stringResponse(200, h, resp)); | 738 return new async.Future.value(stringResponse(200, h, resp)); |
| 704 }), true); | 739 }), 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) { | 740 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); | 741 checkResult(response); |
| 707 }))); | 742 }))); |
| 708 }); | 743 }); |
| 709 | 744 |
| 710 }); | 745 }); |
| 711 | 746 |
| 712 | 747 |
| 713 } | 748 } |
| 714 | 749 |
| OLD | NEW |