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

Side by Side Diff: net/http/http_transaction_test_util.h

Issue 2519473002: Fixes the cache lock issue. (Closed)
Patch Set: Initial patch Created 4 years 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 5 #ifndef NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 6 #define NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
7 7
8 #include "net/http/http_transaction.h" 8 #include "net/http/http_transaction.h"
9 9
10 #include <stdint.h> 10 #include <stdint.h>
11 11
12 #include <string> 12 #include <string>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/run_loop.h"
17 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
18 #include "net/base/io_buffer.h" 19 #include "net/base/io_buffer.h"
19 #include "net/base/load_flags.h" 20 #include "net/base/load_flags.h"
20 #include "net/base/net_error_details.h" 21 #include "net/base/net_error_details.h"
21 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
22 #include "net/base/request_priority.h" 23 #include "net/base/request_priority.h"
23 #include "net/base/test_completion_callback.h" 24 #include "net/base/test_completion_callback.h"
24 #include "net/disk_cache/disk_cache.h" 25 #include "net/disk_cache/disk_cache.h"
25 #include "net/http/http_cache.h" 26 #include "net/http/http_cache.h"
26 #include "net/http/http_request_info.h" 27 #include "net/http/http_request_info.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 const CompletionCallback& callback) override; 195 const CompletionCallback& callback) override;
195 196
196 int RestartWithAuth(const AuthCredentials& credentials, 197 int RestartWithAuth(const AuthCredentials& credentials,
197 const CompletionCallback& callback) override; 198 const CompletionCallback& callback) override;
198 199
199 bool IsReadyToRestartForAuth() override; 200 bool IsReadyToRestartForAuth() override;
200 201
201 int Read(IOBuffer* buf, 202 int Read(IOBuffer* buf,
202 int buf_len, 203 int buf_len,
203 const CompletionCallback& callback) override; 204 const CompletionCallback& callback) override;
205
206 void Orphan(std::unique_ptr<HttpTransaction> trans) override;
207
204 void PopulateNetErrorDetails(NetErrorDetails* details) const override; 208 void PopulateNetErrorDetails(NetErrorDetails* details) const override;
205 209
206 void StopCaching() override; 210 void StopCaching() override;
207 211
208 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override; 212 bool GetFullRequestHeaders(HttpRequestHeaders* headers) const override;
209 213
210 int64_t GetTotalReceivedBytes() const override; 214 int64_t GetTotalReceivedBytes() const override;
211 215
212 int64_t GetTotalSentBytes() const override; 216 int64_t GetTotalSentBytes() const override;
213 217
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 bool stop_caching_called_; 344 bool stop_caching_called_;
341 RequestPriority last_create_transaction_priority_; 345 RequestPriority last_create_transaction_priority_;
342 346
343 // By default clock_ is NULL but it can be set to a custom clock by test 347 // By default clock_ is NULL but it can be set to a custom clock by test
344 // frameworks using SetClock. 348 // frameworks using SetClock.
345 base::Clock* clock_; 349 base::Clock* clock_;
346 350
347 base::WeakPtr<MockNetworkTransaction> last_transaction_; 351 base::WeakPtr<MockNetworkTransaction> last_transaction_;
348 }; 352 };
349 353
354 struct Context {
355 Context();
356
357 int result;
358 TestCompletionCallback callback;
359 std::unique_ptr<HttpTransaction> trans;
360 ~Context();
361 };
362
350 //----------------------------------------------------------------------------- 363 //-----------------------------------------------------------------------------
351 // helpers 364 // helpers
352 365
353 // read the transaction completely 366 // read the transaction completely
354 int ReadTransaction(HttpTransaction* trans, std::string* result); 367 int ReadTransaction(HttpTransaction* trans, std::string* result);
355 368
369 int ReadSharedWritersCacheRead(std::vector<Context*>& context_list,
370 std::vector<std::string>& results);
371
372 int ReadSharedWritersJoinedRead(std::vector<Context*>& context_list,
373 std::vector<std::string>& results);
374
375 int ReadSharedWritersJoinedReadDoneReading(std::vector<Context*>& context_list,
376 std::vector<std::string>& results);
377
378 int ReadSharedWritersJoinedReadDoomCurrentWriter(
379 std::vector<Context*>& context_list,
380 std::vector<std::string>& results);
381
382 int ReadSharedWritersJoinedReadDeleteWaitingWriter(
383 std::vector<Context*>& context_list,
384 std::vector<std::string>& results);
385
386 int ReadSharedWritersJoinedReadDeleteIdleWriter(
387 std::vector<Context*>& context_list,
388 std::vector<std::string>& results);
389
356 } // namespace net 390 } // namespace net
357 391
358 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_ 392 #endif // NET_HTTP_HTTP_TRANSACTION_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698