Chromium Code Reviews| 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( |
|
mmenke
2016/07/21 15:34:57
To keep old behavior, add "GURL("http://domain/")"
tfarina
2016/07/21 19:05:41
Done.
| |
| 264 "path/", | 264 "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", std::string(), "path/", |
| 265 base::Time(), // creation | 265 base::Time(), // creation |
| 266 base::Time(), // expires | 266 base::Time(), // expires |
| 267 base::Time(), // last_access | 267 base::Time(), // last_access |
| 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, net::COOKIE_PRIORITY_DEFAULT)); |
| 271 cookies.push_back(bad_canonical_cookie); | 271 cookies.push_back(bad_canonical_cookie.release()); |
| 272 loaded_callback_.Run(cookies); | 272 loaded_callback_.Run(cookies); |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool flushed() { return flushed_; } | 275 bool flushed() { return flushed_; } |
| 276 | 276 |
| 277 private: | 277 private: |
| 278 // net::CookieMonster::PersistentCookieStore implementation: | 278 // net::CookieMonster::PersistentCookieStore implementation: |
| 279 void Load(const LoadedCallback& loaded_callback) override { | 279 void Load(const LoadedCallback& loaded_callback) override { |
| 280 loaded_callback_ = loaded_callback; | 280 loaded_callback_ = loaded_callback; |
| 281 } | 281 } |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 992 EXPECT_EQ(2U, cookies.size()); | 992 EXPECT_EQ(2U, cookies.size()); |
| 993 // this deletes the callback | 993 // this deletes the callback |
| 994 handle.reset(); | 994 handle.reset(); |
| 995 SetSystemCookie(kTestCookieURL, "abc", "jkl"); | 995 SetSystemCookie(kTestCookieURL, "abc", "jkl"); |
| 996 EXPECT_EQ(2U, cookies.size()); | 996 EXPECT_EQ(2U, cookies.size()); |
| 997 DeleteSystemCookie(kTestCookieURL, "abc"); | 997 DeleteSystemCookie(kTestCookieURL, "abc"); |
| 998 store_->UnSynchronize(); | 998 store_->UnSynchronize(); |
| 999 } | 999 } |
| 1000 | 1000 |
| 1001 } // namespace net | 1001 } // namespace net |
| OLD | NEW |