Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: chrome/renderer/extensions/json_schema_unittest.cc

Issue 12647017: Lazily require types when validating Extensions API calls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
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 " };" 35 " };"
36 "}" 36 "}"
37 "function require(id) {" 37 "function require(id) {"
38 " return {" 38 " return {"
39 " loadRefDependency: function(foo) { return {}; }," 39 " loadRefType: function(foo) { return undefined; },"
40 " };" 40 " };"
41 "}", 41 "}",
42 "test-code"); 42 "test-code");
43 ExecuteScriptInContext(code, kJsonSchema); 43 ExecuteScriptInContext(code, kJsonSchema);
44 44
45 // Add the test functions to the context. 45 // Add the test functions to the context.
46 base::FilePath test_js_file_path; 46 base::FilePath test_js_file_path;
47 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_js_file_path)); 47 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_js_file_path));
48 test_js_file_path = test_js_file_path.AppendASCII("extensions"); 48 test_js_file_path = test_js_file_path.AppendASCII("extensions");
49 test_js_file_path = test_js_file_path.AppendASCII(kJsonSchemaTest); 49 test_js_file_path = test_js_file_path.AppendASCII(kJsonSchemaTest);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 TEST_F(JsonSchemaTest, TestIsValidSchemaType) { 108 TEST_F(JsonSchemaTest, TestIsValidSchemaType) {
109 TestFunction("testIsValidSchemaType"); 109 TestFunction("testIsValidSchemaType");
110 } 110 }
111 111
112 TEST_F(JsonSchemaTest, TestCheckSchemaOverlap) { 112 TEST_F(JsonSchemaTest, TestCheckSchemaOverlap) {
113 TestFunction("testCheckSchemaOverlap"); 113 TestFunction("testCheckSchemaOverlap");
114 } 114 }
115 115
116 } // namespace extensions 116 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698