OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_EXTENSIONS_JSON_SCHEMA_VALIDATOR_UNITTEST_BASE_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_JSON_SCHEMA_VALIDATOR_UNITTEST_BASE_H_ |
| 7 |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 class DictionaryValue; |
| 11 class ListValue; |
| 12 class Value; |
| 13 |
| 14 class JSONSchemaValidatorTestBase : public testing::Test { |
| 15 public: |
| 16 enum ValidatorType { |
| 17 CPP = 1, |
| 18 JS = 2 |
| 19 }; |
| 20 |
| 21 JSONSchemaValidatorTestBase(ValidatorType type); |
| 22 |
| 23 void RunTests(); |
| 24 |
| 25 protected: |
| 26 virtual void ExpectValid(const std::string& test_source, |
| 27 Value* instance, DictionaryValue* schema, |
| 28 ListValue* types) = 0; |
| 29 |
| 30 virtual void ExpectNotValid(const std::string& test_source, |
| 31 Value* instance, DictionaryValue* schema, |
| 32 ListValue* types, |
| 33 const std::string& expected_error_path, |
| 34 const std::string& expected_error_message) = 0; |
| 35 |
| 36 private: |
| 37 void TestComplex(); |
| 38 void TestStringPattern(); |
| 39 void TestEnum(); |
| 40 void TestChoices(); |
| 41 void TestExtends(); |
| 42 void TestObject(); |
| 43 void TestTypeReference(); |
| 44 |
| 45 ValidatorType type_; |
| 46 }; |
| 47 |
| 48 #endif // CHROME_COMMON_EXTENSIONS_JSON_SCHEMA_VALIDATOR_UNITTEST_BASE_H_ |
OLD | NEW |