ReEnable CookieStore unittests
Use off the record browserstate in the test to force using of non-persistent
cookie store
Bug: 956477
Change-Id: I70432fa2e5c4133e19d51267314972bb7bb67729
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585066
Reviewed-by: Eugene But <eugenebut@chromium.org>
Commit-Queue: Mohammad Refaat <mrefaat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654327}
diff --git a/ios/net/cookies/system_cookie_store_unittest_template.h b/ios/net/cookies/system_cookie_store_unittest_template.h
index 5648c8b7..0c81ce1 100644
--- a/ios/net/cookies/system_cookie_store_unittest_template.h
+++ b/ios/net/cookies/system_cookie_store_unittest_template.h
@@ -154,8 +154,7 @@
TYPED_TEST_SUITE_P(SystemCookieStoreTest);
-// TODO(crbug.com/956477): Reenable the test.
-TYPED_TEST_P(SystemCookieStoreTest, DISABLED_SetCookieAsync) {
+TYPED_TEST_P(SystemCookieStoreTest, SetCookieAsync) {
NSHTTPCookie* system_cookie =
CreateCookie(@"a", @"b", this->test_cookie_url1_);
SystemCookieCallbackRunVerifier callback_verifier;
@@ -169,8 +168,7 @@
}
// Tests cases of GetAllCookiesAsync and GetCookiesForURLAsync.
-// TODO(crbug.com/956477): Reenable the test.
-TYPED_TEST_P(SystemCookieStoreTest, DISABLED_GetCookiesAsync) {
+TYPED_TEST_P(SystemCookieStoreTest, GetCookiesAsync) {
SystemCookieStore* cookie_store = this->GetCookieStore();
NSMutableDictionary* input_cookies = [[NSMutableDictionary alloc] init];
NSHTTPCookie* system_cookie =
@@ -217,8 +215,7 @@
// Tests deleting cookies for different URLs and for different
// cookie key/value pairs.
-// TODO(crbug.com/956477): Reenable the test.
-TYPED_TEST_P(SystemCookieStoreTest, DISABLED_DeleteCookiesAsync) {
+TYPED_TEST_P(SystemCookieStoreTest, DeleteCookiesAsync) {
SystemCookieStore* cookie_store = this->GetCookieStore();
NSHTTPCookie* system_cookie1 =
CreateCookie(@"a", @"b", this->test_cookie_url1_);
@@ -251,8 +248,7 @@
EXPECT_EQ(0, this->CookiesCount());
}
-// TODO(crbug.com/956477): Reenable the test.
-TYPED_TEST_P(SystemCookieStoreTest, DISABLED_ClearCookiesAsync) {
+TYPED_TEST_P(SystemCookieStoreTest, ClearCookiesAsync) {
SystemCookieStore* cookie_store = this->GetCookieStore();
SetCookieInStoreWithNoCallback(
CreateCookie(@"a", @"b", this->test_cookie_url1_), cookie_store);
@@ -268,8 +264,7 @@
EXPECT_EQ(0, this->CookiesCount());
}
-// TODO(crbug.com/956477): Reenable the test.
-TYPED_TEST_P(SystemCookieStoreTest, DISABLED_GetCookieAcceptPolicy) {
+TYPED_TEST_P(SystemCookieStoreTest, GetCookieAcceptPolicy) {
SystemCookieStore* cookie_store = this->GetCookieStore();
EXPECT_EQ([NSHTTPCookieStorage sharedHTTPCookieStorage].cookieAcceptPolicy,
cookie_store->GetCookieAcceptPolicy());
@@ -284,11 +279,11 @@
}
REGISTER_TYPED_TEST_SUITE_P(SystemCookieStoreTest,
- DISABLED_SetCookieAsync,
- DISABLED_GetCookiesAsync,
- DISABLED_DeleteCookiesAsync,
- DISABLED_ClearCookiesAsync,
- DISABLED_GetCookieAcceptPolicy);
+ SetCookieAsync,
+ GetCookiesAsync,
+ DeleteCookiesAsync,
+ ClearCookiesAsync,
+ GetCookieAcceptPolicy);
} // namespace net
diff --git a/ios/web/net/cookies/wk_http_system_cookie_store_unittest.mm b/ios/web/net/cookies/wk_http_system_cookie_store_unittest.mm
index 18437c8..ff07c25 100644
--- a/ios/web/net/cookies/wk_http_system_cookie_store_unittest.mm
+++ b/ios/web/net/cookies/wk_http_system_cookie_store_unittest.mm
@@ -28,6 +28,9 @@
class WKHTTPSystemCookieStoreTestDelegate {
public:
WKHTTPSystemCookieStoreTestDelegate() {
+ // Using off the record browser state so it will use non-persistent
+ // datastore.
+ browser_state_.SetOffTheRecord(true);
web::WKWebViewConfigurationProvider& config_provider =
web::WKWebViewConfigurationProvider::FromBrowserState(&browser_state_);
shared_store_ = config_provider.GetWebViewConfiguration()