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

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

Issue 2103863003: Make CanonicalCookie::Source() private. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@source
Patch Set: Merge 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/system_cookie_util.h" 5 #include "ios/net/cookies/system_cookie_util.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/mac/scoped_nsobject.h" 9 #include "base/mac/scoped_nsobject.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 NSHTTPCookieDomain : @"foo", 67 NSHTTPCookieDomain : @"foo",
68 NSHTTPCookieName : @"a", 68 NSHTTPCookieName : @"a",
69 NSHTTPCookiePath : @"/", 69 NSHTTPCookiePath : @"/",
70 NSHTTPCookieValue : @"b", 70 NSHTTPCookieValue : @"b",
71 NSHTTPCookieExpires : system_expire_date, 71 NSHTTPCookieExpires : system_expire_date,
72 @"HttpOnly" : @YES, 72 @"HttpOnly" : @YES,
73 }]); 73 }]);
74 ASSERT_TRUE(system_cookie); 74 ASSERT_TRUE(system_cookie);
75 net::CanonicalCookie chrome_cookie = 75 net::CanonicalCookie chrome_cookie =
76 CanonicalCookieFromSystemCookie(system_cookie, creation_time); 76 CanonicalCookieFromSystemCookie(system_cookie, creation_time);
77 EXPECT_TRUE(chrome_cookie.Source().is_empty());
78 EXPECT_EQ("a", chrome_cookie.Name()); 77 EXPECT_EQ("a", chrome_cookie.Name());
79 EXPECT_EQ("b", chrome_cookie.Value()); 78 EXPECT_EQ("b", chrome_cookie.Value());
80 EXPECT_EQ("foo", chrome_cookie.Domain()); 79 EXPECT_EQ("foo", chrome_cookie.Domain());
81 EXPECT_EQ("/", chrome_cookie.Path()); 80 EXPECT_EQ("/", chrome_cookie.Path());
82 EXPECT_EQ(creation_time, chrome_cookie.CreationDate()); 81 EXPECT_EQ(creation_time, chrome_cookie.CreationDate());
83 EXPECT_TRUE(chrome_cookie.LastAccessDate().is_null()); 82 EXPECT_TRUE(chrome_cookie.LastAccessDate().is_null());
84 EXPECT_TRUE(chrome_cookie.IsPersistent()); 83 EXPECT_TRUE(chrome_cookie.IsPersistent());
85 // Allow 1 second difference as iOS rounds expiry time to the nearest second. 84 // Allow 1 second difference as iOS rounds expiry time to the nearest second.
86 EXPECT_LE(expire_date - base::TimeDelta::FromSeconds(1), 85 EXPECT_LE(expire_date - base::TimeDelta::FromSeconds(1),
87 chrome_cookie.ExpiryDate()); 86 chrome_cookie.ExpiryDate());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 false, // secure 124 false, // secure
126 false, // httponly 125 false, // httponly
127 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT); 126 net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT);
128 // Convert it to system cookie. 127 // Convert it to system cookie.
129 base::scoped_nsobject<NSHTTPCookie> system_cookie( 128 base::scoped_nsobject<NSHTTPCookie> system_cookie(
130 [SystemCookieFromCanonicalCookie(bad_canonical_cookie) retain]); 129 [SystemCookieFromCanonicalCookie(bad_canonical_cookie) retain]);
131 EXPECT_TRUE(system_cookie == nil); 130 EXPECT_TRUE(system_cookie == nil);
132 } 131 }
133 132
134 } // namespace net 133 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/profile_auth_data_unittest.cc ('k') | net/cookies/canonical_cookie.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698