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

Side by Side Diff: headless/public/util/testing/generic_url_request_mocks.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
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/testing/generic_url_request_mocks.h" 5 #include "headless/public/util/testing/generic_url_request_mocks.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 9
10 namespace net { 10 namespace net {
11 class URLRequestJob; 11 class URLRequestJob;
12 } // namespace net 12 } // namespace net
13 13
14 namespace headless { 14 namespace headless {
15 15
16 // MockGenericURLRequestJobDelegate 16 // MockGenericURLRequestJobDelegate
17 MockGenericURLRequestJobDelegate::MockGenericURLRequestJobDelegate() 17 MockGenericURLRequestJobDelegate::MockGenericURLRequestJobDelegate()
18 : should_block_(false) {} 18 : should_block_(false) {}
19 MockGenericURLRequestJobDelegate::~MockGenericURLRequestJobDelegate() {} 19 MockGenericURLRequestJobDelegate::~MockGenericURLRequestJobDelegate() {}
20 20
21 bool MockGenericURLRequestJobDelegate::BlockOrRewriteRequest( 21 bool MockGenericURLRequestJobDelegate::BlockOrRewriteRequest(
22 const GURL& url, 22 const GURL& url,
23 const std::string& devtools_id,
23 const std::string& method, 24 const std::string& method,
24 const std::string& referrer, 25 const std::string& referrer,
25 GenericURLRequestJob::RewriteCallback callback) { 26 GenericURLRequestJob::RewriteCallback callback) {
26 if (should_block_) 27 if (should_block_)
27 callback(GenericURLRequestJob::RewriteResult::kDeny, GURL(), method); 28 callback(GenericURLRequestJob::RewriteResult::kDeny, GURL(), method);
28 return should_block_; 29 return should_block_;
29 } 30 }
30 31
31 const GenericURLRequestJob::HttpResponse* 32 const GenericURLRequestJob::HttpResponse*
32 MockGenericURLRequestJobDelegate::MaybeMatchResource( 33 MockGenericURLRequestJobDelegate::MaybeMatchResource(
33 const GURL& url, 34 const GURL& url,
35 const std::string& devtools_id,
34 const std::string& method, 36 const std::string& method,
35 const net::HttpRequestHeaders& request_headers) { 37 const net::HttpRequestHeaders& request_headers) {
36 return nullptr; 38 return nullptr;
37 } 39 }
38 40
39 void MockGenericURLRequestJobDelegate::OnResourceLoadComplete( 41 void MockGenericURLRequestJobDelegate::OnResourceLoadComplete(
40 const GURL& final_url, 42 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) {} 45 int http_response_code) {}
43 46
44 // MockCookieStore 47 // MockCookieStore
45 MockCookieStore::MockCookieStore() {} 48 MockCookieStore::MockCookieStore() {}
46 MockCookieStore::~MockCookieStore() {} 49 MockCookieStore::~MockCookieStore() {}
47 50
48 void MockCookieStore::SetCookieWithOptionsAsync( 51 void MockCookieStore::SetCookieWithOptionsAsync(
49 const GURL& url, 52 const GURL& url,
50 const std::string& cookie_line, 53 const std::string& cookie_line,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 int bytes_read) {} 166 int bytes_read) {}
164 const std::string& MockURLRequestDelegate::response_data() const { 167 const std::string& MockURLRequestDelegate::response_data() const {
165 return response_data_; 168 return response_data_;
166 } 169 }
167 170
168 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const { 171 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const {
169 return nullptr; 172 return nullptr;
170 } 173 }
171 174
172 } // namespace headless 175 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/util/testing/generic_url_request_mocks.h ('k') | headless/test/headless_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698