summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 00:37:58 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 00:37:58 +0000
commitda740606d7e06af50494cc84a4a771940b75e712 (patch)
tree2feb9d62bb05a590c911b7b7ebf9ac37d82acce2 /ppapi
parent3c76d012cff4a3c81f5845d45af3a6ac8b8a102e (diff)
downloadchromium_src-da740606d7e06af50494cc84a4a771940b75e712.zip
chromium_src-da740606d7e06af50494cc84a4a771940b75e712.tar.gz
chromium_src-da740606d7e06af50494cc84a4a771940b75e712.tar.bz2
Revert 71334 - Fix Pepper URL Loader callbacks.
[Not applying the "obvious" fix, since it might lead to callbacks being called incorrectly.] Add some tests (for aborting calls). BUG=none TEST=ppapi_tests Review URL: http://codereview.chromium.org/6220006 TBR=viettrungluu@chromium.org,jam@chromium.org,brettw@chromium.org Review URL: http://codereview.chromium.org/6254003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71400 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/tests/test_file_io.cc5
-rw-r--r--ppapi/tests/test_url_loader.cc73
-rw-r--r--ppapi/tests/test_url_loader.h3
3 files changed, 7 insertions, 74 deletions
diff --git a/ppapi/tests/test_file_io.cc b/ppapi/tests/test_file_io.cc
index 9b12ed6..11fe62b 100644
--- a/ppapi/tests/test_file_io.cc
+++ b/ppapi/tests/test_file_io.cc
@@ -484,10 +484,5 @@ std::string TestFileIO::TestAbortCalls() {
}
}
- // TODO(viettrungluu): Also test that Close() aborts callbacks.
- // crbug.com/69457
-
PASS();
}
-
-// TODO(viettrungluu): Test Close(). crbug.com/69457
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index 72e6d40..8b0dfc6 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -1,11 +1,10 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ppapi/tests/test_url_loader.h"
#include <stdio.h>
-#include <string.h>
#include <string>
#include "ppapi/c/dev/ppb_file_io_dev.h"
@@ -51,7 +50,6 @@ void TestURLLoader::RunTest() {
RUN_TEST(SameOriginRestriction);
RUN_TEST(StreamToFile);
RUN_TEST(AuditURLRedirect);
- RUN_TEST(AbortCalls);
}
std::string TestURLLoader::ReadEntireFile(pp::FileIO_Dev* file_io,
@@ -72,13 +70,13 @@ std::string TestURLLoader::ReadEntireFile(pp::FileIO_Dev* file_io,
data->append(buf, rv);
}
- PASS();
+ return "";
}
std::string TestURLLoader::ReadEntireResponseBody(pp::URLLoader* loader,
std::string* body) {
TestCompletionCallback callback;
- char buf[2]; // Small so that multiple reads are needed.
+ char buf[256];
for (;;) {
int32_t rv = loader->ReadResponseBody(buf, sizeof(buf), callback);
@@ -91,7 +89,7 @@ std::string TestURLLoader::ReadEntireResponseBody(pp::URLLoader* loader,
body->append(buf, rv);
}
- PASS();
+ return "";
}
std::string TestURLLoader::LoadAndCompareBody(
@@ -123,7 +121,7 @@ std::string TestURLLoader::LoadAndCompareBody(
if (body != expected_body)
return "URLLoader::ReadResponseBody returned unexpected content";
- PASS();
+ return "";
}
std::string TestURLLoader::TestBasicGET() {
@@ -298,66 +296,7 @@ std::string TestURLLoader::TestAuditURLRedirect() {
if (response_info.GetRedirectURL().AsString() != "www.google.com")
return "Redirect URL should be www.google.com";
- PASS();
-}
-
-std::string TestURLLoader::TestAbortCalls() {
- pp::URLRequestInfo request;
- request.SetURL("test_url_loader_data/hello.txt");
-
- TestCompletionCallback callback;
- int32_t rv;
-
- // Abort |Open()|.
- {
- callback.reset_run_count();
- rv = pp::URLLoader(*instance_).Open(request, callback);
- if (callback.run_count() > 0)
- return "URLLoader::Open ran callback synchronously.";
- if (rv == PP_ERROR_WOULDBLOCK) {
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "URLLoader::Open not aborted.";
- } else if (rv != PP_OK) {
- return ReportError("URLLoader::Open", rv);
- }
- }
-
- // Abort |ReadResponseBody()|.
- {
- char buf[2] = { 0 };
- {
- pp::URLLoader loader(*instance_);
- rv = loader.Open(request, callback);
- if (rv == PP_ERROR_WOULDBLOCK)
- rv = callback.WaitForResult();
- if (rv != PP_OK)
- return ReportError("URLLoader::Open", rv);
-
- callback.reset_run_count();
- rv = loader.ReadResponseBody(buf, sizeof(buf), callback);
- } // Destroy |loader|.
- if (rv == PP_ERROR_WOULDBLOCK) {
- // Save a copy and make sure |buf| doesn't get written to.
- char buf_copy[2];
- memcpy(&buf_copy, &buf, sizeof(buf));
- rv = callback.WaitForResult();
- if (rv != PP_ERROR_ABORTED)
- return "URLLoader::ReadResponseBody not aborted.";
- if (memcmp(&buf_copy, &buf, sizeof(buf)) != 0)
- return "URLLoader::ReadResponseBody wrote data after resource "
- "destruction.";
- } else if (rv != PP_OK) {
- return ReportError("URLLoader::ReadResponseBody", rv);
- }
- }
-
- // TODO(viettrungluu): More abort tests (but add basic tests first).
- // Also test that Close() aborts properly. crbug.com/69457
-
- PASS();
+ return "";
}
-// TODO(viettrungluu): Add tests for FollowRedirect,
-// Get{Upload,Download}Progress, Close (including abort tests if applicable).
// TODO(darin): Add a test for GrantUniversalAccess.
diff --git a/ppapi/tests/test_url_loader.h b/ppapi/tests/test_url_loader.h
index 0b14bd2..447b7e2 100644
--- a/ppapi/tests/test_url_loader.h
+++ b/ppapi/tests/test_url_loader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -42,7 +42,6 @@ class TestURLLoader : public TestCase {
std::string TestStreamToFile();
std::string TestSameOriginRestriction();
std::string TestAuditURLRedirect();
- std::string TestAbortCalls();
const PPB_FileIOTrusted_Dev* file_io_trusted_interface_;
};