| 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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 // Wait until the flush is posted. | 398 // Wait until the flush is posted. |
| 399 base::RunLoop().RunUntilIdle(); | 399 base::RunLoop().RunUntilIdle(); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void SetSystemCookie(const GURL& url, | 402 void SetSystemCookie(const GURL& url, |
| 403 const std::string& name, | 403 const std::string& name, |
| 404 const std::string& value) { | 404 const std::string& value) { |
| 405 NSHTTPCookieStorage* storage = | 405 NSHTTPCookieStorage* storage = |
| 406 [NSHTTPCookieStorage sharedHTTPCookieStorage]; | 406 [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
| 407 [storage setCookie:[NSHTTPCookie cookieWithProperties:@{ | 407 [storage setCookie:[NSHTTPCookie cookieWithProperties:@{ |
| 408 NSHTTPCookiePath : base::SysUTF8ToNSString(url.path()), | 408 NSHTTPCookiePath : base::SysUTF8ToNSString(url.path().as_string()), |
| 409 NSHTTPCookieName : base::SysUTF8ToNSString(name), | 409 NSHTTPCookieName : base::SysUTF8ToNSString(name), |
| 410 NSHTTPCookieValue : base::SysUTF8ToNSString(value), | 410 NSHTTPCookieValue : base::SysUTF8ToNSString(value), |
| 411 NSHTTPCookieDomain : base::SysUTF8ToNSString(url.host()), | 411 NSHTTPCookieDomain : base::SysUTF8ToNSString(url.host()), |
| 412 }]]; | 412 }]]; |
| 413 net::CookieStoreIOS::NotifySystemCookiesChanged(); | 413 net::CookieStoreIOS::NotifySystemCookiesChanged(); |
| 414 base::RunLoop().RunUntilIdle(); | 414 base::RunLoop().RunUntilIdle(); |
| 415 } | 415 } |
| 416 | 416 |
| 417 void DeleteSystemCookie(const GURL& gurl, const std::string& name) { | 417 void DeleteSystemCookie(const GURL& gurl, const std::string& name) { |
| 418 NSHTTPCookieStorage* storage = | 418 NSHTTPCookieStorage* storage = |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 EXPECT_EQ(2U, cookies.size()); | 993 EXPECT_EQ(2U, cookies.size()); |
| 994 // this deletes the callback | 994 // this deletes the callback |
| 995 handle.reset(); | 995 handle.reset(); |
| 996 SetSystemCookie(kTestCookieURL, "abc", "jkl"); | 996 SetSystemCookie(kTestCookieURL, "abc", "jkl"); |
| 997 EXPECT_EQ(2U, cookies.size()); | 997 EXPECT_EQ(2U, cookies.size()); |
| 998 DeleteSystemCookie(kTestCookieURL, "abc"); | 998 DeleteSystemCookie(kTestCookieURL, "abc"); |
| 999 store_->UnSynchronize(); | 999 store_->UnSynchronize(); |
| 1000 } | 1000 } |
| 1001 | 1001 |
| 1002 } // namespace net | 1002 } // namespace net |
| OLD | NEW |