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

Side by Side Diff: headless/public/util/deterministic_http_protocol_handler.cc

Issue 2695923010: Add Network.setSendRequestIdHeader and use it in headless (Closed)
Patch Set: Fix the layout test Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « headless/BUILD.gn ('k') | headless/public/util/generic_url_request_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "headless/public/util/deterministic_http_protocol_handler.h" 5 #include "headless/public/util/deterministic_http_protocol_handler.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "headless/public/headless_browser_context.h" 9 #include "headless/public/headless_browser_context.h"
10 #include "headless/public/util/deterministic_dispatcher.h" 10 #include "headless/public/util/deterministic_dispatcher.h"
11 #include "headless/public/util/generic_url_request_job.h" 11 #include "headless/public/util/generic_url_request_job.h"
12 #include "headless/public/util/http_url_fetcher.h" 12 #include "headless/public/util/http_url_fetcher.h"
13 #include "net/url_request/url_request_context.h" 13 #include "net/url_request/url_request_context.h"
14 #include "net/url_request/url_request_job_factory_impl.h" 14 #include "net/url_request/url_request_job_factory_impl.h"
15 15
16 namespace headless { 16 namespace headless {
17 17
18 class DeterministicHttpProtocolHandler::NopGenericURLRequestJobDelegate 18 class DeterministicHttpProtocolHandler::NopGenericURLRequestJobDelegate
19 : public GenericURLRequestJob::Delegate { 19 : public GenericURLRequestJob::Delegate {
20 public: 20 public:
21 NopGenericURLRequestJobDelegate() {} 21 NopGenericURLRequestJobDelegate() {}
22 ~NopGenericURLRequestJobDelegate() override {} 22 ~NopGenericURLRequestJobDelegate() override {}
23 23
24 // GenericURLRequestJob::Delegate methods: 24 // GenericURLRequestJob::Delegate methods:
25 bool BlockOrRewriteRequest( 25 bool BlockOrRewriteRequest(
26 const GURL& url, 26 const GURL& url,
27 const std::string& devtools_id,
27 const std::string& method, 28 const std::string& method,
28 const std::string& referrer, 29 const std::string& referrer,
29 GenericURLRequestJob::RewriteCallback callback) override { 30 GenericURLRequestJob::RewriteCallback callback) override {
30 return false; 31 return false;
31 } 32 }
32 33
33 const GenericURLRequestJob::HttpResponse* MaybeMatchResource( 34 const GenericURLRequestJob::HttpResponse* MaybeMatchResource(
34 const GURL& url, 35 const GURL& url,
36 const std::string& devtools_id,
35 const std::string& method, 37 const std::string& method,
36 const net::HttpRequestHeaders& request_headers) override { 38 const net::HttpRequestHeaders& request_headers) override {
37 return nullptr; 39 return nullptr;
38 } 40 }
39 41
40 void OnResourceLoadComplete(const GURL& final_url, 42 void OnResourceLoadComplete(const GURL& final_url,
43 const std::string& devtools_id,
41 const std::string& mime_type, 44 const std::string& mime_type,
42 int http_response_code) override {} 45 int http_response_code) override {}
43 46
44 private: 47 private:
45 DISALLOW_COPY_AND_ASSIGN(NopGenericURLRequestJobDelegate); 48 DISALLOW_COPY_AND_ASSIGN(NopGenericURLRequestJobDelegate);
46 }; 49 };
47 50
48 DeterministicHttpProtocolHandler::DeterministicHttpProtocolHandler( 51 DeterministicHttpProtocolHandler::DeterministicHttpProtocolHandler(
49 DeterministicDispatcher* deterministic_dispatcher, 52 DeterministicDispatcher* deterministic_dispatcher,
50 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner) 53 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
(...skipping 20 matching lines...) Expand all
71 url_request_job_factory_.reset(new net::URLRequestJobFactoryImpl()); 74 url_request_job_factory_.reset(new net::URLRequestJobFactoryImpl());
72 url_request_context_->set_job_factory(url_request_job_factory_.get()); 75 url_request_context_->set_job_factory(url_request_job_factory_.get());
73 } 76 }
74 return new GenericURLRequestJob( 77 return new GenericURLRequestJob(
75 request, network_delegate, deterministic_dispatcher_, 78 request, network_delegate, deterministic_dispatcher_,
76 base::MakeUnique<HttpURLFetcher>(url_request_context_.get()), 79 base::MakeUnique<HttpURLFetcher>(url_request_context_.get()),
77 nop_delegate_.get()); 80 nop_delegate_.get());
78 } 81 }
79 82
80 } // namespace headless 83 } // namespace headless
OLDNEW
« no previous file with comments | « headless/BUILD.gn ('k') | headless/public/util/generic_url_request_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698