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

Unified Diff: util/net/http_transport_test.cc

Issue 1304433004: HTTPTransportMac: CFStream Read() must always set at_eof (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 4 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 | « util/net/http_transport_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/net/http_transport_test.cc
diff --git a/util/net/http_transport_test.cc b/util/net/http_transport_test.cc
index dc3775b11fd66812343205fd9ec803579fd7d5ae..98c51e315eca4ef3b54d56affac0befde2141ede 100644
--- a/util/net/http_transport_test.cc
+++ b/util/net/http_transport_test.cc
@@ -278,6 +278,26 @@ TEST(HTTPTransport, UnchunkedPlainText) {
test.Run();
}
+TEST(HTTPTransport, Upload33k) {
+ // NSMutableURLRequest winds up calling into a CFReadStream’s Read() callback
+ // with a 32kB buffer. Make sure that it’s able to get everything when enough
+ // is available to fill this buffer, requiring more than one Read().
+
+ std::string request_string(33 * 1024, 'a');
+ scoped_ptr<HTTPBodyStream> body_stream(
+ new StringHTTPBodyStream(request_string));
+
+ HTTPHeaders headers;
+ headers[kContentType] = "application/octet-stream";
+ headers[kContentLength] = base::StringPrintf("%zu", request_string.size());
Robert Sesek 2015/08/18 19:35:07 PRIuS instead of %zu.
+ HTTPTransportTestFixture test(headers, body_stream.Pass(), 200,
+ [](HTTPTransportTestFixture* fixture, const std::string& request) {
+ size_t body_start = request.rfind("\r\n");
+ EXPECT_EQ(33 * 1024u + 2, request.size() - body_start);
+ });
+ test.Run();
+}
+
} // namespace
} // namespace test
} // namespace crashpad
« no previous file with comments | « util/net/http_transport_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698