OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
9 #include "chrome/test/base/v8_unit_test.h" | 9 #include "chrome/test/base/v8_unit_test.h" |
10 #include "grit/renderer_resources.h" | 10 #include "grit/renderer_resources.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 // Add the json schema code to the context. | 26 // Add the json schema code to the context. |
27 std::string code = ResourceBundle::GetSharedInstance().GetRawDataResource( | 27 std::string code = ResourceBundle::GetSharedInstance().GetRawDataResource( |
28 IDR_JSON_SCHEMA_JS).as_string(); | 28 IDR_JSON_SCHEMA_JS).as_string(); |
29 | 29 |
30 // json_schema.js expects to have require() and requireNative() defined. | 30 // json_schema.js expects to have require() and requireNative() defined. |
31 ExecuteScriptInContext( | 31 ExecuteScriptInContext( |
32 "function requireNative(id) {" | 32 "function requireNative(id) {" |
33 " return {" | 33 " return {" |
34 " GetChromeHidden: function() { return {}; }," | 34 " GetChromeHidden: function() { return {}; }," |
| 35 " CHECK: function(foo, bar) { return undefined; }," |
35 " };" | 36 " };" |
36 "}" | 37 "}" |
37 "function require(id) {" | 38 "function require(id) {" |
38 " return {" | 39 " return {" |
39 " loadRefDependency: function(foo) { return {}; }," | 40 " loadTypeSchema: function(foo) { return undefined; }," |
40 " };" | 41 " };" |
41 "}", | 42 "}", |
42 "test-code"); | 43 "test-code"); |
43 ExecuteScriptInContext(code, kJsonSchema); | 44 ExecuteScriptInContext(code, kJsonSchema); |
44 | 45 |
45 // Add the test functions to the context. | 46 // Add the test functions to the context. |
46 base::FilePath test_js_file_path; | 47 base::FilePath test_js_file_path; |
47 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_js_file_path)); | 48 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_js_file_path)); |
48 test_js_file_path = test_js_file_path.AppendASCII("extensions"); | 49 test_js_file_path = test_js_file_path.AppendASCII("extensions"); |
49 test_js_file_path = test_js_file_path.AppendASCII(kJsonSchemaTest); | 50 test_js_file_path = test_js_file_path.AppendASCII(kJsonSchemaTest); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 TEST_F(JsonSchemaTest, TestIsValidSchemaType) { | 109 TEST_F(JsonSchemaTest, TestIsValidSchemaType) { |
109 TestFunction("testIsValidSchemaType"); | 110 TestFunction("testIsValidSchemaType"); |
110 } | 111 } |
111 | 112 |
112 TEST_F(JsonSchemaTest, TestCheckSchemaOverlap) { | 113 TEST_F(JsonSchemaTest, TestCheckSchemaOverlap) { |
113 TestFunction("testCheckSchemaOverlap"); | 114 TestFunction("testCheckSchemaOverlap"); |
114 } | 115 } |
115 | 116 |
116 } // namespace extensions | 117 } // namespace extensions |
OLD | NEW |