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

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

Issue 138513002: Plumb network stack information about existence of cached copy (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Share a bit of errorpage_browsertest.cc test code. Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
mmenke 2014/01/23 20:40:52 nit: No (c) in new files.
mmenke 2014/01/23 20:40:52 Think this file is more about the factory than the
Randy Smith (Not in Mondays) 2014/01/23 22:12:33 Done.
Randy Smith (Not in Mondays) 2014/01/25 21:11:31 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_HTTP_TEST_NETWORK_TRANSACTION_H_
6 #define NET_HTTP_TEST_NETWORK_TRANSACTION_H_
7
8 #include "net/base/completion_callback.h"
9 #include "net/base/net_errors.h"
10 #include "net/base/request_priority.h"
11 #include "net/http/http_transaction.h"
12 #include "net/http/http_transaction_factory.h"
13
14 namespace net {
15
16 class AuthCredentials;
17 class BoundNetLog;
18 class HttpRequestHeaders;
19 class IOBuffer;
20 class URLRequestContextGetter;
21 class X509Certificate;
22
23 struct HttpRequestInfo;
24
25 // A simple class to interpose between the cache and network http layers.
26 // These transactions can be generated by the TestNetworkTransactionFactory
27 // (below) to test interactions between cache and network.
28 class NET_EXPORT TestNetworkTransaction : public HttpTransaction {
mmenke 2014/01/23 20:40:52 This doesn't need to be exported, or even in the h
mmenke 2014/01/23 20:40:52 Maybe FailingHttpTransaction?
Randy Smith (Not in Mondays) 2014/01/25 21:11:31 Done.
Randy Smith (Not in Mondays) 2014/01/25 21:11:31 Done.
29 public:
30 explicit TestNetworkTransaction(enum Error err);
mmenke 2014/01/23 20:40:52 --enum err->error
Randy Smith (Not in Mondays) 2014/01/23 22:12:33 Done.
31 virtual ~TestNetworkTransaction();
32
33 // HttpTransaction
34 virtual int Start(const HttpRequestInfo* request_info,
35 const CompletionCallback& callback,
36 const BoundNetLog& net_log) OVERRIDE;
37 virtual int RestartIgnoringLastError(
38 const CompletionCallback& callback) OVERRIDE;
39 virtual int RestartWithCertificate(
40 X509Certificate* client_cert,
41 const CompletionCallback& callback) OVERRIDE;
42 virtual int RestartWithAuth(
43 const AuthCredentials& credentials,
44 const CompletionCallback& callback) OVERRIDE;
45 virtual bool IsReadyToRestartForAuth() OVERRIDE;
46 virtual int Read(IOBuffer* buf, int buf_len,
47 const CompletionCallback& callback) OVERRIDE;
48 virtual void StopCaching() OVERRIDE;
49 virtual bool GetFullRequestHeaders(
50 HttpRequestHeaders* headers) const OVERRIDE;
51 virtual int64 GetTotalReceivedBytes() const OVERRIDE;
52 virtual void DoneReading() OVERRIDE;
53 virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE;
54 virtual LoadState GetLoadState() const OVERRIDE;
55 virtual UploadProgress GetUploadProgress() const OVERRIDE;
56 virtual bool GetLoadTimingInfo(
57 LoadTimingInfo* load_timing_info) const OVERRIDE;
58 virtual void SetPriority(RequestPriority priority) OVERRIDE;
59 virtual void SetWebSocketHandshakeStreamCreateHelper(
60 WebSocketHandshakeStreamBase::CreateHelper* create_helper) OVERRIDE;
61 virtual void SetBeforeNetworkStartCallback(
62 const BeforeNetworkStartCallback& callback) OVERRIDE;
63 virtual int ResumeNetworkStart() OVERRIDE;
64
65 private:
66 enum Error err_;
67 };
68
69 // Creates transactions that always (asynchronously) return |err|.
70 // |err| must not be net::OK.
mmenke 2014/01/23 20:40:52 Don't think the "net::" is needed.
Randy Smith (Not in Mondays) 2014/01/23 22:12:33 Done.
71 class NET_EXPORT TestNetworkTransactionFactory : public HttpTransactionFactory {
mmenke 2014/01/23 20:40:52 This should have a clearer name. FailingNetworkTr
Randy Smith (Not in Mondays) 2014/01/25 21:11:31 Done.
72 public:
73 TestNetworkTransactionFactory(enum Error err);
mmenke 2014/01/23 20:40:52 --enum err->error
Randy Smith (Not in Mondays) 2014/01/23 22:12:33 Done.
74 virtual ~TestNetworkTransactionFactory();
75
76 // HttpTransactionFactory:
77 virtual int CreateTransaction(
78 RequestPriority priority,
79 scoped_ptr<HttpTransaction>* trans) OVERRIDE;
80 virtual HttpCache* GetCache() OVERRIDE;
81 virtual HttpNetworkSession* GetSession() OVERRIDE;
82
83 private:
84 enum Error err_;
mmenke 2014/01/23 20:40:52 --enum, and err_ -> error_.
Randy Smith (Not in Mondays) 2014/01/23 22:12:33 Done.
85 };
86
87 } // namespace net
88
89 #endif // NET_HTTP_TEST_NETWORK_TRANSACTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698