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

Side by Side Diff: content/browser/net/url_request_abort_on_end_job.h

Issue 8404001: Add a browsertest for bug 75604 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: version to commit Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 // This class simulates what wininet does when a dns lookup fails.
5
6 #ifndef CONTENT_BROWSER_NET_URL_REQUEST_ABORT_ON_END_JOB_H_
7 #define CONTENT_BROWSER_NET_URL_REQUEST_ABORT_ON_END_JOB_H_
8 #pragma once
9
10 #include <string>
11
12 #include "base/basictypes.h"
13 #include "base/compiler_specific.h"
14 #include "base/memory/weak_ptr.h"
15 #include "content/common/content_export.h"
16 #include "net/url_request/url_request_job.h"
17
18 // This url request simulates a network error which occurs immediately after
19 // receiving the very first data.
20
21 class URLRequestAbortOnEndJob : public net::URLRequestJob {
22 public:
23 static const char k400AbortOnEndUrl[];
24
25 // net::URLRequestJob
26 virtual void Start() OVERRIDE;
27 virtual bool GetMimeType(std::string* mime_type) const OVERRIDE;
28 virtual void GetResponseInfo(net::HttpResponseInfo* info) OVERRIDE;
29 virtual bool ReadRawData(net::IOBuffer* buf,
30 int buf_size,
31 int* bytes_read) OVERRIDE;
32
33 static net::URLRequestJob* Factory(net::URLRequest* request,
34 const std::string& scheme);
35
36 CONTENT_EXPORT static void AddUrlHandler();
37
38 private:
39 explicit URLRequestAbortOnEndJob(net::URLRequest* request);
40 virtual ~URLRequestAbortOnEndJob();
41
42 void GetResponseInfoConst(net::HttpResponseInfo* info) const;
43 void StartAsync();
44
45 bool sent_data_;
46
47 base::WeakPtrFactory<URLRequestAbortOnEndJob> weak_factory_;
48
49 DISALLOW_COPY_AND_ASSIGN(URLRequestAbortOnEndJob);
50 };
51 #endif
52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698