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

Unified Diff: ppapi/tests/test_url_loader.cc

Issue 7706021: Convert FileRefImpl and URLRequestInfo to shared_impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests fixed Created 9 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
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() {

Powered by Google App Engine
This is Rietveld 408576698