Ensure low-memory renderers retry failed loads correctly.
[chromium-blink-merge.git] / components / json_schema / json_schema_validator_unittest_base.h
blobff661acb327f09771ce703a19cc8df23db1febcd
1 // Copyright 2013 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.
5 #ifndef COMPONENTS_JSON_SCHEMA_JSON_SCHEMA_VALIDATOR_UNITTEST_BASE_H_
6 #define COMPONENTS_JSON_SCHEMA_JSON_SCHEMA_VALIDATOR_UNITTEST_BASE_H_
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace base {
11 class DictionaryValue;
12 class ListValue;
13 class Value;
16 // Base class for unit tests for JSONSchemaValidator. There is currently only
17 // one implementation, JSONSchemaValidatorCPPTest.
19 // TODO(aa): Refactor extensions/test/data/json_schema_test.js into
20 // JSONSchemaValidatorJSTest that inherits from this.
21 class JSONSchemaValidatorTestBase : public testing::Test {
22 public:
23 JSONSchemaValidatorTestBase();
25 void RunTests();
27 protected:
28 virtual void ExpectValid(const std::string& test_source,
29 base::Value* instance,
30 base::DictionaryValue* schema,
31 base::ListValue* types) = 0;
33 virtual void ExpectNotValid(const std::string& test_source,
34 base::Value* instance,
35 base::DictionaryValue* schema,
36 base::ListValue* types,
37 const std::string& expected_error_path,
38 const std::string& expected_error_message) = 0;
40 private:
41 void TestComplex();
42 void TestStringPattern();
43 void TestEnum();
44 void TestChoices();
45 void TestExtends();
46 void TestObject();
47 void TestTypeReference();
48 void TestArrayTuple();
49 void TestArrayNonTuple();
50 void TestString();
51 void TestNumber();
52 void TestTypeClassifier();
53 void TestTypes();
56 #endif // COMPONENTS_JSON_SCHEMA_JSON_SCHEMA_VALIDATOR_UNITTEST_BASE_H_