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

Side by Side Diff: blimp/net/test_common.cc

Issue 2439403003: Refactor BlimpConnection to TCPConnection (Closed)
Patch Set: Added missing Engine Transport Created 4 years, 1 month 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
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 #include <utility>
8 9
9 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
10 #include "base/sys_byteorder.h" 11 #include "base/sys_byteorder.h"
11 #include "blimp/common/proto/blimp_message.pb.h" 12 #include "blimp/common/proto/blimp_message.pb.h"
12 #include "blimp/net/blimp_connection.h" 13 #include "blimp/net/blimp_connection.h"
13 #include "blimp/net/common.h" 14 #include "blimp/net/common.h"
14 #include "blimp/net/message_port.h" 15 #include "blimp/net/message_port.h"
15 #include "net/base/io_buffer.h" 16 #include "net/base/io_buffer.h"
16 17
17 namespace blimp { 18 namespace blimp {
18 19
19 MockStreamSocket::MockStreamSocket() {} 20 MockStreamSocket::MockStreamSocket() {}
20 21
21 MockStreamSocket::~MockStreamSocket() {} 22 MockStreamSocket::~MockStreamSocket() {}
22 23
23 MockTransport::MockTransport() {} 24 MockTransport::MockTransport() {}
24 25
26 std::unique_ptr<BlimpConnection> MockTransport::MakeConnection() {
27 return std::move(connection_);
28 }
29
30 void MockTransport::SetMockConnection(
31 std::unique_ptr<MockBlimpConnection> connection) {
32 connection_ = std::move(connection);
33 }
34
25 MockTransport::~MockTransport() {} 35 MockTransport::~MockTransport() {}
26 36
27 std::unique_ptr<MessagePort> MockTransport::TakeMessagePort() {
28 return base::WrapUnique(TakeMessagePortPtr());
29 }
30
31 const char* MockTransport::GetName() const { 37 const char* MockTransport::GetName() const {
32 return "mock"; 38 return "mock";
33 } 39 }
34 40
35 MockConnectionHandler::MockConnectionHandler() {} 41 MockConnectionHandler::MockConnectionHandler() {}
36 42
37 MockConnectionHandler::~MockConnectionHandler() {} 43 MockConnectionHandler::~MockConnectionHandler() {}
38 44
39 void MockConnectionHandler::HandleConnection( 45 void MockConnectionHandler::HandleConnection(
40 std::unique_ptr<BlimpConnection> connection) { 46 std::unique_ptr<BlimpConnection> connection) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 81 }
76 82
77 bool BufferStartsWith(net::GrowableIOBuffer* buf, 83 bool BufferStartsWith(net::GrowableIOBuffer* buf,
78 size_t buf_size, 84 size_t buf_size,
79 const std::string& str) { 85 const std::string& str) {
80 return (buf_size >= str.size() && 86 return (buf_size >= str.size() &&
81 str == std::string(buf->data(), str.size())); 87 str == std::string(buf->data(), str.size()));
82 } 88 }
83 89
84 } // namespace blimp 90 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698