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

Unified Diff: chrome/renderer/extensions/json_schema_unittest.cc

Issue 9657026: Revert 125801 - Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
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.
« no previous file with comments | « chrome/renderer/extensions/i18n_custom_bindings.cc ('k') | chrome/renderer/extensions/miscellaneous_bindings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698