OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_test_util.h" | 5 #include "ios/net/cookies/cookie_store_ios_test_util.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #import "ios/net/cookies/cookie_store_ios.h" | 10 #import "ios/net/cookies/cookie_store_ios.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 std::vector<std::unique_ptr<net::CanonicalCookie>> cookies; | 35 std::vector<std::unique_ptr<net::CanonicalCookie>> cookies; |
36 net::CookieOptions options; | 36 net::CookieOptions options; |
37 options.set_include_httponly(); | 37 options.set_include_httponly(); |
38 | 38 |
39 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( | 39 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( |
40 kTestCookieURL, "a=b", base::Time::Now(), options)); | 40 kTestCookieURL, "a=b", base::Time::Now(), options)); |
41 cookies.push_back(std::move(cookie)); | 41 cookies.push_back(std::move(cookie)); |
42 | 42 |
43 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie( | 43 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie( |
44 net::CanonicalCookie::Create( | 44 net::CanonicalCookie::Create( |
45 GURL("http://domain/"), "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", | 45 "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", "/path/", |
46 std::string(), "/path/", | |
47 base::Time(), // creation | 46 base::Time(), // creation |
48 base::Time(), // expires | 47 base::Time(), // expires |
| 48 base::Time(), // last accessed |
49 false, // secure | 49 false, // secure |
50 false, // httponly | 50 false, // httponly |
51 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); | 51 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); |
52 cookies.push_back(std::move(bad_canonical_cookie)); | 52 cookies.push_back(std::move(bad_canonical_cookie)); |
53 loaded_callback_.Run(std::move(cookies)); | 53 loaded_callback_.Run(std::move(cookies)); |
54 } | 54 } |
55 | 55 |
56 bool TestPersistentCookieStore::flushed() { | 56 bool TestPersistentCookieStore::flushed() { |
57 return flushed_; | 57 return flushed_; |
58 } | 58 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void ClearCookies() { | 132 void ClearCookies() { |
133 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; | 133 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
134 [store setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; | 134 [store setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; |
135 NSArray* cookies = [store cookies]; | 135 NSArray* cookies = [store cookies]; |
136 for (NSHTTPCookie* cookie in cookies) | 136 for (NSHTTPCookie* cookie in cookies) |
137 [store deleteCookie:cookie]; | 137 [store deleteCookie:cookie]; |
138 EXPECT_EQ(0u, [[store cookies] count]); | 138 EXPECT_EQ(0u, [[store cookies] count]); |
139 } | 139 } |
140 | 140 |
141 } // namespace net | 141 } // namespace net |
OLD | NEW |