| Index: mojo/bindings/js/validation_unittests.js
|
| diff --git a/mojo/bindings/js/validation_unittests.js b/mojo/bindings/js/validation_unittests.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..e33ec6410577af3ebb17c093437786fb18728f5e
|
| --- /dev/null
|
| +++ b/mojo/bindings/js/validation_unittests.js
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +define([
|
| + "console",
|
| + "gin/test/expect",
|
| + "mojo/public/js/bindings/codec",
|
| + "mojo/public/js/bindings/validator",
|
| + "mojo/bindings/js/message_file_parser"
|
| + ], function(console, expect, codec, validator, parser) {
|
| +
|
| + function testValidateMessageHeader() {
|
| + var testFiles = [
|
| + "conformance_msghdr_incomplete_struct",
|
| + "conformance_msghdr_incomplete_struct_header",
|
| + "conformance_msghdr_invalid_flags",
|
| + "conformance_msghdr_missing_request_id",
|
| + "conformance_msghdr_num_bytes_huge",
|
| + //"conformance_msghdr_num_bytes_less_than_min_requirement",
|
| + "conformance_msghdr_num_bytes_less_than_struct_header",
|
| + "conformance_msghdr_num_bytes_num_fields_mismatch_1",
|
| + "conformance_msghdr_num_bytes_num_fields_mismatch_2",
|
| + "conformance_msghdr_num_bytes_num_fields_mismatch_3",
|
| + "conformance_msghdr_num_fields_less_than_min_requirement"
|
| + ];
|
| +
|
| + for (var i = 0; i < testFiles.length; i++) {
|
| + var filename = "mojo/public/interfaces/bindings/tests/data/validation/" +
|
| + testFiles[i];
|
| + var testMessage = parser.readTestMessage(filename);
|
| + var buffer = new codec.Buffer(testMessage.message.data.buffer);
|
| + var message = new codec.Message(buffer);
|
| + var actualResult = validator.validateMessageHeader(message);
|
| + expect(actualResult).toEqual(testMessage.expected);
|
| + }
|
| + }
|
| +
|
| + parser.testMessageParser();
|
| + testValidateMessageHeader();
|
| + this.result = "PASS";
|
| +});
|
|
|