Pass CreateDirectory errors up to IndexedDB.
[chromium-blink-merge.git] / net / http / http_pipelined_host_test_util.h
blob245ff02c4d58109477f21559a1e1b50a90c164d4
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.
5 #include "net/http/http_pipelined_connection.h"
6 #include "net/http/http_pipelined_host.h"
7 #include "testing/gmock/include/gmock/gmock.h"
9 namespace net {
11 class MockHostDelegate : public HttpPipelinedHost::Delegate {
12 public:
13 MockHostDelegate();
14 virtual ~MockHostDelegate();
16 MOCK_METHOD1(OnHostIdle, void(HttpPipelinedHost* host));
17 MOCK_METHOD1(OnHostHasAdditionalCapacity, void(HttpPipelinedHost* host));
18 MOCK_METHOD2(OnHostDeterminedCapability,
19 void(HttpPipelinedHost* host,
20 HttpPipelinedHostCapability capability));
23 class MockPipelineFactory : public HttpPipelinedConnection::Factory {
24 public:
25 MockPipelineFactory();
26 virtual ~MockPipelineFactory();
28 MOCK_METHOD8(CreateNewPipeline, HttpPipelinedConnection*(
29 ClientSocketHandle* connection,
30 HttpPipelinedConnection::Delegate* delegate,
31 const HostPortPair& origin,
32 const SSLConfig& used_ssl_config,
33 const ProxyInfo& used_proxy_info,
34 const BoundNetLog& net_log,
35 bool was_npn_negotiated,
36 NextProto protocol_negotiated));
39 class MockPipeline : public HttpPipelinedConnection {
40 public:
41 MockPipeline(int depth, bool usable, bool active);
42 virtual ~MockPipeline();
44 void SetState(int depth, bool usable, bool active) {
45 depth_ = depth;
46 usable_ = usable;
47 active_ = active;
50 virtual int depth() const OVERRIDE { return depth_; }
51 virtual bool usable() const OVERRIDE { return usable_; }
52 virtual bool active() const OVERRIDE { return active_; }
54 MOCK_METHOD0(CreateNewStream, HttpPipelinedStream*());
55 MOCK_METHOD1(OnStreamDeleted, void(int pipeline_id));
56 MOCK_CONST_METHOD0(used_ssl_config, const SSLConfig&());
57 MOCK_CONST_METHOD0(used_proxy_info, const ProxyInfo&());
58 MOCK_CONST_METHOD0(net_log, const BoundNetLog&());
59 MOCK_CONST_METHOD0(was_npn_negotiated, bool());
60 MOCK_CONST_METHOD0(protocol_negotiated, NextProto());
62 private:
63 int depth_;
64 bool usable_;
65 bool active_;
68 MATCHER_P(MatchesOrigin, expected, "") { return expected.Equals(arg); }
70 } // namespace net