| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/test/base/module_system_test.h" | |
| 6 #include "extensions/renderer/v8_schema_registry.h" | |
| 7 #include "grit/extensions_renderer_resources.h" | |
| 8 | |
| 9 namespace extensions { | |
| 10 | |
| 11 class JsonSchemaTest : public ModuleSystemTest { | |
| 12 public: | |
| 13 virtual void SetUp() OVERRIDE { | |
| 14 ModuleSystemTest::SetUp(); | |
| 15 | |
| 16 env()->RegisterModule("json_schema", IDR_JSON_SCHEMA_JS); | |
| 17 env()->RegisterModule("utils", IDR_UTILS_JS); | |
| 18 | |
| 19 env()->module_system()->RegisterNativeHandler( | |
| 20 "schema_registry", schema_registry_.AsNativeHandler()); | |
| 21 | |
| 22 env()->RegisterTestFile("json_schema_test", "json_schema_test.js"); | |
| 23 } | |
| 24 | |
| 25 protected: | |
| 26 void TestFunction(const std::string& test_name) { | |
| 27 env()->module_system()->CallModuleMethod("json_schema_test", test_name); | |
| 28 } | |
| 29 | |
| 30 private: | |
| 31 V8SchemaRegistry schema_registry_; | |
| 32 }; | |
| 33 | |
| 34 TEST_F(JsonSchemaTest, TestFormatError) { | |
| 35 TestFunction("testFormatError"); | |
| 36 } | |
| 37 | |
| 38 TEST_F(JsonSchemaTest, TestComplex) { | |
| 39 TestFunction("testComplex"); | |
| 40 } | |
| 41 | |
| 42 TEST_F(JsonSchemaTest, TestEnum) { | |
| 43 TestFunction("testEnum"); | |
| 44 } | |
| 45 | |
| 46 TEST_F(JsonSchemaTest, TestExtends) { | |
| 47 TestFunction("testExtends"); | |
| 48 } | |
| 49 | |
| 50 TEST_F(JsonSchemaTest, TestObject) { | |
| 51 TestFunction("testObject"); | |
| 52 } | |
| 53 | |
| 54 TEST_F(JsonSchemaTest, TestArrayTuple) { | |
| 55 TestFunction("testArrayTuple"); | |
| 56 } | |
| 57 | |
| 58 TEST_F(JsonSchemaTest, TestArrayNonTuple) { | |
| 59 TestFunction("testArrayNonTuple"); | |
| 60 } | |
| 61 | |
| 62 TEST_F(JsonSchemaTest, TestString) { | |
| 63 TestFunction("testString"); | |
| 64 } | |
| 65 | |
| 66 TEST_F(JsonSchemaTest, TestNumber) { | |
| 67 TestFunction("testNumber"); | |
| 68 } | |
| 69 | |
| 70 TEST_F(JsonSchemaTest, TestIntegerBounds) { | |
| 71 TestFunction("testIntegerBounds"); | |
| 72 } | |
| 73 | |
| 74 TEST_F(JsonSchemaTest, TestType) { | |
| 75 TestFunction("testType"); | |
| 76 } | |
| 77 | |
| 78 TEST_F(JsonSchemaTest, TestTypeReference) { | |
| 79 TestFunction("testTypeReference"); | |
| 80 } | |
| 81 | |
| 82 TEST_F(JsonSchemaTest, TestGetAllTypesForSchema) { | |
| 83 TestFunction("testGetAllTypesForSchema"); | |
| 84 } | |
| 85 | |
| 86 TEST_F(JsonSchemaTest, TestIsValidSchemaType) { | |
| 87 TestFunction("testIsValidSchemaType"); | |
| 88 } | |
| 89 | |
| 90 TEST_F(JsonSchemaTest, TestCheckSchemaOverlap) { | |
| 91 TestFunction("testCheckSchemaOverlap"); | |
| 92 } | |
| 93 | |
| 94 TEST_F(JsonSchemaTest, TestInstanceOf) { | |
| 95 TestFunction("testInstanceOf"); | |
| 96 } | |
| 97 | |
| 98 } // namespace extensions | |
| OLD | NEW |