OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "blimp/net/test_common.h" | 5 #include "blimp/net/test_common.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/sys_byteorder.h" | 9 #include "base/sys_byteorder.h" |
10 #include "blimp/common/proto/blimp_message.pb.h" | 10 #include "blimp/common/proto/blimp_message.pb.h" |
11 #include "blimp/net/blimp_connection.h" | 11 #include "blimp/net/blimp_connection.h" |
12 #include "blimp/net/common.h" | 12 #include "blimp/net/common.h" |
13 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
14 | 14 |
15 namespace blimp { | 15 namespace blimp { |
16 | 16 |
17 MockStreamSocket::MockStreamSocket() {} | 17 MockStreamSocket::MockStreamSocket() {} |
18 | 18 |
19 MockStreamSocket::~MockStreamSocket() {} | 19 MockStreamSocket::~MockStreamSocket() {} |
20 | 20 |
21 MockTransport::MockTransport() {} | 21 MockTransport::MockTransport() {} |
22 | 22 |
23 MockTransport::~MockTransport() {} | 23 MockTransport::~MockTransport() {} |
24 | 24 |
25 scoped_ptr<BlimpConnection> MockTransport::TakeConnection() { | 25 scoped_ptr<BlimpConnection> MockTransport::TakeConnection() { |
26 return make_scoped_ptr(TakeConnectionPtr()); | 26 return make_scoped_ptr(TakeConnectionPtr()); |
27 } | 27 } |
28 | 28 |
29 const std::string MockTransport::GetName() const { | 29 const char* MockTransport::GetName() const { |
30 return "mock"; | 30 return "mock"; |
31 } | 31 } |
32 | 32 |
33 MockConnectionHandler::MockConnectionHandler() {} | 33 MockConnectionHandler::MockConnectionHandler() {} |
34 | 34 |
35 MockConnectionHandler::~MockConnectionHandler() {} | 35 MockConnectionHandler::~MockConnectionHandler() {} |
36 | 36 |
37 void MockConnectionHandler::HandleConnection( | 37 void MockConnectionHandler::HandleConnection( |
38 scoped_ptr<BlimpConnection> connection) { | 38 scoped_ptr<BlimpConnection> connection) { |
39 HandleConnectionPtr(connection.get()); | 39 HandleConnectionPtr(connection.get()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 memcpy(serialized.get(), &net_size, sizeof(net_size)); | 71 memcpy(serialized.get(), &net_size, sizeof(net_size)); |
72 return std::string(serialized.get(), kPacketHeaderSizeBytes); | 72 return std::string(serialized.get(), kPacketHeaderSizeBytes); |
73 } | 73 } |
74 | 74 |
75 bool BufferStartsWith(net::GrowableIOBuffer* buf, const std::string& str) { | 75 bool BufferStartsWith(net::GrowableIOBuffer* buf, const std::string& str) { |
76 return (static_cast<size_t>(buf->capacity()) > str.size() && | 76 return (static_cast<size_t>(buf->capacity()) > str.size() && |
77 str == std::string(buf->StartOfBuffer(), str.size())); | 77 str == std::string(buf->StartOfBuffer(), str.size())); |
78 } | 78 } |
79 | 79 |
80 } // namespace blimp | 80 } // namespace blimp |
OLD | NEW |