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

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

Issue 5018002: Fixes a crash when entering a negative index with chrome.tabs.move .... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
Index: chrome/test/data/extensions/json_schema_test.js
===================================================================
--- chrome/test/data/extensions/json_schema_test.js (revision 65777)
+++ chrome/test/data/extensions/json_schema_test.js (working copy)
@@ -419,6 +419,25 @@
[formatError("numberFiniteNotNan", ["-Infinity"]),
formatError("numberMinValue", [schema.minimum])
]);
+
+ // 0 casts to bool differently, so it's important to test
+ // BUG=53990.
+ var zero_min_schema = {
+ 'minimum': 0,
+ 'maximum': 100
+ };
+ assertNotValid("Number", -1, zero_min_schema,
+ [formatError("numberMinValue", [zero_min_schema.minimum])]);
+ assertValid("Number", 0, zero_min_schema);
+
+ var zero_max_schema = {
+ 'minimum': -20,
+ 'maximum': '0'
+ };
+ assertNotValid("Number", 1, zero_max_schema,
+ [formatError("numberMaxValue", [zero_max_schema.maximum])]);
+ assertValid("Number", 0, zero_max_schema);
+
}
function testType() {
@@ -461,4 +480,10 @@
[formatError("invalidType", ["null", "undefined"])]);
assertNotValid("Type", {}, {type: "function"},
[formatError("invalidType", ["function", "object"])]);
+ // Values outside of the range of an integer weren't being tested
+ // BUG=53990.
+ assertNotValid("Type", 1e10, {type: "integer"},
+ [formatError("invalidType", ["integer", "number"])]);
+ assertNotValid("Type", -1e10, {type: "integer"},
+ [formatError("invalidType", ["integer", "number"])]);
}

Powered by Google App Engine
This is Rietveld 408576698