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

Unified Diff: ppapi/tests/test_url_loader.cc

Issue 8692015: Move the mock headers file for 'test_case.html' to the destination directory so cross-origin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_url_loader.cc
===================================================================
--- ppapi/tests/test_url_loader.cc (revision 112253)
+++ ppapi/tests/test_url_loader.cc (working copy)
@@ -116,11 +116,15 @@
RUN_TEST_FORCEASYNC_AND_NOT(BinaryDataPOST, filter);
RUN_TEST_FORCEASYNC_AND_NOT(CustomRequestHeader, filter);
RUN_TEST_FORCEASYNC_AND_NOT(FailsBogusContentLength, filter);
- // Disable portion of test which fails when the HTTP server's
- // data_dir is moved to PRODUCT_DIR.
- // http://code.google.com/p/chromium/issues/detail?id=103690
- // RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction, filter);
- // RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest, filter);
+ // TODO(bbudge) Enable these tests for NaCl when we have a way to get
+ // the document URL. The PPAPI tests use PPB_URLUtil_Dev.
+#if !(defined __native_client__)
+ RUN_TEST_FORCEASYNC_AND_NOT(SameOriginRestriction, filter);
+ // Cross origin requests require the 'test_case.html.mock-http-headers'
+ // file to be in the same directory as 'test_case.html', so that the test
+ // server returns CORS response headers.
+ RUN_TEST_FORCEASYNC_AND_NOT(CrossOriginRequest, filter);
+#endif
RUN_TEST_FORCEASYNC_AND_NOT(JavascriptURLRestriction, filter);
RUN_TEST_FORCEASYNC_AND_NOT(MethodRestriction, filter);
RUN_TEST_FORCEASYNC_AND_NOT(HeaderRestriction, filter);
@@ -266,10 +270,21 @@
pp::Var pp_document_url = pp::URLUtil_Dev::Get()->GetDocumentURL(
*instance_, &components);
std::string document_url = pp_document_url.AsString();
- // Replace "127.0.0.1" with "localhost".
- ASSERT_TRUE(document_url.find("127.0.0.1") != std::string::npos);
- return document_url.replace(
- components.host.begin, components.host.len, "localhost");
+ // Replace "127.0.0.1" with "localhost". Or vice versa.
+ bool changedHost = false;
+ if (document_url.find("127.0.0.1") != std::string::npos) {
+ document_url.replace(components.host.begin,
+ components.host.len,
+ "localhost");
+ changedHost = true;
+ } else if (document_url.find("localhost") != std::string::npos) {
+ document_url.replace(components.host.begin,
+ components.host.len,
+ "127.0.0.1");
+ changedHost = true;
+ }
+ ASSERT_TRUE(changedHost);
+ return document_url;
}
int32_t TestURLLoader::OpenUntrusted(const std::string& method,
@@ -532,9 +547,11 @@
if (rv != PP_OK)
return ReportError(
"Untrusted, intended cross-origin request", rv);
+#if !(defined __native_client__)
rv = OpenTrusted(request);
if (rv != PP_OK)
return ReportError("Trusted cross-origin request", rv);
+#endif
PASS();
}
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698