summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-26 04:51:07 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-26 04:51:07 +0000
commit6f75c95235c7ea357e180ddfb6d1cba143d87645 (patch)
treee5440672cfbe6bac4d28f6790ab1c5b4ee8b3f93 /ppapi/tests
parentecba6c3763755a5c617972d74f0d798939183260 (diff)
downloadchromium_src-6f75c95235c7ea357e180ddfb6d1cba143d87645.zip
chromium_src-6f75c95235c7ea357e180ddfb6d1cba143d87645.tar.gz
chromium_src-6f75c95235c7ea357e180ddfb6d1cba143d87645.tar.bz2
Convert FileRefImpl and URLRequestInfo to shared_impl.
One nice side effect of this change is that there are no longer any IPCs associated with the request info. Instead, we just send the parameters to the host when we open a url loader. Review URL: http://codereview.chromium.org/7706021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98391 0039d316-1c4b-4281-b951-d872f2087c98
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();