OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 define([ | 5 define([ |
6 "console", | 6 "console", |
7 "file", | 7 "file", |
8 "gin/test/expect", | 8 "gin/test/expect", |
| 9 "mojo/public/interfaces/bindings/tests/validation_test_associated_interfaces
.mojom", |
9 "mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom", | 10 "mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom", |
10 "mojo/public/js/bindings", | 11 "mojo/public/js/bindings", |
11 "mojo/public/js/buffer", | 12 "mojo/public/js/buffer", |
12 "mojo/public/js/codec", | 13 "mojo/public/js/codec", |
13 "mojo/public/js/core", | 14 "mojo/public/js/core", |
14 "mojo/public/js/tests/validation_test_input_parser", | 15 "mojo/public/js/tests/validation_test_input_parser", |
15 "mojo/public/js/validator", | 16 "mojo/public/js/validator", |
16 ], function(console, | 17 ], function(console, |
17 file, | 18 file, |
18 expect, | 19 expect, |
| 20 testAssociatedInterface, |
19 testInterface, | 21 testInterface, |
20 bindings, | 22 bindings, |
21 buffer, | 23 buffer, |
22 codec, | 24 codec, |
23 core, | 25 core, |
24 parser, | 26 parser, |
25 validator) { | 27 validator) { |
26 | 28 |
27 var noError = validator.validationError.NONE; | 29 var noError = validator.validationError.NONE; |
28 | 30 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 function testResponseConformanceMessageValidation() { | 265 function testResponseConformanceMessageValidation() { |
264 testMessageValidation("resp_conformance_", [ | 266 testMessageValidation("resp_conformance_", [ |
265 testInterface.ConformanceTestInterface.validateResponse]); | 267 testInterface.ConformanceTestInterface.validateResponse]); |
266 } | 268 } |
267 | 269 |
268 function testResponseBoundsCheckMessageValidation() { | 270 function testResponseBoundsCheckMessageValidation() { |
269 testMessageValidation("resp_boundscheck_", [ | 271 testMessageValidation("resp_boundscheck_", [ |
270 testInterface.BoundsCheckTestInterface.validateResponse]); | 272 testInterface.BoundsCheckTestInterface.validateResponse]); |
271 } | 273 } |
272 | 274 |
| 275 function testAssociatedConformanceMessageValidation() { |
| 276 testMessageValidation("associated_conformance_", [ |
| 277 testAssociatedInterface.AssociatedConformanceTestInterface |
| 278 .validateRequest]); |
| 279 } |
| 280 |
273 function testIntegratedMessageValidation(testFilesPattern, endpoint) { | 281 function testIntegratedMessageValidation(testFilesPattern, endpoint) { |
274 var testFiles = getMessageTestFiles(testFilesPattern); | 282 var testFiles = getMessageTestFiles(testFilesPattern); |
275 expect(testFiles.length).toBeGreaterThan(0); | 283 expect(testFiles.length).toBeGreaterThan(0); |
276 | 284 |
277 var testMessagePipe = core.createMessagePipe(); | 285 var testMessagePipe = core.createMessagePipe(); |
278 expect(testMessagePipe.result).toBe(core.RESULT_OK); | 286 expect(testMessagePipe.result).toBe(core.RESULT_OK); |
279 | 287 |
280 endpoint.bind(testMessagePipe.handle1); | 288 endpoint.bind(testMessagePipe.handle1); |
281 var observer = validator.ValidationErrorObserverForTesting.getInstance(); | 289 var observer = validator.ValidationErrorObserverForTesting.getInstance(); |
282 | 290 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 new bindings.Binding(testInterface.IntegrationTestInterface, {})); | 322 new bindings.Binding(testInterface.IntegrationTestInterface, {})); |
315 } | 323 } |
316 | 324 |
317 function testIntegratedResponseMessageValidation() { | 325 function testIntegratedResponseMessageValidation() { |
318 testIntegratedMessageValidation( | 326 testIntegratedMessageValidation( |
319 "integration_intf_resp", | 327 "integration_intf_resp", |
320 new testInterface.IntegrationTestInterfacePtr().ptr); | 328 new testInterface.IntegrationTestInterfacePtr().ptr); |
321 } | 329 } |
322 | 330 |
323 expect(checkTestMessageParser()).toBeNull(); | 331 expect(checkTestMessageParser()).toBeNull(); |
| 332 testAssociatedConformanceMessageValidation(); |
324 testConformanceMessageValidation(); | 333 testConformanceMessageValidation(); |
325 testBoundsCheckMessageValidation(); | 334 testBoundsCheckMessageValidation(); |
326 testResponseConformanceMessageValidation(); | 335 testResponseConformanceMessageValidation(); |
327 testResponseBoundsCheckMessageValidation(); | 336 testResponseBoundsCheckMessageValidation(); |
328 testIntegratedMessageHeaderValidation(); | 337 testIntegratedMessageHeaderValidation(); |
329 testIntegratedResponseMessageValidation(); | 338 testIntegratedResponseMessageValidation(); |
330 testIntegratedRequestMessageValidation(); | 339 testIntegratedRequestMessageValidation(); |
331 validator.clearTestingMode(); | 340 validator.clearTestingMode(); |
332 | 341 |
333 this.result = "PASS"; | 342 this.result = "PASS"; |
334 }); | 343 }); |
OLD | NEW |