summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 02:27:48 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-11 02:27:48 +0000
commit1c966c891f7f495fd08c84b58ec145bd6bd7d181 (patch)
tree760ea623c6de485ecb3ad79719484149b0ad5dac /webkit
parent1f4dd6d26bc1a1548a270c0ad94b58321637e7a0 (diff)
downloadchromium_src-1c966c891f7f495fd08c84b58ec145bd6bd7d181.zip
chromium_src-1c966c891f7f495fd08c84b58ec145bd6bd7d181.tar.gz
chromium_src-1c966c891f7f495fd08c84b58ec145bd6bd7d181.tar.bz2
Add method to control whether local files get universal access during testing.
This is required to test any form of local filesystem access restrictions. BUG=20450 TEST=Needed for LayoutTests/fast/xmlhttprequest/xmlhttprequest-nonexistent-file.html Review URL: http://codereview.chromium.org/384015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31643 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc11
-rw-r--r--webkit/tools/test_shell/layout_test_controller.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index fbedf9c..f400ce0 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -140,6 +140,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) :
BindMethod("setXSSAuditorEnabled", &LayoutTestController::setXSSAuditorEnabled);
BindMethod("evaluateScriptInIsolatedWorld", &LayoutTestController::evaluateScriptInIsolatedWorld);
BindMethod("overridePreference", &LayoutTestController::overridePreference);
+ BindMethod("setAllowUniversalAccessFromFileURLs", &LayoutTestController::setAllowUniversalAccessFromFileURLs);
// The fallback method is called when an unknown method is invoked.
BindFallbackMethod(&LayoutTestController::fallbackMethod);
@@ -843,6 +844,16 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(
result->SetNull();
}
+void LayoutTestController::setAllowUniversalAccessFromFileURLs(
+ const CppArgumentList& args, CppVariant* result) {
+ if (args.size() > 0 && args[0].isBool()) {
+ WebPreferences* prefs = shell_->GetWebPreferences();
+ prefs->allow_universal_access_from_file_urls = args[0].value.boolValue;
+ prefs->Apply(shell_->webView());
+ }
+ result->SetNull();
+}
+
// Need these conversions because the format of the value for booleans
// may vary - for example, on mac "1" and "0" are used for boolean.
bool LayoutTestController::CppVariantToBool(const CppVariant& value) {
diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h
index d84d5cb..1ddb879 100644
--- a/webkit/tools/test_shell/layout_test_controller.h
+++ b/webkit/tools/test_shell/layout_test_controller.h
@@ -187,6 +187,7 @@ class LayoutTestController : public CppBoundClass {
void setXSSAuditorEnabled(const CppArgumentList& args, CppVariant* result);
void evaluateScriptInIsolatedWorld(const CppArgumentList& args, CppVariant* result);
void overridePreference(const CppArgumentList& args, CppVariant* result);
+ void setAllowUniversalAccessFromFileURLs(const CppArgumentList& args, CppVariant* result);
// The fallback method is called when a nonexistent method is called on
// the layout test controller object.