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 "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 : public net::CookieMonster::PersistentCookieStore { | 201 : public net::CookieMonster::PersistentCookieStore { |
202 public: | 202 public: |
203 TestPersistentCookieStore() | 203 TestPersistentCookieStore() |
204 : kTestCookieURL("http://foo.google.com/bar"), flushed_(false) {} | 204 : kTestCookieURL("http://foo.google.com/bar"), flushed_(false) {} |
205 | 205 |
206 // Runs the completion callback with a "a=b" cookie. | 206 // Runs the completion callback with a "a=b" cookie. |
207 void RunLoadedCallback() { | 207 void RunLoadedCallback() { |
208 std::vector<net::CanonicalCookie*> cookies; | 208 std::vector<net::CanonicalCookie*> cookies; |
209 net::CookieOptions options; | 209 net::CookieOptions options; |
210 options.set_include_httponly(); | 210 options.set_include_httponly(); |
211 cookies.push_back(net::CanonicalCookie::Create(kTestCookieURL, "a=b", | 211 |
212 base::Time::Now(), options)); | 212 scoped_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( |
| 213 kTestCookieURL, "a=b", base::Time::Now(), options)); |
| 214 cookies.push_back(cookie.release()); |
| 215 |
213 // Some canonical cookies cannot be converted into System cookies, for | 216 // Some canonical cookies cannot be converted into System cookies, for |
214 // example if value is not valid utf8. Such cookies are ignored. | 217 // example if value is not valid utf8. Such cookies are ignored. |
215 net::CanonicalCookie* bad_canonical_cookie = new net::CanonicalCookie( | 218 net::CanonicalCookie* bad_canonical_cookie = new net::CanonicalCookie( |
216 kTestCookieURL, "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", | 219 kTestCookieURL, "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", |
217 "path/", | 220 "path/", |
218 base::Time(), // creation | 221 base::Time(), // creation |
219 base::Time(), // expires | 222 base::Time(), // expires |
220 base::Time(), // last_access | 223 base::Time(), // last_access |
221 false, // secure | 224 false, // secure |
222 false, // httponly | 225 false, // httponly |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 EXPECT_EQ(2U, cookies.size()); | 949 EXPECT_EQ(2U, cookies.size()); |
947 // this deletes the callback | 950 // this deletes the callback |
948 handle.reset(); | 951 handle.reset(); |
949 SetSystemCookie(kTestCookieURL, "abc", "jkl"); | 952 SetSystemCookie(kTestCookieURL, "abc", "jkl"); |
950 EXPECT_EQ(2U, cookies.size()); | 953 EXPECT_EQ(2U, cookies.size()); |
951 DeleteSystemCookie(kTestCookieURL, "abc"); | 954 DeleteSystemCookie(kTestCookieURL, "abc"); |
952 store_->UnSynchronize(); | 955 store_->UnSynchronize(); |
953 } | 956 } |
954 | 957 |
955 } // namespace net | 958 } // namespace net |
OLD | NEW |