OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "base/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "jingle/glue/channel_socket_adapter.h" | 8 #include "jingle/glue/channel_socket_adapter.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 class TransportChannelSocketAdapterTest : public testing::Test { | 60 class TransportChannelSocketAdapterTest : public testing::Test { |
61 public: | 61 public: |
62 TransportChannelSocketAdapterTest() | 62 TransportChannelSocketAdapterTest() |
63 : callback_(base::Bind(&TransportChannelSocketAdapterTest::Callback, | 63 : callback_(base::Bind(&TransportChannelSocketAdapterTest::Callback, |
64 base::Unretained(this))), | 64 base::Unretained(this))), |
65 callback_result_(0) { | 65 callback_result_(0) { |
66 } | 66 } |
67 | 67 |
68 protected: | 68 protected: |
69 virtual void SetUp() { | 69 void SetUp() override { |
70 target_.reset(new TransportChannelSocketAdapter(&channel_)); | 70 target_.reset(new TransportChannelSocketAdapter(&channel_)); |
71 } | 71 } |
72 | 72 |
73 void Callback(int result) { | 73 void Callback(int result) { |
74 callback_result_ = result; | 74 callback_result_ = result; |
75 } | 75 } |
76 | 76 |
77 MockTransportChannel channel_; | 77 MockTransportChannel channel_; |
78 scoped_ptr<TransportChannelSocketAdapter> target_; | 78 scoped_ptr<TransportChannelSocketAdapter> target_; |
79 net::CompletionCallback callback_; | 79 net::CompletionCallback callback_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 .WillOnce(Return(SOCKET_ERROR)); | 128 .WillOnce(Return(SOCKET_ERROR)); |
129 | 129 |
130 EXPECT_CALL(channel_, GetError()) | 130 EXPECT_CALL(channel_, GetError()) |
131 .WillOnce(Return(EWOULDBLOCK)); | 131 .WillOnce(Return(EWOULDBLOCK)); |
132 | 132 |
133 int result = target_->Write(buffer.get(), kTestDataSize, callback_); | 133 int result = target_->Write(buffer.get(), kTestDataSize, callback_); |
134 ASSERT_EQ(net::OK, result); | 134 ASSERT_EQ(net::OK, result); |
135 } | 135 } |
136 | 136 |
137 } // namespace jingle_glue | 137 } // namespace jingle_glue |
OLD | NEW |