1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_NACL_PNACL_HEADER_TEST_H_
6 #define CHROME_TEST_NACL_PNACL_HEADER_TEST_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "content/public/browser/resource_dispatcher_host_delegate.h"
12 #include "content/public/common/resource_type.h"
19 namespace test_server
{
25 using content::ResourceDispatcherHostDelegate
;
27 class TestDispatcherHostDelegate
: public ResourceDispatcherHostDelegate
{
29 explicit TestDispatcherHostDelegate()
30 : ResourceDispatcherHostDelegate(), found_pnacl_header_(false) {}
32 ~TestDispatcherHostDelegate() override
{}
34 void RequestBeginning(
35 net::URLRequest
* request
,
36 content::ResourceContext
* resource_context
,
37 content::AppCacheService
* appcache_service
,
38 content::ResourceType resource_type
,
39 ScopedVector
<content::ResourceThrottle
>* throttles
) override
;
41 bool found_pnacl_header() const { return found_pnacl_header_
; }
44 bool found_pnacl_header_
;
46 DISALLOW_COPY_AND_ASSIGN(TestDispatcherHostDelegate
);
49 class PnaclHeaderTest
: public InProcessBrowserTest
{
52 ~PnaclHeaderTest() override
;
54 // Run a simple test that checks that the NaCl plugin sends the right
55 // headers when doing |expected_noncors| same origin pexe load requests
56 // and |expected_cors| cross origin pexe load requests.
57 void RunLoadTest(const std::string
& url
,
64 scoped_ptr
<net::test_server::HttpResponse
> WatchForPexeFetch(
65 const net::test_server::HttpRequest
& request
);
69 TestDispatcherHostDelegate test_delegate_
;
70 DISALLOW_COPY_AND_ASSIGN(PnaclHeaderTest
);
73 #endif // CHROME_TEST_NACL_PNACL_HEADER_TEST_H_