Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: ios/net/cookies/cookie_store_ios_unittest.mm

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)
Patch Set: Finish Merge Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 store_(base::MakeUnique<net::CookieStoreIOS>( 89 store_(base::MakeUnique<net::CookieStoreIOS>(
90 [NSHTTPCookieStorage sharedHTTPCookieStorage])) { 90 [NSHTTPCookieStorage sharedHTTPCookieStorage])) {
91 cookie_changed_callback_ = store_->AddCallbackForCookie( 91 cookie_changed_callback_ = store_->AddCallbackForCookie(
92 kTestCookieURL, "abc", 92 kTestCookieURL, "abc",
93 base::Bind(&RecordCookieChanges, &cookies_changed_, &cookies_removed_)); 93 base::Bind(&RecordCookieChanges, &cookies_changed_, &cookies_removed_));
94 } 94 }
95 95
96 ~CookieStoreIOSTest() override {} 96 ~CookieStoreIOSTest() override {}
97 97
98 // Gets the cookies. |callback| will be called on completion. 98 // Gets the cookies. |callback| will be called on completion.
99 void GetCookies(const net::CookieStore::GetCookiesCallback& callback) { 99 void GetCookies(net::CookieStore::GetCookiesCallback callback) {
100 net::CookieOptions options; 100 net::CookieOptions options;
101 options.set_include_httponly(); 101 options.set_include_httponly();
102 store_->GetCookiesWithOptionsAsync(kTestCookieURL, options, callback); 102 store_->GetCookiesWithOptionsAsync(kTestCookieURL, options,
103 std::move(callback));
103 } 104 }
104 105
105 // Sets a cookie. 106 // Sets a cookie.
106 void SetCookie(const std::string& cookie_line) { 107 void SetCookie(const std::string& cookie_line) {
107 net::SetCookie(cookie_line, kTestCookieURL, store_.get()); 108 net::SetCookie(cookie_line, kTestCookieURL, store_.get());
108 } 109 }
109 110
110 void SetSystemCookie(const GURL& url, 111 void SetSystemCookie(const GURL& url,
111 const std::string& name, 112 const std::string& name,
112 const std::string& value) { 113 const std::string& value) {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 SetSystemCookie(kTestCookieURL, "abc", "ghi"); 405 SetSystemCookie(kTestCookieURL, "abc", "ghi");
405 EXPECT_EQ(2U, cookies.size()); 406 EXPECT_EQ(2U, cookies.size());
406 // this deletes the callback 407 // this deletes the callback
407 handle.reset(); 408 handle.reset();
408 SetSystemCookie(kTestCookieURL, "abc", "jkl"); 409 SetSystemCookie(kTestCookieURL, "abc", "jkl");
409 EXPECT_EQ(2U, cookies.size()); 410 EXPECT_EQ(2U, cookies.size());
410 DeleteSystemCookie(kTestCookieURL, "abc"); 411 DeleteSystemCookie(kTestCookieURL, "abc");
411 } 412 }
412 413
413 } // namespace net 414 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698