summaryrefslogtreecommitdiffstats
path: root/webkit/tools/test_shell/layout_test_controller.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 19:00:26 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 19:00:26 +0000
commit20dcfd549f122b8a15b76447c14c5c3539c88242 (patch)
treeae8c81d0906704665653f2feb104c65215af098b /webkit/tools/test_shell/layout_test_controller.cc
parente718099e5cb97a6b49788c977ef157083e12334e (diff)
downloadchromium_src-20dcfd549f122b8a15b76447c14c5c3539c88242.zip
chromium_src-20dcfd549f122b8a15b76447c14c5c3539c88242.tar.gz
chromium_src-20dcfd549f122b8a15b76447c14c5c3539c88242.tar.bz2
Re-land r23931: Plumb whiteListAccessFromOrigin() through
Chromium's WebKit API and enable the related layout tests. After some digging, I realized the problem here, sorta. The test that was failing actually fails flakily. There are two flavors of this test: sync and async. The async test was already marked flakey, the sync test was not. My change upstream refactored XHR to make the sync and async cases share much more code. So it is not surprising that they are now both flakey. Review URL: http://codereview.chromium.org/173209 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23994 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/tools/test_shell/layout_test_controller.cc')
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index fe09e99..d226575 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -15,7 +15,9 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "webkit/api/public/WebFrame.h"
+#include "webkit/api/public/WebKit.h"
#include "webkit/api/public/WebScriptSource.h"
+#include "webkit/api/public/WebURL.h"
#include "webkit/glue/dom_operations.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
@@ -118,6 +120,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) {
BindMethod("setCustomPolicyDelegate", &LayoutTestController::setCustomPolicyDelegate);
BindMethod("waitForPolicyDelegate", &LayoutTestController::waitForPolicyDelegate);
BindMethod("setWillSendRequestReturnsNullOnRedirect", &LayoutTestController::setWillSendRequestReturnsNullOnRedirect);
+ BindMethod("whiteListAccessFromOrigin", &LayoutTestController::whiteListAccessFromOrigin);
// The following are stubs.
BindMethod("dumpAsWebArchive", &LayoutTestController::dumpAsWebArchive);
@@ -425,6 +428,8 @@ void LayoutTestController::Reset() {
globalFlag_.Set(false);
webHistoryItemCount_.Set(0);
+ WebKit::resetOriginAccessWhiteLists();
+
if (close_remaining_windows_) {
// Iterate through the window list and close everything except the original
// shell. We don't want to delete elements as we're iterating, so we copy
@@ -924,3 +929,22 @@ void LayoutTestController::fallbackMethod(
}
result->SetNull();
}
+
+void LayoutTestController::whiteListAccessFromOrigin(
+ const CppArgumentList& args, CppVariant* result)
+{
+ result->SetNull();
+
+ if (args.size() != 4 || !args[0].isString() || !args[1].isString() ||
+ !args[2].isString() || !args[3].isBool())
+ return;
+
+ WebKit::WebURL url(GURL(args[0].ToString()));
+ if (!url.isValid())
+ return;
+
+ WebKit::whiteListAccessFromOrigin(url,
+ WebString::fromUTF8(args[1].ToString()),
+ WebString::fromUTF8(args[2].ToString()),
+ args[3].ToBoolean());
+}