1 // Copyright (c) 2012 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.
6 #ifndef CONTENT_TEST_NET_URL_REQUEST_ABORT_ON_END_JOB_H_
7 #define CONTENT_TEST_NET_URL_REQUEST_ABORT_ON_END_JOB_H_
11 #include "base/basictypes.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/weak_ptr.h"
14 #include "net/url_request/url_request_job.h"
18 // This url request simulates a network error which occurs immediately after
19 // receiving the very first data.
21 class URLRequestAbortOnEndJob
: public net::URLRequestJob
{
23 static const char k400AbortOnEndUrl
[];
25 URLRequestAbortOnEndJob(net::URLRequest
* request
,
26 net::NetworkDelegate
* network_delegate
);
29 virtual void Start() OVERRIDE
;
30 virtual bool GetMimeType(std::string
* mime_type
) const OVERRIDE
;
31 virtual void GetResponseInfo(net::HttpResponseInfo
* info
) OVERRIDE
;
32 virtual bool ReadRawData(net::IOBuffer
* buf
,
34 int* bytes_read
) OVERRIDE
;
36 static void AddUrlHandler();
39 virtual ~URLRequestAbortOnEndJob();
41 void GetResponseInfoConst(net::HttpResponseInfo
* info
) const;
46 base::WeakPtrFactory
<URLRequestAbortOnEndJob
> weak_factory_
;
48 DISALLOW_COPY_AND_ASSIGN(URLRequestAbortOnEndJob
);
51 } // namespace content
53 #endif // CONTENT_TEST_NET_URL_REQUEST_ABORT_ON_END_JOB_H_