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

Unified Diff: chrome/test/data/extensions/json_schema_test.js

Issue 7042021: Check for integer overflow when validating API function arguments. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update copyright headers Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/window_open/argument_overflow/test.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/json_schema_test.js
diff --git a/chrome/test/data/extensions/json_schema_test.js b/chrome/test/data/extensions/json_schema_test.js
index ee17ec673e30b76663d6067a2d09535daca9e983..e66442f5959f7bc758ccc21e50df37cf42728b68 100644
--- a/chrome/test/data/extensions/json_schema_test.js
+++ b/chrome/test/data/extensions/json_schema_test.js
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -421,6 +421,25 @@ function testNumber() {
]);
}
+function testIntegerBounds() {
+ assertValid("Number", 0, {type:"integer"});
+ assertValid("Number", -1, {type:"integer"});
+ assertValid("Number", 2147483647, {type:"integer"});
+ assertValid("Number", -2147483648, {type:"integer"});
+ assertNotValid("Number", 0.5, {type:"integer"},
+ [formatError("numberIntValue", [])]);
+ assertNotValid("Number", 10000000000, {type:"integer"},
+ [formatError("numberIntValue", [])]);
+ assertNotValid("Number", 2147483647.5, {type:"integer"},
+ [formatError("numberIntValue", [])]);
+ assertNotValid("Number", 2147483648, {type:"integer"},
+ [formatError("numberIntValue", [])]);
+ assertNotValid("Number", 2147483649, {type:"integer"},
+ [formatError("numberIntValue", [])]);
+ assertNotValid("Number", -2147483649, {type:"integer"},
+ [formatError("numberIntValue", [])]);
+}
+
function testType() {
// valid
assertValid("Type", {}, {type:"object"});
« no previous file with comments | « chrome/test/data/extensions/api_test/window_open/argument_overflow/test.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698