Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: mojo/public/js/bindings/validation_unittests.js

Issue 490623003: Add JS bindings validation logic for non-nullable types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/public/js/bindings/codec.js ('k') | mojo/public/js/bindings/validator.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_interfaces.mojom", 9 "mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom",
10 "mojo/public/js/bindings/buffer", 10 "mojo/public/js/bindings/buffer",
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 expect(testFiles.length).toBeGreaterThan(0); 201 expect(testFiles.length).toBeGreaterThan(0);
202 202
203 var noError = validator.validationError.NONE; 203 var noError = validator.validationError.NONE;
204 for (var i = 0; i < testFiles.length; i++) { 204 for (var i = 0; i < testFiles.length; i++) {
205 // TODO(hansmuller): Temporarily skipping array pointer overflow tests. 205 // TODO(hansmuller): Temporarily skipping array pointer overflow tests.
206 if (testFiles[i].indexOf("overflow") != -1) { 206 if (testFiles[i].indexOf("overflow") != -1) {
207 console.log("[Skipping " + testFiles[i] + "]"); 207 console.log("[Skipping " + testFiles[i] + "]");
208 continue; 208 continue;
209 } 209 }
210 210
211 // TODO(hansmuller): Temporarily skipping array unexpected null tests.
212 if (testFiles[i].indexOf("unexpected_null") != -1 ||
213 testFiles[i].indexOf("unexpected_invalid") != -1) {
214 console.log("[Skipping " + testFiles[i] + "]");
215 continue;
216 }
217
218 var testMessage = readTestMessage(testFiles[i]); 211 var testMessage = readTestMessage(testFiles[i]);
219 var handles = new Array(testMessage.handleCount); 212 var handles = new Array(testMessage.handleCount);
220 var message = new codec.Message(testMessage.buffer, handles); 213 var message = new codec.Message(testMessage.buffer, handles);
221 var messageValidator = new validator.Validator(message); 214 var messageValidator = new validator.Validator(message);
222 215
223 var err = messageValidator.validateMessageHeader(); 216 var err = messageValidator.validateMessageHeader();
224 for (var j = 0; err === noError && j < filters.length; ++j) 217 for (var j = 0; err === noError && j < filters.length; ++j)
225 err = filters[j](messageValidator); 218 err = filters[j](messageValidator);
226 219
227 var actualResult = (err === noError) ? "PASS" : err; 220 var actualResult = (err === noError) ? "PASS" : err;
(...skipping 15 matching lines...) Expand all
243 testInterface.validateIntegrationTestInterface1Request, 236 testInterface.validateIntegrationTestInterface1Request,
244 testInterface.validateIntegrationTestInterface2Response 237 testInterface.validateIntegrationTestInterface2Response
245 ]); 238 ]);
246 } 239 }
247 240
248 testConformanceMessageValidation(); 241 testConformanceMessageValidation();
249 testIntegrationMessageValidation(); 242 testIntegrationMessageValidation();
250 expect(checkTestMessageParser()).toBeNull(); 243 expect(checkTestMessageParser()).toBeNull();
251 this.result = "PASS"; 244 this.result = "PASS";
252 }); 245 });
OLDNEW
« no previous file with comments | « mojo/public/js/bindings/codec.js ('k') | mojo/public/js/bindings/validator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698