| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 #include "ios/net/cookies/cookie_store_ios.h" | 5 #include "ios/net/cookies/cookie_store_ios.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 std::vector<net::CanonicalCookie*> cookies; | 252 std::vector<net::CanonicalCookie*> cookies; |
| 253 net::CookieOptions options; | 253 net::CookieOptions options; |
| 254 options.set_include_httponly(); | 254 options.set_include_httponly(); |
| 255 | 255 |
| 256 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( | 256 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( |
| 257 kTestCookieURL, "a=b", base::Time::Now(), options)); | 257 kTestCookieURL, "a=b", base::Time::Now(), options)); |
| 258 cookies.push_back(cookie.release()); | 258 cookies.push_back(cookie.release()); |
| 259 | 259 |
| 260 // Some canonical cookies cannot be converted into System cookies, for | 260 // Some canonical cookies cannot be converted into System cookies, for |
| 261 // example if value is not valid utf8. Such cookies are ignored. | 261 // example if value is not valid utf8. Such cookies are ignored. |
| 262 net::CanonicalCookie* bad_canonical_cookie = new net::CanonicalCookie( | 262 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie( |
| 263 kTestCookieURL, "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", | 263 net::CanonicalCookie::Create(kTestCookieURL, "name", |
| 264 "path/", | 264 "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", |
| 265 base::Time(), // creation | 265 std::string(), "path/", |
| 266 base::Time(), // expires | 266 base::Time(), // creation |
| 267 base::Time(), // last_access | 267 base::Time(), // expires |
| 268 false, // secure | 268 false, // secure |
| 269 false, // httponly | 269 false, // httponly |
| 270 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); | 270 net::CookieSameSite::DEFAULT_MODE, false, |
| 271 cookies.push_back(bad_canonical_cookie); | 271 net::COOKIE_PRIORITY_DEFAULT)); |
| 272 cookies.push_back(bad_canonical_cookie.release()); |
| 272 loaded_callback_.Run(cookies); | 273 loaded_callback_.Run(cookies); |
| 273 } | 274 } |
| 274 | 275 |
| 275 bool flushed() { return flushed_; } | 276 bool flushed() { return flushed_; } |
| 276 | 277 |
| 277 private: | 278 private: |
| 278 // net::CookieMonster::PersistentCookieStore implementation: | 279 // net::CookieMonster::PersistentCookieStore implementation: |
| 279 void Load(const LoadedCallback& loaded_callback) override { | 280 void Load(const LoadedCallback& loaded_callback) override { |
| 280 loaded_callback_ = loaded_callback; | 281 loaded_callback_ = loaded_callback; |
| 281 } | 282 } |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 EXPECT_EQ(2U, cookies.size()); | 993 EXPECT_EQ(2U, cookies.size()); |
| 993 // this deletes the callback | 994 // this deletes the callback |
| 994 handle.reset(); | 995 handle.reset(); |
| 995 SetSystemCookie(kTestCookieURL, "abc", "jkl"); | 996 SetSystemCookie(kTestCookieURL, "abc", "jkl"); |
| 996 EXPECT_EQ(2U, cookies.size()); | 997 EXPECT_EQ(2U, cookies.size()); |
| 997 DeleteSystemCookie(kTestCookieURL, "abc"); | 998 DeleteSystemCookie(kTestCookieURL, "abc"); |
| 998 store_->UnSynchronize(); | 999 store_->UnSynchronize(); |
| 999 } | 1000 } |
| 1000 | 1001 |
| 1001 } // namespace net | 1002 } // namespace net |
| OLD | NEW |