Index: net/http/test_network_transaction.h |
diff --git a/net/http/test_network_transaction.h b/net/http/test_network_transaction.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..62def2c2c16176fb663ffdc2b3f6befd5c9cb181 |
--- /dev/null |
+++ b/net/http/test_network_transaction.h |
@@ -0,0 +1,89 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_HTTP_TEST_NETWORK_TRANSACTION_H_ |
+#define NET_HTTP_TEST_NETWORK_TRANSACTION_H_ |
+ |
+#include "net/base/completion_callback.h" |
+#include "net/base/net_errors.h" |
+#include "net/base/request_priority.h" |
+#include "net/http/http_transaction.h" |
+#include "net/http/http_transaction_factory.h" |
+ |
+namespace net { |
+ |
+class AuthCredentials; |
+class BoundNetLog; |
+class HttpRequestHeaders; |
+class IOBuffer; |
+class URLRequestContextGetter; |
+class X509Certificate; |
+ |
+struct HttpRequestInfo; |
+ |
+// A simple class to interpose between the cache and network http layers. |
+// These transactions can be generated by the TestNetworkTransactionFactory |
+// (below) to test interactions between cache and network. |
+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.
|
+ public: |
+ 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.
|
+ virtual ~TestNetworkTransaction(); |
+ |
+ // HttpTransaction |
+ virtual int Start(const HttpRequestInfo* request_info, |
+ const CompletionCallback& callback, |
+ const BoundNetLog& net_log) OVERRIDE; |
+ virtual int RestartIgnoringLastError( |
+ const CompletionCallback& callback) OVERRIDE; |
+ virtual int RestartWithCertificate( |
+ X509Certificate* client_cert, |
+ const CompletionCallback& callback) OVERRIDE; |
+ virtual int RestartWithAuth( |
+ const AuthCredentials& credentials, |
+ const CompletionCallback& callback) OVERRIDE; |
+ virtual bool IsReadyToRestartForAuth() OVERRIDE; |
+ virtual int Read(IOBuffer* buf, int buf_len, |
+ const CompletionCallback& callback) OVERRIDE; |
+ virtual void StopCaching() OVERRIDE; |
+ virtual bool GetFullRequestHeaders( |
+ HttpRequestHeaders* headers) const OVERRIDE; |
+ virtual int64 GetTotalReceivedBytes() const OVERRIDE; |
+ virtual void DoneReading() OVERRIDE; |
+ virtual const HttpResponseInfo* GetResponseInfo() const OVERRIDE; |
+ virtual LoadState GetLoadState() const OVERRIDE; |
+ virtual UploadProgress GetUploadProgress() const OVERRIDE; |
+ virtual bool GetLoadTimingInfo( |
+ LoadTimingInfo* load_timing_info) const OVERRIDE; |
+ virtual void SetPriority(RequestPriority priority) OVERRIDE; |
+ virtual void SetWebSocketHandshakeStreamCreateHelper( |
+ WebSocketHandshakeStreamBase::CreateHelper* create_helper) OVERRIDE; |
+ virtual void SetBeforeNetworkStartCallback( |
+ const BeforeNetworkStartCallback& callback) OVERRIDE; |
+ virtual int ResumeNetworkStart() OVERRIDE; |
+ |
+ private: |
+ enum Error err_; |
+}; |
+ |
+// Creates transactions that always (asynchronously) return |err|. |
+// |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.
|
+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.
|
+ public: |
+ 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.
|
+ virtual ~TestNetworkTransactionFactory(); |
+ |
+ // HttpTransactionFactory: |
+ virtual int CreateTransaction( |
+ RequestPriority priority, |
+ scoped_ptr<HttpTransaction>* trans) OVERRIDE; |
+ virtual HttpCache* GetCache() OVERRIDE; |
+ virtual HttpNetworkSession* GetSession() OVERRIDE; |
+ |
+ private: |
+ 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.
|
+}; |
+ |
+} // namespace net |
+ |
+#endif // NET_HTTP_TEST_NETWORK_TRANSACTION_H_ |