Chromium Code Reviews| 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 21d0419e6c3ef5ffec62cc19b248071bc4d45db5..8624bcd7e7dd6152a701bf19b32051854f5858af 100644 |
| --- a/components/cronet/ios/test/cronet_http_test.mm |
| +++ b/components/cronet/ios/test/cronet_http_test.mm |
| @@ -258,6 +258,16 @@ TEST_F(HttpTest, SetUserAgentIsExact) { |
| TEST_F(HttpTest, SetCookie) { |
| const char kCookieHeader[] = "Cookie"; |
| const char kCookieLine[] = "aaaa=bbb"; |
| + NSHTTPCookieStorage* systemCookieStorage = |
| + [NSHTTPCookieStorage sharedHTTPCookieStorage]; |
| + NSURL* cookieUrl = |
| + [NSURL URLWithString:base::SysUTF8ToNSString( |
| + TestServer::GetEchoHeaderURL(kCookieHeader))]; |
| + // Verify that cookie is not set in system storage. |
| + for (NSHTTPCookie* cookie in [systemCookieStorage cookiesForURL:cookieUrl]) { |
| + EXPECT_FALSE([[cookie name] containsString:@"aaaa"]); |
|
kapishnikov
2017/01/06 15:24:45
Since 'isEqual' (or better 'isEqualToString') is u
mef
2017/01/06 15:52:55
Done.
|
| + } |
| + |
| NSURL* echoCookieUrl = |
| net::NSURLWithGURL(GURL(TestServer::GetEchoHeaderURL(kCookieHeader))); |
| StartDataTaskAndWaitForCompletion([session_ dataTaskWithURL:echoCookieUrl]); |
| @@ -275,6 +285,17 @@ TEST_F(HttpTest, SetCookie) { |
| EXPECT_EQ(nil, [delegate_ error]); |
| EXPECT_TRUE([[delegate_ responseBody] |
| containsString:base::SysUTF8ToNSString(kCookieLine)]); |
| + |
| + // Verify that cookie is set in system storage. |
| + NSHTTPCookie* systemCookie = nil; |
| + for (NSHTTPCookie* cookie in [systemCookieStorage cookiesForURL:cookieUrl]) { |
| + if ([cookie.name isEqual:@"aaaa"]) { |
|
kapishnikov
2017/01/06 15:24:45
isEqualToString should be a little faster.
mef
2017/01/06 15:52:55
Done.
|
| + systemCookie = cookie; |
| + break; |
| + } |
| + } |
| + EXPECT_TRUE([[systemCookie value] containsString:@"bbb"]); |
|
kapishnikov
2017/01/06 15:24:45
Why don't use isEqualToString instead of containsS
mef
2017/01/06 15:52:55
Done.
|
| + [systemCookieStorage deleteCookie:systemCookie]; |
| } |
| TEST_F(HttpTest, FilterOutRequest) { |