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

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

Issue 625009: Chromium plumbing for new file:// security flag, including test_shell support... (Closed) Base URL: svn://chrome-svn.corp.google.com/chrome/trunk/src/
Patch Set: Created 10 years, 10 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
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | webkit/tools/test_shell/test_shell.cc » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 BindMethod("objCClassNameOf", &LayoutTestController::objCClassNameOf); 145 BindMethod("objCClassNameOf", &LayoutTestController::objCClassNameOf);
146 BindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL); 146 BindMethod("addDisallowedURL", &LayoutTestController::addDisallowedURL);
147 BindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebV iews); 147 BindMethod("setCallCloseOnWebViews", &LayoutTestController::setCallCloseOnWebV iews);
148 BindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrows ingEnabled); 148 BindMethod("setPrivateBrowsingEnabled", &LayoutTestController::setPrivateBrows ingEnabled);
149 BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDa shboardCompatibilityMode); 149 BindMethod("setUseDashboardCompatibilityMode", &LayoutTestController::setUseDa shboardCompatibilityMode);
150 150
151 BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled ); 151 BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled );
152 BindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScr iptInIsolatedWorld); 152 BindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScr iptInIsolatedWorld);
153 BindMethod("overridePreference", &LayoutTestController::overridePreference); 153 BindMethod("overridePreference", &LayoutTestController::overridePreference);
154 BindMethod("setAllowUniversalAccessFromFileURLs", &LayoutTestController::setAl lowUniversalAccessFromFileURLs); 154 BindMethod("setAllowUniversalAccessFromFileURLs", &LayoutTestController::setAl lowUniversalAccessFromFileURLs);
155 BindMethod("setAllowFileAccessFromFileURLs", &LayoutTestController::setAllowFi leAccessFromFileURLs);
155 BindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelinePr ofilingEnabled); 156 BindMethod("setTimelineProfilingEnabled", &LayoutTestController::setTimelinePr ofilingEnabled);
156 BindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspe ctor); 157 BindMethod("evaluateInWebInspector", &LayoutTestController::evaluateInWebInspe ctor);
157 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection Colors); 158 BindMethod("forceRedSelectionColors", &LayoutTestController::forceRedSelection Colors);
158 159
159 // The fallback method is called when an unknown method is invoked. 160 // The fallback method is called when an unknown method is invoked.
160 BindFallbackMethod(&LayoutTestController::fallbackMethod); 161 BindFallbackMethod(&LayoutTestController::fallbackMethod);
161 162
162 // Shared properties. 163 // Shared properties.
163 // globalFlag is used by a number of layout tests in 164 // globalFlag is used by a number of layout tests in
164 // LayoutTests\http\tests\security\dataURL. 165 // LayoutTests\http\tests\security\dataURL.
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 void LayoutTestController::setAllowUniversalAccessFromFileURLs( 893 void LayoutTestController::setAllowUniversalAccessFromFileURLs(
893 const CppArgumentList& args, CppVariant* result) { 894 const CppArgumentList& args, CppVariant* result) {
894 if (args.size() > 0 && args[0].isBool()) { 895 if (args.size() > 0 && args[0].isBool()) {
895 WebPreferences* prefs = shell_->GetWebPreferences(); 896 WebPreferences* prefs = shell_->GetWebPreferences();
896 prefs->allow_universal_access_from_file_urls = args[0].value.boolValue; 897 prefs->allow_universal_access_from_file_urls = args[0].value.boolValue;
897 prefs->Apply(shell_->webView()); 898 prefs->Apply(shell_->webView());
898 } 899 }
899 result->SetNull(); 900 result->SetNull();
900 } 901 }
901 902
903 void LayoutTestController::setAllowFileAccessFromFileURLs(
904 const CppArgumentList& args, CppVariant* result) {
905 if (args.size() > 0 && args[0].isBool()) {
906 WebPreferences* prefs = shell_->GetWebPreferences();
907 prefs->allow_file_access_from_file_urls = args[0].value.boolValue;
908 prefs->Apply(shell_->webView());
909 }
910 result->SetNull();
911 }
912
902 // Need these conversions because the format of the value for booleans 913 // Need these conversions because the format of the value for booleans
903 // may vary - for example, on mac "1" and "0" are used for boolean. 914 // may vary - for example, on mac "1" and "0" are used for boolean.
904 bool LayoutTestController::CppVariantToBool(const CppVariant& value) { 915 bool LayoutTestController::CppVariantToBool(const CppVariant& value) {
905 if (value.isBool()) 916 if (value.isBool())
906 return value.ToBoolean(); 917 return value.ToBoolean();
907 else if (value.isInt32()) 918 else if (value.isInt32())
908 return 0 != value.ToInt32(); 919 return 0 != value.ToInt32();
909 else if (value.isString()) { 920 else if (value.isString()) {
910 std::string valueString = value.ToString(); 921 std::string valueString = value.ToString();
911 if (valueString == "true" || valueString == "1") 922 if (valueString == "true" || valueString == "1")
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 } 1174 }
1164 1175
1165 void LayoutTestController::addUserScript(const CppArgumentList& args, 1176 void LayoutTestController::addUserScript(const CppArgumentList& args,
1166 CppVariant* result) { 1177 CppVariant* result) {
1167 result->SetNull(); 1178 result->SetNull();
1168 if (args.size() < 1 || !args[0].isString() || !args[1].isBool()) 1179 if (args.size() < 1 || !args[0].isString() || !args[1].isBool())
1169 return; 1180 return;
1170 shell_->webView()->addUserScript(WebString::fromUTF8(args[0].ToString()), 1181 shell_->webView()->addUserScript(WebString::fromUTF8(args[0].ToString()),
1171 args[1].ToBoolean()); 1182 args[1].ToBoolean());
1172 } 1183 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/layout_test_controller.h ('k') | webkit/tools/test_shell/test_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698