summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 16:52:52 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-14 16:52:52 +0000
commitbb8890e9cee0c997257873e9c978eead7d028568 (patch)
tree8b73fbe50b6d1f7e5d7b8220124f8e7d2552b93c /ppapi/tests
parent84d5b453e3b8f4eef8cab9860a27c25466c7fe0a (diff)
downloadchromium_src-bb8890e9cee0c997257873e9c978eead7d028568.zip
chromium_src-bb8890e9cee0c997257873e9c978eead7d028568.tar.gz
chromium_src-bb8890e9cee0c997257873e9c978eead7d028568.tar.bz2
Modify the webkit::ppapi::URLLoader to use the underlying AssociatedURLLoader for security checks, and convert URLRequest properties into the configuration for the AssociatedURLLoader. This Issue depends on http://codereview.chromium.org/6755015/
BUG=47354 TEST=ppapi_tests Review URL: http://codereview.chromium.org/6765040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_url_loader.cc21
-rw-r--r--ppapi/tests/test_url_loader.h1
2 files changed, 22 insertions, 0 deletions
diff --git a/ppapi/tests/test_url_loader.cc b/ppapi/tests/test_url_loader.cc
index 1faacfc..2e708cf 100644
--- a/ppapi/tests/test_url_loader.cc
+++ b/ppapi/tests/test_url_loader.cc
@@ -49,6 +49,7 @@ void TestURLLoader::RunTest() {
RUN_TEST(CustomRequestHeader);
RUN_TEST(IgnoresBogusContentLength);
RUN_TEST(SameOriginRestriction);
+ RUN_TEST(CrossOriginRequest);
RUN_TEST(StreamToFile);
RUN_TEST(AuditURLRedirect);
RUN_TEST(AbortCalls);
@@ -270,6 +271,26 @@ std::string TestURLLoader::TestSameOriginRestriction() {
PASS();
}
+std::string TestURLLoader::TestCrossOriginRequest() {
+ pp::URLRequestInfo request;
+ // Create a URL that will be considered to be a different origin.
+ request.SetURL("http://127.0.0.1/test_url_loader_data/hello.txt");
+ request.SetAllowCrossOriginRequests(true);
+
+ TestCompletionCallback callback(instance_->pp_instance());
+
+ pp::URLLoader loader(*instance_);
+ int32_t rv = loader.Open(request, callback);
+ if (rv == PP_ERROR_WOULDBLOCK)
+ rv = callback.WaitForResult();
+
+ // We expect success since we allowed a cross-origin request.
+ if (rv == PP_ERROR_NOACCESS)
+ return ReportError("URLLoader::Open()", rv);
+
+ PASS();
+}
+
// This test should cause a redirect and ensure that the loader runs
// the callback, rather than following the redirect.
std::string TestURLLoader::TestAuditURLRedirect() {
diff --git a/ppapi/tests/test_url_loader.h b/ppapi/tests/test_url_loader.h
index 0b14bd2..b91ad75 100644
--- a/ppapi/tests/test_url_loader.h
+++ b/ppapi/tests/test_url_loader.h
@@ -41,6 +41,7 @@ class TestURLLoader : public TestCase {
std::string TestIgnoresBogusContentLength();
std::string TestStreamToFile();
std::string TestSameOriginRestriction();
+ std::string TestCrossOriginRequest();
std::string TestAuditURLRedirect();
std::string TestAbortCalls();