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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "blimp/common/proto/blimp_message.pb.h" | 10 #include "blimp/common/proto/blimp_message.pb.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 namespace { | 28 namespace { |
29 | 29 |
30 class BlimpConnectionTest : public testing::Test { | 30 class BlimpConnectionTest : public testing::Test { |
31 public: | 31 public: |
32 BlimpConnectionTest() { | 32 BlimpConnectionTest() { |
33 scoped_ptr<testing::StrictMock<MockPacketWriter>> writer( | 33 scoped_ptr<testing::StrictMock<MockPacketWriter>> writer( |
34 new testing::StrictMock<MockPacketWriter>); | 34 new testing::StrictMock<MockPacketWriter>); |
35 writer_ = writer.get(); | 35 writer_ = writer.get(); |
36 connection_.reset(new BlimpConnection(make_scoped_ptr(new MockPacketReader), | 36 connection_.reset(new BlimpConnection(make_scoped_ptr(new MockPacketReader), |
37 std::move(writer))); | 37 std::move(writer))); |
38 connection_->SetConnectionErrorObserver(&error_observer_); | 38 connection_->AddConnectionErrorObserver(&error_observer_); |
haibinlu
2016/01/04 19:45:45
add 2 error observers.
Kevin M
2016/01/04 20:42:13
Added 3 and removed 1 to test the logic for adding
| |
39 } | 39 } |
40 | 40 |
41 ~BlimpConnectionTest() override {} | 41 ~BlimpConnectionTest() override {} |
42 | 42 |
43 protected: | 43 protected: |
44 scoped_ptr<BlimpMessage> CreateInputMessage() { | 44 scoped_ptr<BlimpMessage> CreateInputMessage() { |
45 scoped_ptr<BlimpMessage> msg(new BlimpMessage); | 45 scoped_ptr<BlimpMessage> msg(new BlimpMessage); |
46 msg->set_type(BlimpMessage::INPUT); | 46 msg->set_type(BlimpMessage::INPUT); |
47 return msg; | 47 return msg; |
48 } | 48 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 | 117 |
118 net::TestCompletionCallback complete_cb_2; | 118 net::TestCompletionCallback complete_cb_2; |
119 sender->ProcessMessage(CreateControlMessage(), | 119 sender->ProcessMessage(CreateControlMessage(), |
120 complete_cb_2.callback()); | 120 complete_cb_2.callback()); |
121 base::ResetAndReturn(&write_packet_cb).Run(net::ERR_FAILED); | 121 base::ResetAndReturn(&write_packet_cb).Run(net::ERR_FAILED); |
122 EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult()); | 122 EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult()); |
123 } | 123 } |
124 | 124 |
125 } // namespace | 125 } // namespace |
126 } // namespace blimp | 126 } // namespace blimp |
OLD | NEW |