summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_url_loader.cc17
-rw-r--r--ppapi/tests/test_url_loader.h2
2 files changed, 15 insertions, 4 deletions
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index bcbef50..d28b347 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() {
diff --git a/ppapi/tests/test_url_loader.h b/ppapi/tests/test_url_loader.h
index f88813e..18817ed 100644
--- a/ppapi/tests/test_url_loader.h
+++ b/ppapi/tests/test_url_loader.h
@@ -46,7 +46,7 @@ class TestURLLoader : public TestCase {
std::string TestEmptyDataPOST();
std::string TestBinaryDataPOST();
std::string TestCustomRequestHeader();
- std::string TestIgnoresBogusContentLength();
+ std::string TestFailsBogusContentLength();
std::string TestStreamToFile();
std::string TestSameOriginRestriction();
std::string TestJavascriptURLRestriction();