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

Side by Side Diff: net/http/http_pipelined_host_test_util.h

Issue 9433015: Add a force pipelining option to load flags. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: More tests Created 8 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2012 Google Inc. All Rights Reserved.
2 // Author: simonjam@google.com (James Simonsen)
3
4 #include "net/http/http_pipelined_connection.h"
5 #include "net/http/http_pipelined_host.h"
6 #include "testing/gmock/include/gmock/gmock.h"
7
8 namespace net {
9
10 class MockHostDelegate : public HttpPipelinedHost::Delegate {
11 public:
12 MockHostDelegate();
13 virtual ~MockHostDelegate();
14
15 MOCK_METHOD1(OnHostIdle, void(HttpPipelinedHost* host));
16 MOCK_METHOD1(OnHostHasAdditionalCapacity, void(HttpPipelinedHost* host));
17 MOCK_METHOD2(OnHostDeterminedCapability,
18 void(HttpPipelinedHost* host,
19 HttpPipelinedHostCapability capability));
20 };
21
22 class MockPipelineFactory : public HttpPipelinedConnection::Factory {
23 public:
24 MockPipelineFactory();
25 virtual ~MockPipelineFactory();
26
27 MOCK_METHOD8(CreateNewPipeline, HttpPipelinedConnection*(
28 ClientSocketHandle* connection,
29 HttpPipelinedConnection::Delegate* delegate,
30 const HostPortPair& origin,
31 const SSLConfig& used_ssl_config,
32 const ProxyInfo& used_proxy_info,
33 const BoundNetLog& net_log,
34 bool was_npn_negotiated,
35 SSLClientSocket::NextProto protocol_negotiated));
36 };
37
38 class MockPipeline : public HttpPipelinedConnection {
39 public:
40 MockPipeline(int depth, bool usable, bool active);
41 virtual ~MockPipeline();
42
43 void SetState(int depth, bool usable, bool active) {
44 depth_ = depth;
45 usable_ = usable;
46 active_ = active;
47 }
48
49 virtual int depth() const OVERRIDE { return depth_; }
50 virtual bool usable() const OVERRIDE { return usable_; }
51 virtual bool active() const OVERRIDE { return active_; }
52
53 MOCK_METHOD0(CreateNewStream, HttpPipelinedStream*());
54 MOCK_METHOD1(OnStreamDeleted, void(int pipeline_id));
55 MOCK_CONST_METHOD0(used_ssl_config, const SSLConfig&());
56 MOCK_CONST_METHOD0(used_proxy_info, const ProxyInfo&());
57 MOCK_CONST_METHOD0(net_log, const BoundNetLog&());
58 MOCK_CONST_METHOD0(was_npn_negotiated, bool());
59 MOCK_CONST_METHOD0(protocol_negotiated, SSLClientSocket::NextProto());
60
61 private:
62 int depth_;
63 bool usable_;
64 bool active_;
65 };
66
67 MATCHER_P(MatchesOrigin, expected, "") { return expected.Equals(arg); }
68
69 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698