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

Unified Diff: components/cronet/ios/test/cronet_http_test.mm

Issue 2671713006: [Cronet] Don't spam log if system cookie doesn't have creation time. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/cronet/ios/test/cronet_http_test.mm
diff --git a/components/cronet/ios/test/cronet_http_test.mm b/components/cronet/ios/test/cronet_http_test.mm
index e1b1e723037b8b80b1fdf72b94b055ba14bc1c03..0916f4c5f832e10afc2c613d29f2b709ffd5d201 100644
--- a/components/cronet/ios/test/cronet_http_test.mm
+++ b/components/cronet/ios/test/cronet_http_test.mm
@@ -322,6 +322,39 @@ TEST_F(HttpTest, SetSystemCookie) {
EXPECT_TRUE([[delegate_ responseBody] containsString:cookieValue]);
}
+TEST_F(HttpTest, SystemCookieWithNullCreationTime) {
+ const char kCookieHeader[] = "Cookie";
+ NSString* cookieName = [NSString
+ stringWithFormat:@"SetSystemCookie-%@", [[NSUUID UUID] UUIDString]];
+ NSString* cookieValue = [[NSUUID UUID] UUIDString];
+ NSHTTPCookieStorage* systemCookieStorage =
+ [NSHTTPCookieStorage sharedHTTPCookieStorage];
+ NSURL* echoCookieUrl =
+ net::NSURLWithGURL(GURL(TestServer::GetEchoHeaderURL(kCookieHeader)));
+ NSHTTPCookie* nullCreationTimeCookie = [NSHTTPCookie cookieWithProperties:@{
+ NSHTTPCookiePath : [echoCookieUrl path],
+ NSHTTPCookieName : cookieName,
+ NSHTTPCookieValue : cookieValue,
+ NSHTTPCookieDomain : [echoCookieUrl host],
+ @"Created" : [NSNumber numberWithDouble:0.0],
+ }];
+ [systemCookieStorage setCookie:nullCreationTimeCookie];
+ NSHTTPCookie* normalCookie = [NSHTTPCookie cookieWithProperties:@{
+ NSHTTPCookiePath : [echoCookieUrl path],
+ NSHTTPCookieName : [cookieName stringByAppendingString:@"-normal"],
+ NSHTTPCookieValue : cookieValue,
+ NSHTTPCookieDomain : [echoCookieUrl host],
+ }];
+ [systemCookieStorage setCookie:normalCookie];
+ StartDataTaskAndWaitForCompletion([session_ dataTaskWithURL:echoCookieUrl]);
+ [systemCookieStorage deleteCookie:nullCreationTimeCookie];
+ [systemCookieStorage deleteCookie:normalCookie];
+ EXPECT_EQ(nil, [delegate_ error]);
+ // Verify that cookie set in system store was sent to the serever.
+ EXPECT_TRUE([[delegate_ responseBody] containsString:cookieName]);
+ EXPECT_TRUE([[delegate_ responseBody] containsString:cookieValue]);
+}
+
TEST_F(HttpTest, FilterOutRequest) {
NSURL* url =
net::NSURLWithGURL(GURL(TestServer::GetEchoHeaderURL("User-Agent")));
« no previous file with comments | « no previous file | ios/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698