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

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

Issue 2159373002: net: make CanonicalCookie's constructor private (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: domain Created 4 years, 5 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
« no previous file with comments | « ios/net/cookies/cookie_cache_unittest.cc ('k') | ios/net/cookies/system_cookie_util.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(GURL("http://domain/"), "name",
264 "path/", 264 "\x81r\xe4\xbd\xa0\xe5\xa5\xbd",
265 base::Time(), // creation 265 std::string(), "/path/",
266 base::Time(), // expires 266 base::Time(), // creation
267 base::Time(), // last_access 267 base::Time(), // expires
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, false,
271 cookies.push_back(bad_canonical_cookie); 271 net::COOKIE_PRIORITY_DEFAULT));
272 cookies.push_back(bad_canonical_cookie.release());
272 loaded_callback_.Run(cookies); 273 loaded_callback_.Run(cookies);
273 } 274 }
274 275
275 bool flushed() { return flushed_; } 276 bool flushed() { return flushed_; }
276 277
277 private: 278 private:
278 // net::CookieMonster::PersistentCookieStore implementation: 279 // net::CookieMonster::PersistentCookieStore implementation:
279 void Load(const LoadedCallback& loaded_callback) override { 280 void Load(const LoadedCallback& loaded_callback) override {
280 loaded_callback_ = loaded_callback; 281 loaded_callback_ = loaded_callback;
281 } 282 }
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
992 EXPECT_EQ(2U, cookies.size()); 993 EXPECT_EQ(2U, cookies.size());
993 // this deletes the callback 994 // this deletes the callback
994 handle.reset(); 995 handle.reset();
995 SetSystemCookie(kTestCookieURL, "abc", "jkl"); 996 SetSystemCookie(kTestCookieURL, "abc", "jkl");
996 EXPECT_EQ(2U, cookies.size()); 997 EXPECT_EQ(2U, cookies.size());
997 DeleteSystemCookie(kTestCookieURL, "abc"); 998 DeleteSystemCookie(kTestCookieURL, "abc");
998 store_->UnSynchronize(); 999 store_->UnSynchronize();
999 } 1000 }
1000 1001
1001 } // namespace net 1002 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_cache_unittest.cc ('k') | ios/net/cookies/system_cookie_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698