| Index: chrome/renderer/extensions/json_schema_unittest.cc
|
| ===================================================================
|
| --- chrome/renderer/extensions/json_schema_unittest.cc (revision 125813)
|
| +++ chrome/renderer/extensions/json_schema_unittest.cc (working copy)
|
| @@ -25,14 +25,15 @@
|
| std::string code = ResourceBundle::GetSharedInstance().GetRawDataResource(
|
| IDR_JSON_SCHEMA_JS).as_string();
|
|
|
| - // json_schema.js expects to have requireNative() defined.
|
| - ExecuteScriptInContext(
|
| - "function requireNative(id) {"
|
| - " return {"
|
| - " GetChromeHidden: function() { return {}; },"
|
| - " };"
|
| - "}",
|
| - "test-code");
|
| + // This is a nasty hack, but it is easier to test the code if we don't use
|
| + // it as a v8 extension. So replace the only bit that relies on that with a
|
| + // more easily testable implementation.
|
| + ReplaceFirstSubstringAfterOffset(&code, 0,
|
| + "native function GetChromeHidden();",
|
| + "function GetChromeHidden() {\n"
|
| + " if (!this.chromeHidden) this.chromeHidden = {};\n"
|
| + " return this.chromeHidden;\n"
|
| + "}");
|
| ExecuteScriptInContext(code, kJsonSchema);
|
|
|
| // Add the test functions to the context.
|
|
|