Index: chrome/renderer/extensions/json_schema_unittest.cc |
diff --git a/chrome/renderer/extensions/json_schema_unittest.cc b/chrome/renderer/extensions/json_schema_unittest.cc |
index 1e76b41986046c61acc8cfce2f864bdb4213ec20..c4b06147e107988d79f1be5a83a45ee4cdd7a5e6 100644 |
--- a/chrome/renderer/extensions/json_schema_unittest.cc |
+++ b/chrome/renderer/extensions/json_schema_unittest.cc |
@@ -25,15 +25,14 @@ class JsonSchemaTest : public V8UnitTest { |
std::string code = ResourceBundle::GetSharedInstance().GetRawDataResource( |
IDR_JSON_SCHEMA_JS).as_string(); |
- // 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" |
- "}"); |
+ // json_schema.js expects to have requireNative() defined. |
+ ExecuteScriptInContext( |
+ "function requireNative(id) {" |
+ " return {" |
+ " GetChromeHidden: function() { return {}; }," |
+ " };" |
+ "}", |
+ "test-code"); |
ExecuteScriptInContext(code, kJsonSchema); |
// Add the test functions to the context. |