| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "extensions/renderer/api_binding_test_util.h" | 7 #include "extensions/renderer/api_binding_test_util.h" |
| 8 #include "extensions/renderer/api_type_reference_map.h" | 8 #include "extensions/renderer/api_type_reference_map.h" |
| 9 #include "extensions/renderer/argument_spec.h" | 9 #include "extensions/renderer/argument_spec.h" |
| 10 #include "gin/converter.h" | 10 #include "gin/converter.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 152 |
| 153 { | 153 { |
| 154 ArgumentSpec spec(*ValueFromString("{'type': 'integer', 'minimum': 1}")); | 154 ArgumentSpec spec(*ValueFromString("{'type': 'integer', 'minimum': 1}")); |
| 155 ExpectSuccess(spec, "2", "2"); | 155 ExpectSuccess(spec, "2", "2"); |
| 156 ExpectSuccess(spec, "1", "1"); | 156 ExpectSuccess(spec, "1", "1"); |
| 157 ExpectFailure(spec, "0"); | 157 ExpectFailure(spec, "0"); |
| 158 ExpectFailure(spec, "-1"); | 158 ExpectFailure(spec, "-1"); |
| 159 } | 159 } |
| 160 | 160 |
| 161 { | 161 { |
| 162 ArgumentSpec spec(*ValueFromString("{'type': 'integer', 'maximum': 10}")); |
| 163 ExpectSuccess(spec, "10", "10"); |
| 164 ExpectSuccess(spec, "1", "1"); |
| 165 ExpectFailure(spec, "11"); |
| 166 } |
| 167 |
| 168 { |
| 162 ArgumentSpec spec(*ValueFromString("{'type': 'string'}")); | 169 ArgumentSpec spec(*ValueFromString("{'type': 'string'}")); |
| 163 ExpectSuccess(spec, "'foo'", "'foo'"); | 170 ExpectSuccess(spec, "'foo'", "'foo'"); |
| 164 ExpectSuccess(spec, "''", "''"); | 171 ExpectSuccess(spec, "''", "''"); |
| 165 ExpectFailure(spec, "1"); | 172 ExpectFailure(spec, "1"); |
| 166 ExpectFailure(spec, "{}"); | 173 ExpectFailure(spec, "{}"); |
| 167 ExpectFailure(spec, "['foo']"); | 174 ExpectFailure(spec, "['foo']"); |
| 168 } | 175 } |
| 169 | 176 |
| 170 { | 177 { |
| 171 ArgumentSpec spec( | 178 ArgumentSpec spec( |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 "{'type': 'array', 'items': {'type': 'integer'}, 'maxItems': 3}"; | 643 "{'type': 'array', 'items': {'type': 'integer'}, 'maxItems': 3}"; |
| 637 ArgumentSpec spec(*ValueFromString(kMaxLengthArray)); | 644 ArgumentSpec spec(*ValueFromString(kMaxLengthArray)); |
| 638 ExpectSuccess(spec, "[1, 2, 3]", "[1,2,3]"); | 645 ExpectSuccess(spec, "[1, 2, 3]", "[1,2,3]"); |
| 639 ExpectSuccess(spec, "[1, 2]", "[1,2]"); | 646 ExpectSuccess(spec, "[1, 2]", "[1,2]"); |
| 640 ExpectSuccess(spec, "[]", "[]"); | 647 ExpectSuccess(spec, "[]", "[]"); |
| 641 ExpectFailure(spec, "[1, 2, 3, 4]"); | 648 ExpectFailure(spec, "[1, 2, 3, 4]"); |
| 642 } | 649 } |
| 643 } | 650 } |
| 644 | 651 |
| 645 } // namespace extensions | 652 } // namespace extensions |
| OLD | NEW |