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

Side by Side Diff: webkit/tools/test_shell/layout_test_controller.cc

Issue 159782: Actually process the work queue if layoutTestController.waitUntilDone() is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file contains the definition for LayoutTestController. 5 // This file contains the definition for LayoutTestController.
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "webkit/tools/test_shell/layout_test_controller.h" 9 #include "webkit/tools/test_shell/layout_test_controller.h"
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 BindMethod("keepWebHistory", &LayoutTestController::keepWebHistory); 127 BindMethod("keepWebHistory", &LayoutTestController::keepWebHistory);
128 BindMethod("storeWebScriptObject", &LayoutTestController::storeWebScriptObject ); 128 BindMethod("storeWebScriptObject", &LayoutTestController::storeWebScriptObject );
129 BindMethod("accessStoredWebScriptObject", &LayoutTestController::accessStoredW ebScriptObject); 129 BindMethod("accessStoredWebScriptObject", &LayoutTestController::accessStoredW ebScriptObject);
130 BindMethod("objCClassNameOf", &LayoutTestController::objCClassNameOf); 130 BindMethod("objCClassNameOf", &LayoutTestController::objCClassNameOf);
131 BindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL); 131 BindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL);
132 BindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebV iews); 132 BindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebV iews);
133 BindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrows ingEnabled); 133 BindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrows ingEnabled);
134 BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDa shboardCompatibilityMode); 134 BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDa shboardCompatibilityMode);
135 135
136 BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled ); 136 BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled );
137 BindMethod("queueScriptInIsolatedWorld", &LayoutTestController::queueScriptInI solatedWorld); 137 BindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScr iptInIsolatedWorld);
138 138
139 // The fallback method is called when an unknown method is invoked. 139 // The fallback method is called when an unknown method is invoked.
140 BindFallbackMethod(&LayoutTestController::fallbackMethod); 140 BindFallbackMethod(&LayoutTestController::fallbackMethod);
141 141
142 // Shared properties. 142 // Shared properties.
143 // globalFlag is used by a number of layout tests in 143 // globalFlag is used by a number of layout tests in
144 // LayoutTests\http\tests\security\dataURL. 144 // LayoutTests\http\tests\security\dataURL.
145 BindProperty("globalFlag", &globalFlag_); 145 BindProperty("globalFlag", &globalFlag_);
146 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history 146 // webHistoryItemCount is used by tests in LayoutTests\http\tests\history
147 BindProperty("webHistoryItemCount", &webHistoryItemCount_); 147 BindProperty("webHistoryItemCount", &webHistoryItemCount_);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 WorkItemNonLoadingScript(const string& script) : script_(script) {} 339 WorkItemNonLoadingScript(const string& script) : script_(script) {}
340 bool Run(TestShell* shell) { 340 bool Run(TestShell* shell) {
341 shell->webView()->GetMainFrame()->ExecuteScript( 341 shell->webView()->GetMainFrame()->ExecuteScript(
342 WebScriptSource(WebString::fromUTF8(script_))); 342 WebScriptSource(WebString::fromUTF8(script_)));
343 return false; 343 return false;
344 } 344 }
345 private: 345 private:
346 string script_; 346 string script_;
347 }; 347 };
348 348
349 class WorkItemIsolatedWorldScript : public LayoutTestController::WorkItem {
350 public:
351 WorkItemIsolatedWorldScript(const string& script) : script_(script) {}
352 bool Run(TestShell* shell) {
353 WebScriptSource source(WebString::fromUTF8(script_));
354 shell->webView()->GetMainFrame()->ExecuteScriptInNewWorld(&source, 1);
355 return false;
356 }
357 private:
358 string script_;
359 };
360
361 void LayoutTestController::queueLoadingScript( 349 void LayoutTestController::queueLoadingScript(
362 const CppArgumentList& args, CppVariant* result) { 350 const CppArgumentList& args, CppVariant* result) {
363 if (args.size() > 0 && args[0].isString()) 351 if (args.size() > 0 && args[0].isString())
364 work_queue_.AddWork(new WorkItemLoadingScript(args[0].ToString())); 352 work_queue_.AddWork(new WorkItemLoadingScript(args[0].ToString()));
365 result->SetNull(); 353 result->SetNull();
366 } 354 }
367 355
368 void LayoutTestController::queueNonLoadingScript( 356 void LayoutTestController::queueNonLoadingScript(
369 const CppArgumentList& args, CppVariant* result) { 357 const CppArgumentList& args, CppVariant* result) {
370 if (args.size() > 0 && args[0].isString()) 358 if (args.size() > 0 && args[0].isString())
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 void LayoutTestController::setXSSAuditorEnabled( 765 void LayoutTestController::setXSSAuditorEnabled(
778 const CppArgumentList& args, CppVariant* result) { 766 const CppArgumentList& args, CppVariant* result) {
779 if (args.size() > 0 && args[0].isBool()) { 767 if (args.size() > 0 && args[0].isBool()) {
780 WebPreferences* preferences = shell_->GetWebPreferences(); 768 WebPreferences* preferences = shell_->GetWebPreferences();
781 preferences->xss_auditor_enabled = args[0].value.boolValue; 769 preferences->xss_auditor_enabled = args[0].value.boolValue;
782 shell_->webView()->SetPreferences(*preferences); 770 shell_->webView()->SetPreferences(*preferences);
783 } 771 }
784 result->SetNull(); 772 result->SetNull();
785 } 773 }
786 774
787 void LayoutTestController::queueScriptInIsolatedWorld( 775 void LayoutTestController::evaluateScriptInIsolatedWorld(
788 const CppArgumentList& args, CppVariant* result) { 776 const CppArgumentList& args, CppVariant* result) {
789 if (args.size() > 0 && args[0].isString()) 777 if (args.size() > 0 && args[0].isString()) {
790 work_queue_.AddWork(new WorkItemIsolatedWorldScript(args[0].ToString())); 778 WebScriptSource source(WebString::fromUTF8(args[0].ToString()));
779 shell_->webView()->GetMainFrame()->ExecuteScriptInNewWorld(&source, 1);
780 }
791 result->SetNull(); 781 result->SetNull();
792 } 782 }
793 783
794 void LayoutTestController::fallbackMethod( 784 void LayoutTestController::fallbackMethod(
795 const CppArgumentList& args, CppVariant* result) { 785 const CppArgumentList& args, CppVariant* result) {
796 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo ntroller"); 786 std::wstring message(L"JavaScript ERROR: unknown method called on LayoutTestCo ntroller");
797 if (!shell_->layout_test_mode()) { 787 if (!shell_->layout_test_mode()) {
798 logging::LogMessage("CONSOLE:", 0).stream() << message; 788 logging::LogMessage("CONSOLE:", 0).stream() << message;
799 } else { 789 } else {
800 printf("CONSOLE MESSAGE: %S\n", message.c_str()); 790 printf("CONSOLE MESSAGE: %S\n", message.c_str());
801 } 791 }
802 result->SetNull(); 792 result->SetNull();
803 } 793 }
OLDNEW
« 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