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

Side by Side Diff: headless/public/util/testing/generic_url_request_mocks.cc

Issue 2260793002: Headless utility classes for making deterministic protocol handlers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 4 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "headless/public/util/testing/generic_url_request_mocks.h"
6
7 #include "base/logging.h"
8
9 namespace net {
10 class URLRequestJob;
11 } // namespace net
12
13 namespace headless {
14
15 // MockGenericURLRequestJobDelegate
16 MockGenericURLRequestJobDelegate::MockGenericURLRequestJobDelegate() {}
17 MockGenericURLRequestJobDelegate::~MockGenericURLRequestJobDelegate() {}
18
19 bool MockGenericURLRequestJobDelegate::BlockOrRewriteRequest(
20 const GURL& url,
21 const std::string& referrer,
22 GenericURLRequestJob::RewriteCallback callback) {
23 return false;
24 }
25
26 const GenericURLRequestJob::HttpResponse*
27 MockGenericURLRequestJobDelegate::MaybeMatchResource(
28 const GURL& url,
29 const net::HttpRequestHeaders& request_headers) {
30 return nullptr;
31 }
32
33 void MockGenericURLRequestJobDelegate::OnResourceLoadComplete(
34 const GURL& final_url,
35 const std::string& mime_type,
36 int http_response_code) {}
37
38 // MockCookieStore
39 MockCookieStore::MockCookieStore() {}
40 MockCookieStore::~MockCookieStore() {}
41
42 void MockCookieStore::SetCookieWithOptionsAsync(
43 const GURL& url,
44 const std::string& cookie_line,
45 const net::CookieOptions& options,
46 const SetCookiesCallback& callback) {
47 CHECK(false);
48 }
49
50 void MockCookieStore::SetCookieWithDetailsAsync(
51 const GURL& url,
52 const std::string& name,
53 const std::string& value,
54 const std::string& domain,
55 const std::string& path,
56 base::Time creation_time,
57 base::Time expiration_time,
58 base::Time last_access_time,
59 bool secure,
60 bool http_only,
61 net::CookieSameSite same_site,
62 bool enforce_strict_secure,
63 net::CookiePriority priority,
64 const SetCookiesCallback& callback) {
65 CHECK(false);
66 }
67
68 void MockCookieStore::GetCookiesWithOptionsAsync(
69 const GURL& url,
70 const net::CookieOptions& options,
71 const GetCookiesCallback& callback) {
72 CHECK(false);
73 }
74
75 void MockCookieStore::GetCookieListWithOptionsAsync(
76 const GURL& url,
77 const net::CookieOptions& options,
78 const GetCookieListCallback& callback) {
79 base::ThreadTaskRunnerHandle::Get()->PostTask(
80 FROM_HERE, base::Bind(&MockCookieStore::SendCookies,
81 base::Unretained(this), url, options, callback));
82 }
83
84 void MockCookieStore::GetAllCookiesAsync(
85 const GetCookieListCallback& callback) {
86 CHECK(false);
87 }
88
89 void MockCookieStore::DeleteCookieAsync(const GURL& url,
90 const std::string& cookie_name,
91 const base::Closure& callback) {
92 CHECK(false);
93 }
94
95 void MockCookieStore::DeleteCanonicalCookieAsync(
96 const net::CanonicalCookie& cookie,
97 const DeleteCallback& callback) {
98 CHECK(false);
99 }
100
101 void MockCookieStore::DeleteAllCreatedBetweenAsync(
102 const base::Time& delete_begin,
103 const base::Time& delete_end,
104 const DeleteCallback& callback) {
105 CHECK(false);
106 }
107
108 void MockCookieStore::DeleteAllCreatedBetweenWithPredicateAsync(
109 const base::Time& delete_begin,
110 const base::Time& delete_end,
111 const CookiePredicate& predicate,
112 const DeleteCallback& callback) {
113 CHECK(false);
114 }
115
116 void MockCookieStore::DeleteSessionCookiesAsync(const DeleteCallback&) {
117 CHECK(false);
118 }
119
120 void MockCookieStore::FlushStore(const base::Closure& callback) {
121 CHECK(false);
122 }
123
124 void MockCookieStore::SetForceKeepSessionState() {
125 CHECK(false);
126 }
127
128 std::unique_ptr<net::CookieStore::CookieChangedSubscription>
129 MockCookieStore::AddCallbackForCookie(const GURL& url,
130 const std::string& name,
131 const CookieChangedCallback& callback) {
132 CHECK(false);
133 return nullptr;
134 }
135
136 bool MockCookieStore::IsEphemeral() {
137 CHECK(false);
138 return true;
139 }
140
141 void MockCookieStore::SendCookies(const GURL& url,
142 const net::CookieOptions& options,
143 const GetCookieListCallback& callback) {
144 net::CookieList result;
145 for (const auto& cookie : cookies_) {
146 if (cookie.IncludeForRequestURL(url, options))
147 result.push_back(cookie);
148 }
149 callback.Run(result);
150 }
151
152 // MockURLRequestDelegate
153 MockURLRequestDelegate::MockURLRequestDelegate() {}
154 MockURLRequestDelegate::~MockURLRequestDelegate() {}
155
156 void MockURLRequestDelegate::OnResponseStarted(net::URLRequest* request) {}
157 void MockURLRequestDelegate::OnReadCompleted(net::URLRequest* request,
158 int bytes_read) {}
159 const std::string& MockURLRequestDelegate::response_data() const {
160 return response_data_;
161 }
162
163 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const {
164 return nullptr;
165 }
166
167 } // namespace headless
OLDNEW
« no previous file with comments | « headless/public/util/testing/generic_url_request_mocks.h ('k') | headless/public/util/url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698