summaryrefslogtreecommitdiffstats
path: root/chrome/test/nacl
diff options
context:
space:
mode:
authorjvoung <jvoung@chromium.org>2014-08-28 17:35:10 -0700
committerCommit bot <commit-bot@chromium.org>2014-08-29 00:36:55 +0000
commit22bb605b63b7a9fd638fad58c8bc8f985aacd9cd (patch)
tree7e152c54455b63a81c2dba7e6f793ac0fec116d3 /chrome/test/nacl
parent94b4625f9c72a61459a27dda17b8e75ad6967311 (diff)
downloadchromium_src-22bb605b63b7a9fd638fad58c8bc8f985aacd9cd.zip
chromium_src-22bb605b63b7a9fd638fad58c8bc8f985aacd9cd.tar.gz
chromium_src-22bb605b63b7a9fd638fad58c8bc8f985aacd9cd.tar.bz2
Revert of Set RequestContextObject for PNaCl pexe fetches, to fix On-Demand update. (patchset #5 of https://codereview.chromium.org/471233003/)
Reason for revert: Test is failing on a Blink bot on ChromeOS Original issue's description: > Set RequestContextObject for PNaCl pexe fetches, to fix On-Demand update. > > Add more checks to test to detect that the resource type of > the URL request is indeed OBJECT. > Would like to get this merged to the M38 branch. > > BUG=401755 > > Committed: https://chromium.googlesource.com/chromium/src/+/bfc3e122d6721ccc93f0f8b19dac4a3c2a0c947d TBR=teravest@chromium.org,ncbray@chromium.org NOTREECHECKS=true NOTRY=true BUG=401755 Review URL: https://codereview.chromium.org/524483002 Cr-Commit-Position: refs/heads/master@{#292522}
Diffstat (limited to 'chrome/test/nacl')
-rw-r--r--chrome/test/nacl/pnacl_header_test.cc30
-rw-r--r--chrome/test/nacl/pnacl_header_test.h27
2 files changed, 3 insertions, 54 deletions
diff --git a/chrome/test/nacl/pnacl_header_test.cc b/chrome/test/nacl/pnacl_header_test.cc
index 8ba8dc8..e4922aa 100644
--- a/chrome/test/nacl/pnacl_header_test.cc
+++ b/chrome/test/nacl/pnacl_header_test.cc
@@ -12,36 +12,16 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/nacl/nacl_browsertest_util.h"
-#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
-#include "net/url_request/url_request.h"
using net::test_server::BasicHttpResponse;
using net::test_server::EmbeddedTestServer;
using net::test_server::HttpRequest;
using net::test_server::HttpResponse;
-void TestDispatcherHostDelegate::RequestBeginning(
- net::URLRequest* request,
- content::ResourceContext* resource_context,
- content::AppCacheService* appcache_service,
- content::ResourceType resource_type,
- ScopedVector<content::ResourceThrottle>* throttles) {
- // This checks the same condition as the one for PNaCl in
- // AppendComponentUpdaterThrottles.
- if (resource_type == content::RESOURCE_TYPE_OBJECT) {
- const net::HttpRequestHeaders& headers = request->extra_request_headers();
- std::string accept_headers;
- if (headers.GetHeader("Accept", &accept_headers)) {
- if (accept_headers.find("application/x-pnacl") != std::string::npos)
- found_pnacl_header_ = true;
- }
- }
-}
-
PnaclHeaderTest::PnaclHeaderTest() : noncors_loads_(0), cors_loads_(0) {}
PnaclHeaderTest::~PnaclHeaderTest() {}
@@ -61,7 +41,6 @@ void PnaclHeaderTest::StartServer() {
void PnaclHeaderTest::RunLoadTest(const std::string& url,
int expected_noncors,
int expected_cors) {
- content::ResourceDispatcherHost::Get()->SetDelegate(&test_delegate_);
StartServer();
LoadTestMessageHandler handler;
content::JavascriptTestObserver observer(
@@ -78,9 +57,6 @@ void PnaclHeaderTest::RunLoadTest(const std::string& url,
base::ScopedPathOverride component_dir(chrome::DIR_PNACL_COMPONENT);
ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL(url));
-
- content::ResourceDispatcherHost::Get()->SetDelegate(NULL);
-
// Wait until the NMF and pexe are also loaded, not just the HTML.
// Do this by waiting till the LoadTestMessageHandler responds.
EXPECT_TRUE(observer.Run()) << handler.error_message();
@@ -105,14 +81,14 @@ scoped_ptr<HttpResponse> PnaclHeaderTest::WatchForPexeFetch(
if (absolute_url.path().find(".pexe") == std::string::npos)
return scoped_ptr<HttpResponse>();
- // For pexe files, check for the special Accept header,
- // along with the expected ResourceType of the URL request.
+ // For pexe files, check for the special Accept header.
+ // This must match whatever is in:
+ // ppapi/native_client/src/trusted/plugin/pnacl_coordinator.cc
EXPECT_NE(0U, request.headers.count("Accept"));
std::map<std::string, std::string>::const_iterator it =
request.headers.find("Accept");
EXPECT_NE(std::string::npos, it->second.find("application/x-pnacl"));
EXPECT_NE(std::string::npos, it->second.find("*/*"));
- EXPECT_TRUE(test_delegate_.found_pnacl_header());
// Also make sure that other headers like CORS-related headers
// are preserved when injecting the special Accept header.
diff --git a/chrome/test/nacl/pnacl_header_test.h b/chrome/test/nacl/pnacl_header_test.h
index 6c75fdc..9134925 100644
--- a/chrome/test/nacl/pnacl_header_test.h
+++ b/chrome/test/nacl/pnacl_header_test.h
@@ -8,8 +8,6 @@
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/test/base/in_process_browser_test.h"
-#include "content/public/browser/resource_dispatcher_host_delegate.h"
-#include "content/public/common/resource_type.h"
namespace base {
class FilePath;
@@ -22,30 +20,6 @@ class HttpResponse;
}
}
-using content::ResourceDispatcherHostDelegate;
-
-class TestDispatcherHostDelegate : public ResourceDispatcherHostDelegate {
- public:
- explicit TestDispatcherHostDelegate()
- : ResourceDispatcherHostDelegate(), found_pnacl_header_(false) {}
-
- virtual ~TestDispatcherHostDelegate() {}
-
- virtual void RequestBeginning(
- net::URLRequest* request,
- content::ResourceContext* resource_context,
- content::AppCacheService* appcache_service,
- content::ResourceType resource_type,
- ScopedVector<content::ResourceThrottle>* throttles) OVERRIDE;
-
- bool found_pnacl_header() const { return found_pnacl_header_; }
-
- private:
- bool found_pnacl_header_;
-
- DISALLOW_COPY_AND_ASSIGN(TestDispatcherHostDelegate);
-};
-
class PnaclHeaderTest : public InProcessBrowserTest {
public:
PnaclHeaderTest();
@@ -66,7 +40,6 @@ class PnaclHeaderTest : public InProcessBrowserTest {
int noncors_loads_;
int cors_loads_;
- TestDispatcherHostDelegate test_delegate_;
DISALLOW_COPY_AND_ASSIGN(PnaclHeaderTest);
};