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

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

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)
Patch Set: Finish Merge Created 3 years, 6 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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 size_t body_size) {} 56 size_t body_size) {}
57 57
58 // MockCookieStore 58 // MockCookieStore
59 MockCookieStore::MockCookieStore() {} 59 MockCookieStore::MockCookieStore() {}
60 MockCookieStore::~MockCookieStore() {} 60 MockCookieStore::~MockCookieStore() {}
61 61
62 void MockCookieStore::SetCookieWithOptionsAsync( 62 void MockCookieStore::SetCookieWithOptionsAsync(
63 const GURL& url, 63 const GURL& url,
64 const std::string& cookie_line, 64 const std::string& cookie_line,
65 const net::CookieOptions& options, 65 const net::CookieOptions& options,
66 const SetCookiesCallback& callback) { 66 SetCookiesCallback callback) {
67 CHECK(false); 67 CHECK(false);
68 } 68 }
69 69
70 void MockCookieStore::SetCookieWithDetailsAsync( 70 void MockCookieStore::SetCookieWithDetailsAsync(const GURL& url,
71 const GURL& url, 71 const std::string& name,
72 const std::string& name, 72 const std::string& value,
73 const std::string& value, 73 const std::string& domain,
74 const std::string& domain, 74 const std::string& path,
75 const std::string& path, 75 base::Time creation_time,
76 base::Time creation_time, 76 base::Time expiration_time,
77 base::Time expiration_time, 77 base::Time last_access_time,
78 base::Time last_access_time, 78 bool secure,
79 bool secure, 79 bool http_only,
80 bool http_only, 80 net::CookieSameSite same_site,
81 net::CookieSameSite same_site, 81 net::CookiePriority priority,
82 net::CookiePriority priority, 82 SetCookiesCallback callback) {
83 const SetCookiesCallback& callback) {
84 CHECK(false); 83 CHECK(false);
85 } 84 }
86 85
87 void MockCookieStore::SetCanonicalCookieAsync( 86 void MockCookieStore::SetCanonicalCookieAsync(
88 std::unique_ptr<net::CanonicalCookie> cookie, 87 std::unique_ptr<net::CanonicalCookie> cookie,
89 bool secure_source, 88 bool secure_source,
90 bool can_modify_httponly, 89 bool can_modify_httponly,
91 const SetCookiesCallback& callback) { 90 SetCookiesCallback callback) {
92 CHECK(false); 91 CHECK(false);
93 } 92 }
94 93
95 void MockCookieStore::GetCookiesWithOptionsAsync( 94 void MockCookieStore::GetCookiesWithOptionsAsync(
96 const GURL& url, 95 const GURL& url,
97 const net::CookieOptions& options, 96 const net::CookieOptions& options,
98 const GetCookiesCallback& callback) { 97 GetCookiesCallback callback) {
99 CHECK(false); 98 CHECK(false);
100 } 99 }
101 100
102 void MockCookieStore::GetCookieListWithOptionsAsync( 101 void MockCookieStore::GetCookieListWithOptionsAsync(
103 const GURL& url, 102 const GURL& url,
104 const net::CookieOptions& options, 103 const net::CookieOptions& options,
105 const GetCookieListCallback& callback) { 104 GetCookieListCallback callback) {
106 base::ThreadTaskRunnerHandle::Get()->PostTask( 105 base::ThreadTaskRunnerHandle::Get()->PostTask(
107 FROM_HERE, base::Bind(&MockCookieStore::SendCookies, 106 FROM_HERE,
108 base::Unretained(this), url, options, callback)); 107 base::BindOnce(&MockCookieStore::SendCookies, base::Unretained(this), url,
108 options, std::move(callback)));
109 } 109 }
110 110
111 void MockCookieStore::GetAllCookiesAsync( 111 void MockCookieStore::GetAllCookiesAsync(GetCookieListCallback callback) {
112 const GetCookieListCallback& callback) {
113 CHECK(false); 112 CHECK(false);
114 } 113 }
115 114
116 void MockCookieStore::DeleteCookieAsync(const GURL& url, 115 void MockCookieStore::DeleteCookieAsync(const GURL& url,
117 const std::string& cookie_name, 116 const std::string& cookie_name,
118 const base::Closure& callback) { 117 base::OnceClosure callback) {
119 CHECK(false); 118 CHECK(false);
120 } 119 }
121 120
122 void MockCookieStore::DeleteCanonicalCookieAsync( 121 void MockCookieStore::DeleteCanonicalCookieAsync(
123 const net::CanonicalCookie& cookie, 122 const net::CanonicalCookie& cookie,
124 const DeleteCallback& callback) { 123 DeleteCallback callback) {
125 CHECK(false); 124 CHECK(false);
126 } 125 }
127 126
128 void MockCookieStore::DeleteAllCreatedBetweenAsync( 127 void MockCookieStore::DeleteAllCreatedBetweenAsync(
129 const base::Time& delete_begin, 128 const base::Time& delete_begin,
130 const base::Time& delete_end, 129 const base::Time& delete_end,
131 const DeleteCallback& callback) { 130 DeleteCallback callback) {
132 CHECK(false); 131 CHECK(false);
133 } 132 }
134 133
135 void MockCookieStore::DeleteAllCreatedBetweenWithPredicateAsync( 134 void MockCookieStore::DeleteAllCreatedBetweenWithPredicateAsync(
136 const base::Time& delete_begin, 135 const base::Time& delete_begin,
137 const base::Time& delete_end, 136 const base::Time& delete_end,
138 const CookiePredicate& predicate, 137 const CookiePredicate& predicate,
139 const DeleteCallback& callback) { 138 DeleteCallback callback) {
140 CHECK(false); 139 CHECK(false);
141 } 140 }
142 141
143 void MockCookieStore::DeleteSessionCookiesAsync(const DeleteCallback&) { 142 void MockCookieStore::DeleteSessionCookiesAsync(DeleteCallback) {
144 CHECK(false); 143 CHECK(false);
145 } 144 }
146 145
147 void MockCookieStore::FlushStore(const base::Closure& callback) { 146 void MockCookieStore::FlushStore(base::OnceClosure callback) {
148 CHECK(false); 147 CHECK(false);
149 } 148 }
150 149
151 void MockCookieStore::SetForceKeepSessionState() { 150 void MockCookieStore::SetForceKeepSessionState() {
152 CHECK(false); 151 CHECK(false);
153 } 152 }
154 153
155 std::unique_ptr<net::CookieStore::CookieChangedSubscription> 154 std::unique_ptr<net::CookieStore::CookieChangedSubscription>
156 MockCookieStore::AddCallbackForCookie(const GURL& url, 155 MockCookieStore::AddCallbackForCookie(const GURL& url,
157 const std::string& name, 156 const std::string& name,
158 const CookieChangedCallback& callback) { 157 const CookieChangedCallback& callback) {
159 CHECK(false); 158 CHECK(false);
160 return nullptr; 159 return nullptr;
161 } 160 }
162 161
163 bool MockCookieStore::IsEphemeral() { 162 bool MockCookieStore::IsEphemeral() {
164 CHECK(false); 163 CHECK(false);
165 return true; 164 return true;
166 } 165 }
167 166
168 void MockCookieStore::SendCookies(const GURL& url, 167 void MockCookieStore::SendCookies(const GURL& url,
169 const net::CookieOptions& options, 168 const net::CookieOptions& options,
170 const GetCookieListCallback& callback) { 169 GetCookieListCallback callback) {
171 net::CookieList result; 170 net::CookieList result;
172 for (const auto& cookie : cookies_) { 171 for (const auto& cookie : cookies_) {
173 if (cookie.IncludeForRequestURL(url, options)) 172 if (cookie.IncludeForRequestURL(url, options))
174 result.push_back(cookie); 173 result.push_back(cookie);
175 } 174 }
176 callback.Run(result); 175 std::move(callback).Run(result);
177 } 176 }
178 177
179 // MockURLRequestDelegate 178 // MockURLRequestDelegate
180 MockURLRequestDelegate::MockURLRequestDelegate() {} 179 MockURLRequestDelegate::MockURLRequestDelegate() {}
181 MockURLRequestDelegate::~MockURLRequestDelegate() {} 180 MockURLRequestDelegate::~MockURLRequestDelegate() {}
182 181
183 void MockURLRequestDelegate::OnResponseStarted(net::URLRequest* request) {} 182 void MockURLRequestDelegate::OnResponseStarted(net::URLRequest* request) {}
184 void MockURLRequestDelegate::OnReadCompleted(net::URLRequest* request, 183 void MockURLRequestDelegate::OnReadCompleted(net::URLRequest* request,
185 int bytes_read) {} 184 int bytes_read) {}
186 const std::string& MockURLRequestDelegate::response_data() const { 185 const std::string& MockURLRequestDelegate::response_data() const {
187 return response_data_; 186 return response_data_;
188 } 187 }
189 188
190 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const { 189 const net::IOBufferWithSize* MockURLRequestDelegate::metadata() const {
191 return nullptr; 190 return nullptr;
192 } 191 }
193 192
194 } // namespace headless 193 } // namespace headless
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698