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

Unified Diff: net/test/url_request/url_request_hanging_read_job.h

Issue 1984723002: Support setReadTimeout in CronetHttpURLConnection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove outdated include Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: net/test/url_request/url_request_hanging_read_job.h
diff --git a/net/test/url_request/url_request_hanging_read_job.h b/net/test/url_request/url_request_hanging_read_job.h
new file mode 100644
index 0000000000000000000000000000000000000000..5e335bb333bedcb4b2bf14f496c22e6c6b448c07
--- /dev/null
+++ b/net/test/url_request/url_request_hanging_read_job.h
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_
+#define NET_URL_REQUEST_URL_REQUEST_HANGING_READ_JOB_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+#include "net/base/net_export.h"
+#include "net/url_request/url_request_job.h"
+
+namespace net {
+
+class URLRequest;
+
+// A URLRequestJob that hangs when try to read response body.
+class URLRequestHangingReadJob : public URLRequestJob {
+ public:
+ URLRequestHangingReadJob(URLRequest* request,
+ NetworkDelegate* network_delegate);
+
+ void Start() override;
+ int ReadRawData(IOBuffer* buf, int buf_size) override;
+ int GetResponseCode() const override;
+ void GetResponseInfo(HttpResponseInfo* info) override;
+
+ // Adds the testing URLs to the URLRequestFilter.
+ static void AddUrlHandler();
+
+ static GURL GetMockHttpUrl();
+ static GURL GetMockHttpsUrl();
+
+ private:
+ void GetResponseInfoConst(HttpResponseInfo* info) const;
+ ~URLRequestHangingReadJob() override;
+
+ void StartAsync();
+
+ const int content_length_;
+ base::WeakPtrFactory<URLRequestHangingReadJob> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(URLRequestHangingReadJob);
+};
+
+} // namespace net
+
+#endif // NET_URL_REQUEST_URL_REQUEST_SIMPLE_JOB_H_

Powered by Google App Engine
This is Rietveld 408576698