summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbbudge@google.com <bbudge@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-11 23:15:10 +0000
committerbbudge@google.com <bbudge@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-11 23:15:10 +0000
commit4ad2087c2b3fb35d83fa3ea3c11fa0941cf9fd05 (patch)
tree9492acfc4e47e2ab5e3a24aa159e78289c42c1ca
parent3a0c37eff42f8185aa491ef395f25bfb93553754 (diff)
downloadchromium_src-4ad2087c2b3fb35d83fa3ea3c11fa0941cf9fd05.zip
chromium_src-4ad2087c2b3fb35d83fa3ea3c11fa0941cf9fd05.tar.gz
chromium_src-4ad2087c2b3fb35d83fa3ea3c11fa0941cf9fd05.tar.bz2
Remove temporary fixes for URLLoader synchronous error reporting. Fix an PPB_URLLoader_Impl::didFinishLoading to check that callback is present. Fix tests to test both sync and async semantics.
Review URL: http://codereview.chromium.org/7189041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92073 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/tests/test_url_loader.cc18
-rw-r--r--webkit/plugins/ppapi/ppb_url_loader_impl.cc15
2 files changed, 15 insertions, 18 deletions
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index 6ecb15d..fe1bec1 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -43,18 +43,18 @@ bool TestURLLoader::Init() {
}
void TestURLLoader::RunTest() {
- RUN_TEST(BasicGET);
- RUN_TEST_FORCEASYNC(BasicPOST);
+ RUN_TEST_FORCEASYNC_AND_NOT(BasicGET);
+ RUN_TEST_FORCEASYNC_AND_NOT(BasicPOST);
RUN_TEST_FORCEASYNC_AND_NOT(CompoundBodyPOST);
- RUN_TEST_FORCEASYNC(EmptyDataPOST);
- RUN_TEST(BinaryDataPOST);
+ RUN_TEST_FORCEASYNC_AND_NOT(EmptyDataPOST);
+ RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST);
RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader);
- RUN_TEST_FORCEASYNC(IgnoresBogusContentLength);
- RUN_TEST(SameOriginRestriction);
- RUN_TEST_FORCEASYNC(CrossOriginRequest);
+ RUN_TEST_FORCEASYNC_AND_NOT(IgnoresBogusContentLength);
+ RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction);
+ RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest);
RUN_TEST_FORCEASYNC_AND_NOT(StreamToFile);
- RUN_TEST(AuditURLRedirect);
- RUN_TEST_FORCEASYNC(AbortCalls);
+ RUN_TEST_FORCEASYNC_AND_NOT(AuditURLRedirect);
+ RUN_TEST_FORCEASYNC_AND_NOT(AbortCalls);
}
std::string TestURLLoader::ReadEntireFile(pp::FileIO_Dev* file_io,
diff --git a/webkit/plugins/ppapi/ppb_url_loader_impl.cc b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
index 666d4ee..a63db51 100644
--- a/webkit/plugins/ppapi/ppb_url_loader_impl.cc
+++ b/webkit/plugins/ppapi/ppb_url_loader_impl.cc
@@ -123,11 +123,6 @@ int32_t PPB_URLLoader_Impl::Open(PP_Resource request_id,
return PP_ERROR_FAILED;
loader_->loadAsynchronously(web_request, this);
- // TODO(bbudge) Remove this code when AssociatedURLLoader is changed to
- // return errors asynchronously.
- if (done_status_ == PP_ERROR_FAILED ||
- done_status_ == PP_ERROR_NOACCESS)
- return done_status_;
request_info_ = scoped_refptr<PPB_URLRequestInfo_Impl>(request);
@@ -321,7 +316,11 @@ void PPB_URLLoader_Impl::didReceiveData(WebURLLoader* loader,
void PPB_URLLoader_Impl::didFinishLoading(WebURLLoader* loader,
double finish_time) {
done_status_ = PP_OK;
- RunCallback(done_status_);
+ if (user_buffer_ || is_streaming_to_file_) {
+ RunCallback(done_status_);
+ } else {
+ DCHECK(!pending_callback_.get() || pending_callback_->completed());
+ }
}
void PPB_URLLoader_Impl::didFail(WebURLLoader* loader,
@@ -370,9 +369,7 @@ void PPB_URLLoader_Impl::RegisterCallback(PP_CompletionCallback callback) {
void PPB_URLLoader_Impl::RunCallback(int32_t result) {
// This may be null only when this is a main document loader.
if (!pending_callback_.get()) {
- // TODO(viettrungluu): put this CHECK back when the callback race condition
- // is fixed: http://code.google.com/p/chromium/issues/detail?id=70347.
- //CHECK(main_document_loader_);
+ CHECK(main_document_loader_);
return;
}