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

Unified Diff: webkit/tools/test_shell/layout_test_controller.cc

Issue 149193: Add some test for isolated worlds. These tests don't run properly at the mom... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/tools/test_shell/layout_test_controller.cc
===================================================================
--- webkit/tools/test_shell/layout_test_controller.cc (revision 19799)
+++ webkit/tools/test_shell/layout_test_controller.cc (working copy)
@@ -134,6 +134,7 @@
BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDashboardCompatibilityMode);
BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled);
+ BindMethod("queueScriptInIsolatedWorld", &LayoutTestController::queueScriptInIsolatedWorld);
// The fallback method is called when an unknown method is invoked.
BindFallbackMethod(&LayoutTestController::fallbackMethod);
@@ -345,6 +346,18 @@
string script_;
};
+class WorkItemIsolatedWorldScript : public LayoutTestController::WorkItem {
+ public:
+ WorkItemIsolatedWorldScript(const string& script) : script_(script) {}
+ bool Run(TestShell* shell) {
+ WebScriptSource source(WebString::fromUTF8(script_));
+ shell->webView()->GetMainFrame()->ExecuteScriptInNewContext(&source, 1);
+ return false;
+ }
+ private:
+ string script_;
+};
+
void LayoutTestController::queueLoadingScript(
const CppArgumentList& args, CppVariant* result) {
if (args.size() > 0 && args[0].isString())
@@ -771,6 +784,13 @@
result->SetNull();
}
+void LayoutTestController::queueScriptInIsolatedWorld(
+ const CppArgumentList& args, CppVariant* result) {
+ if (args.size() > 0 && args[0].isString())
+ work_queue_.AddWork(new WorkItemIsolatedWorldScript(args[0].ToString()));
+ result->SetNull();
+}
+
void LayoutTestController::fallbackMethod(
const CppArgumentList& args, CppVariant* result) {
std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestController");
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698