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

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

Issue 9386001: Implement a module system for the extension bindings JS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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
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.
« 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