summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 06:50:14 +0000
committerlevin@chromium.org <levin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-04 06:50:14 +0000
commit6d4b3fc87435060e6c9f4b918cef49230d2bb6c9 (patch)
tree811583a75c8d3501662fe6326c0199c2097d146b /webkit
parent8a3b796aa8160ddaed478224050a2b7e1b16d9e6 (diff)
downloadchromium_src-6d4b3fc87435060e6c9f4b918cef49230d2bb6c9.zip
chromium_src-6d4b3fc87435060e6c9f4b918cef49230d2bb6c9.tar.gz
chromium_src-6d4b3fc87435060e6c9f4b918cef49230d2bb6c9.tar.bz2
Change the default cookie policy to be closer to the default in WebKit's DumpRenderTree.
Add a method to the layout test controller to allow changing the cookie policy. BUG=20356 TEST=http/tests/xmlhttprequest/cross-origin-cookie-storage.html Review URL: http://codereview.chromium.org/192004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/tools/layout_tests/test_expectations.txt3
-rw-r--r--webkit/tools/test_shell/layout_test_controller.cc15
-rw-r--r--webkit/tools/test_shell/layout_test_controller.h3
-rw-r--r--webkit/tools/test_shell/simple_resource_loader_bridge.cc13
-rw-r--r--webkit/tools/test_shell/simple_resource_loader_bridge.h1
5 files changed, 30 insertions, 5 deletions
diff --git a/webkit/tools/layout_tests/test_expectations.txt b/webkit/tools/layout_tests/test_expectations.txt
index 5e7999b..c957c39 100644
--- a/webkit/tools/layout_tests/test_expectations.txt
+++ b/webkit/tools/layout_tests/test_expectations.txt
@@ -2294,9 +2294,6 @@ BUG20265 LINUX : LayoutTests/platform/mac/accessibility/slider-supports-actions.
// WebKit 47777:47790 - getOwnPropertyDescriptor
BUG20345 : LayoutTests/fast/js/getOwnPropertyDescriptor.html = FAIL
-// Webkit 47790:47797
-BUG20356 : LayoutTests/http/tests/xmlhttprequest/cross-origin-cookie-storage.html = TIMEOUT
-
// WebKit 47797:47804
BUG20376 WIN : LayoutTests/media/audio-play-event.html = TIMEOUT
// Was marked as flakey above (I commented it out).
diff --git a/webkit/tools/test_shell/layout_test_controller.cc b/webkit/tools/test_shell/layout_test_controller.cc
index d226575..c2c2bcc 100644
--- a/webkit/tools/test_shell/layout_test_controller.cc
+++ b/webkit/tools/test_shell/layout_test_controller.cc
@@ -21,6 +21,7 @@
#include "webkit/glue/dom_operations.h"
#include "webkit/glue/webpreferences.h"
#include "webkit/glue/webview.h"
+#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/tools/test_shell/test_navigation_controller.h"
#include "webkit/tools/test_shell/test_shell.h"
@@ -99,6 +100,7 @@ LayoutTestController::LayoutTestController(TestShell* shell) {
BindMethod("setCanOpenWindows", &LayoutTestController::setCanOpenWindows);
BindMethod("setCloseRemainingWindowsWhenComplete", &LayoutTestController::setCloseRemainingWindowsWhenComplete);
BindMethod("objCIdentityIsEqual", &LayoutTestController::objCIdentityIsEqual);
+ BindMethod("setAlwaysAcceptCookies", &LayoutTestController::setAlwaysAcceptCookies);
BindMethod("setWindowIsKey", &LayoutTestController::setWindowIsKey);
BindMethod("setTabKeyCyclesThroughElements", &LayoutTestController::setTabKeyCyclesThroughElements);
BindMethod("setUserStyleSheetLocation", &LayoutTestController::setUserStyleSheetLocation);
@@ -428,6 +430,7 @@ void LayoutTestController::Reset() {
globalFlag_.Set(false);
webHistoryItemCount_.Set(0);
+ SimpleResourceLoaderBridge::SetAcceptAllCookies(false);
WebKit::resetOriginAccessWhiteLists();
if (close_remaining_windows_) {
@@ -499,6 +502,14 @@ void LayoutTestController::setCloseRemainingWindowsWhenComplete(
result->SetNull();
}
+void LayoutTestController::setAlwaysAcceptCookies(
+ const CppArgumentList& args, CppVariant* result) {
+ if (args.size() > 0) {
+ SimpleResourceLoaderBridge::SetAcceptAllCookies(CppVariantToBool(args[0]));
+ }
+ result->SetNull();
+}
+
void LayoutTestController::setWindowIsKey(
const CppArgumentList& args, CppVariant* result) {
if (args.size() > 0 && args[0].isBool()) {
@@ -812,7 +823,7 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(
result->SetNull();
}
-// Need these conversions because the format of the value for overridePreference
+// 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) {
if (value.isBool())
@@ -827,7 +838,7 @@ bool LayoutTestController::CppVariantToBool(const CppVariant& value) {
return false;
}
shell_->delegate()->AddMessageToConsole(shell_->webView(),
- L"Invalid value for preference. Expected boolean value.", 0, L"");
+ L"Invalid value. Expected boolean value.", 0, L"");
return false;
}
diff --git a/webkit/tools/test_shell/layout_test_controller.h b/webkit/tools/test_shell/layout_test_controller.h
index 47cda91..af0313c 100644
--- a/webkit/tools/test_shell/layout_test_controller.h
+++ b/webkit/tools/test_shell/layout_test_controller.h
@@ -88,6 +88,9 @@ class LayoutTestController : public CppBoundClass {
// the identity of its two arguments in C++.
void objCIdentityIsEqual(const CppArgumentList& args, CppVariant* result);
+ // Changes the cookie policy from the default to allow all cookies.
+ void setAlwaysAcceptCookies(const CppArgumentList& args, CppVariant* result);
+
// Gives focus to the window.
void setWindowIsKey(const CppArgumentList& args, CppVariant* result);
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
index 46126a0..98378bb 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc
@@ -38,6 +38,7 @@
#include "base/timer.h"
#include "base/thread.h"
#include "base/waitable_event.h"
+#include "net/base/cookie_policy.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -52,6 +53,7 @@
#include "webkit/tools/test_shell/test_shell_request_context.h"
using webkit_glue::ResourceLoaderBridge;
+using net::CookiePolicy;
using net::HttpResponseHeaders;
namespace {
@@ -653,6 +655,7 @@ void SimpleResourceLoaderBridge::Init(URLRequestContext* context) {
request_context = new TestShellRequestContext();
}
request_context->AddRef();
+ SimpleResourceLoaderBridge::SetAcceptAllCookies(false);
}
// static
@@ -665,6 +668,7 @@ void SimpleResourceLoaderBridge::Shutdown() {
}
}
+// static
void SimpleResourceLoaderBridge::SetCookie(const GURL& url,
const GURL& first_party_for_cookies,
const std::string& cookie) {
@@ -680,6 +684,7 @@ void SimpleResourceLoaderBridge::SetCookie(const GURL& url,
cookie_setter.get(), &CookieSetter::Set, url, cookie));
}
+// static
std::string SimpleResourceLoaderBridge::GetCookies(
const GURL& url, const GURL& first_party_for_cookies) {
// Proxy to IO thread to synchronize w/ network loading
@@ -697,6 +702,7 @@ std::string SimpleResourceLoaderBridge::GetCookies(
return getter->GetResult();
}
+// static
bool SimpleResourceLoaderBridge::EnsureIOThread() {
if (io_thread)
return true;
@@ -709,3 +715,10 @@ bool SimpleResourceLoaderBridge::EnsureIOThread() {
options.message_loop_type = MessageLoop::TYPE_IO;
return io_thread->StartWithOptions(options);
}
+
+// static
+void SimpleResourceLoaderBridge::SetAcceptAllCookies(bool accept_all_cookies) {
+ CookiePolicy::Type policy_type = accept_all_cookies ?
+ CookiePolicy::ALLOW_ALL_COOKIES : CookiePolicy::BLOCK_THIRD_PARTY_COOKIES;
+ request_context->cookie_policy()->set_type(policy_type);
+}
diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.h b/webkit/tools/test_shell/simple_resource_loader_bridge.h
index 460071b..7c5979b 100644
--- a/webkit/tools/test_shell/simple_resource_loader_bridge.h
+++ b/webkit/tools/test_shell/simple_resource_loader_bridge.h
@@ -34,6 +34,7 @@ class SimpleResourceLoaderBridge {
static std::string GetCookies(const GURL& url,
const GURL& first_party_for_cookies);
static bool EnsureIOThread();
+ static void SetAcceptAllCookies(bool accept_all_cookies);
};
#endif // WEBKIT_TOOLS_TEST_SHELL_SIMPLE_RESOURCE_LOADER_BRIDGE_H__