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

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

Issue 2857733002: iOS Cronet: Put cap on the buffer size passed to onReadCompleted delegate (Closed)
Patch Set: DCHECK 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/net/crn_http_protocol_handler.mm » ('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 b83a8a1cac8bd6ac0ff316178afc9bc65f11e1da..bcdd28c841581e7f155e62dbcdc0bafaf8f72d67 100644
--- a/components/cronet/ios/test/cronet_http_test.mm
+++ b/components/cronet/ios/test/cronet_http_test.mm
@@ -33,11 +33,16 @@
// Error the request this delegate is attached to failed with, if any.
@property(retain, atomic) NSError* error;
+// Contains total amount of received data.
+@property(readonly) long totalBytesReceived;
+
@end
@implementation TestDelegate
+
@synthesize semaphore = _semaphore;
@synthesize error = _error;
+@synthesize totalBytesReceived = _totalBytesReceived;
NSMutableArray<NSData*>* _responseData;
@@ -59,6 +64,7 @@ NSMutableArray<NSData*>* _responseData;
[_responseData dealloc];
_responseData = nil;
_error = nil;
+ _totalBytesReceived = 0;
}
- (NSString*)responseBody {
@@ -106,6 +112,7 @@ NSMutableArray<NSData*>* _responseData;
- (void)URLSession:(NSURLSession*)session
dataTask:(NSURLSessionDataTask*)dataTask
didReceiveData:(NSData*)data {
+ _totalBytesReceived += [data length];
if (_responseData == nil) {
_responseData = [[NSMutableArray alloc] init];
}
@@ -225,6 +232,7 @@ TEST_F(HttpTest, NSURLSessionReceivesBigHttpDataLoop) {
elapsed_max = elapsed;
EXPECT_TRUE(block_used);
EXPECT_EQ(nil, [delegate_ error]);
+ EXPECT_EQ(size, [delegate_ totalBytesReceived]);
}
// Release the response buffer.
TestServer::ReleaseBigDataURL();
« no previous file with comments | « no previous file | ios/net/crn_http_protocol_handler.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698