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

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

Issue 2874843002: Shifted creation of unvalidated CanonicalCookies over to a constructor. (Closed)
Patch Set: Merged to top of dependent CL. Created 3 years, 7 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_store_ios.mm ('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 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/memory/ptr_util.h"
9 #include "base/run_loop.h" 10 #include "base/run_loop.h"
10 #import "ios/net/cookies/cookie_store_ios.h" 11 #import "ios/net/cookies/cookie_store_ios.h"
11 #include "net/cookies/canonical_cookie.h" 12 #include "net/cookies/canonical_cookie.h"
12 #include "net/cookies/cookie_options.h" 13 #include "net/cookies/cookie_options.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 namespace { 18 namespace {
18 19
(...skipping 15 matching lines...) Expand all
34 void TestPersistentCookieStore::RunLoadedCallback() { 35 void TestPersistentCookieStore::RunLoadedCallback() {
35 std::vector<std::unique_ptr<net::CanonicalCookie>> cookies; 36 std::vector<std::unique_ptr<net::CanonicalCookie>> cookies;
36 net::CookieOptions options; 37 net::CookieOptions options;
37 options.set_include_httponly(); 38 options.set_include_httponly();
38 39
39 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create( 40 std::unique_ptr<net::CanonicalCookie> cookie(net::CanonicalCookie::Create(
40 kTestCookieURL, "a=b", base::Time::Now(), options)); 41 kTestCookieURL, "a=b", base::Time::Now(), options));
41 cookies.push_back(std::move(cookie)); 42 cookies.push_back(std::move(cookie));
42 43
43 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie( 44 std::unique_ptr<net::CanonicalCookie> bad_canonical_cookie(
44 net::CanonicalCookie::Create( 45 base::MakeUnique<net::CanonicalCookie>(
45 "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", "/path/", 46 "name", "\x81r\xe4\xbd\xa0\xe5\xa5\xbd", "domain", "/path/",
46 base::Time(), // creation 47 base::Time(), // creation
47 base::Time(), // expires 48 base::Time(), // expires
48 base::Time(), // last accessed 49 base::Time(), // last accessed
49 false, // secure 50 false, // secure
50 false, // httponly 51 false, // httponly
51 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT)); 52 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
52 cookies.push_back(std::move(bad_canonical_cookie)); 53 cookies.push_back(std::move(bad_canonical_cookie));
53 loaded_callback_.Run(std::move(cookies)); 54 loaded_callback_.Run(std::move(cookies));
54 } 55 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 void ClearCookies() { 133 void ClearCookies() {
133 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage]; 134 NSHTTPCookieStorage* store = [NSHTTPCookieStorage sharedHTTPCookieStorage];
134 [store setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; 135 [store setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways];
135 NSArray* cookies = [store cookies]; 136 NSArray* cookies = [store cookies];
136 for (NSHTTPCookie* cookie in cookies) 137 for (NSHTTPCookie* cookie in cookies)
137 [store deleteCookie:cookie]; 138 [store deleteCookie:cookie];
138 EXPECT_EQ(0u, [[store cookies] count]); 139 EXPECT_EQ(0u, [[store cookies] count]);
139 } 140 }
140 141
141 } // namespace net 142 } // namespace net
OLDNEW
« no previous file with comments | « ios/net/cookies/cookie_store_ios.mm ('k') | ios/net/cookies/system_cookie_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698