Index: ppapi/tests/test_url_loader.cc |
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc |
index bcbef506082366cc41e5a052639c6e65992c3799..d28b347b34958f698f3e25928a9ad48aa4e1b285 100644 |
--- a/ppapi/tests/test_url_loader.cc |
+++ b/ppapi/tests/test_url_loader.cc |
@@ -79,7 +79,7 @@ void TestURLLoader::RunTest() { |
RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST); |
RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST); |
RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader); |
- RUN_TEST_FORCEASYNC_AND_NOT(IgnoresBogusContentLength); |
+ RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength); |
RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction); |
RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction); |
RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest); |
@@ -310,14 +310,25 @@ std::string TestURLLoader::TestCustomRequestHeader() { |
return LoadAndCompareBody(request, "1"); |
} |
-std::string TestURLLoader::TestIgnoresBogusContentLength() { |
+std::string TestURLLoader::TestFailsBogusContentLength() { |
pp::URLRequestInfo request(instance_); |
request.SetURL("/echo"); |
request.SetMethod("POST"); |
request.SetHeaders("Content-Length: 400"); |
std::string postdata("postdata"); |
request.AppendDataToBody(postdata.data(), postdata.length()); |
- return LoadAndCompareBody(request, postdata); |
+ |
+ TestCompletionCallback callback(instance_->pp_instance(), force_async_); |
+ pp::URLLoader loader(*instance_); |
+ int32_t rv = loader.Open(request, callback); |
+ if (force_async_ && rv != PP_OK_COMPLETIONPENDING) |
+ return ReportError("URLLoader::Open force_async", rv); |
+ if (rv == PP_OK_COMPLETIONPENDING) |
+ rv = callback.WaitForResult(); |
+ |
+ // The bad header should have made the request fail. |
+ ASSERT_TRUE(rv == PP_ERROR_FAILED); |
+ PASS(); |
} |
std::string TestURLLoader::TestStreamToFile() { |