blob: 84d87a7a3d3db68e209673496c7a2e1af88c1a91 [file] [log] [blame]
// Copyright 2014 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.
#include "base/memory/scoped_ptr.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 HttpCache;
class HttpNetworkSession;
// Creates transactions that always (asynchronously) return a specified
// error. The error is returned asynchronously, just after the transaction is
// started.
class NET_EXPORT FailingHttpTransactionFactory : public HttpTransactionFactory {
// The caller must guarantee that |session| outlives this object.
FailingHttpTransactionFactory(HttpNetworkSession* session, Error error);
virtual ~FailingHttpTransactionFactory();
// HttpTransactionFactory:
virtual int CreateTransaction(
RequestPriority priority,
scoped_ptr<HttpTransaction>* trans) OVERRIDE;
virtual HttpCache* GetCache() OVERRIDE;
virtual HttpNetworkSession* GetSession() OVERRIDE;
HttpNetworkSession* session_;
Error error_;
} // namespace net