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/blimp_connection.h" | 5 #include "blimp/net/blimp_connection.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 connection_->AddConnectionErrorObserver(&error_observer2_); | 42 connection_->AddConnectionErrorObserver(&error_observer2_); |
43 connection_->AddConnectionErrorObserver(&error_observer3_); | 43 connection_->AddConnectionErrorObserver(&error_observer3_); |
44 connection_->RemoveConnectionErrorObserver(&error_observer3_); | 44 connection_->RemoveConnectionErrorObserver(&error_observer3_); |
45 } | 45 } |
46 | 46 |
47 ~BlimpConnectionTest() override {} | 47 ~BlimpConnectionTest() override {} |
48 | 48 |
49 protected: | 49 protected: |
50 std::unique_ptr<BlimpMessage> CreateInputMessage() { | 50 std::unique_ptr<BlimpMessage> CreateInputMessage() { |
51 std::unique_ptr<BlimpMessage> msg(new BlimpMessage); | 51 std::unique_ptr<BlimpMessage> msg(new BlimpMessage); |
52 msg->set_type(BlimpMessage::INPUT); | 52 msg->mutable_input(); |
53 return msg; | 53 return msg; |
54 } | 54 } |
55 | 55 |
56 std::unique_ptr<BlimpMessage> CreateControlMessage() { | 56 std::unique_ptr<BlimpMessage> CreateControlMessage() { |
57 std::unique_ptr<BlimpMessage> msg(new BlimpMessage); | 57 std::unique_ptr<BlimpMessage> msg(new BlimpMessage); |
58 msg->set_type(BlimpMessage::TAB_CONTROL); | 58 msg->mutable_tab_control(); |
59 return msg; | 59 return msg; |
60 } | 60 } |
61 | 61 |
62 base::MessageLoop message_loop_; | 62 base::MessageLoop message_loop_; |
63 testing::StrictMock<MockPacketWriter>* writer_; | 63 testing::StrictMock<MockPacketWriter>* writer_; |
64 testing::StrictMock<MockConnectionErrorObserver> error_observer1_; | 64 testing::StrictMock<MockConnectionErrorObserver> error_observer1_; |
65 testing::StrictMock<MockConnectionErrorObserver> error_observer2_; | 65 testing::StrictMock<MockConnectionErrorObserver> error_observer2_; |
66 | 66 |
67 // This error observer is Removed() immediately after it's added; | 67 // This error observer is Removed() immediately after it's added; |
68 // it should never be called. | 68 // it should never be called. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 net::TestCompletionCallback complete_cb_2; | 131 net::TestCompletionCallback complete_cb_2; |
132 sender->ProcessMessage(CreateControlMessage(), | 132 sender->ProcessMessage(CreateControlMessage(), |
133 complete_cb_2.callback()); | 133 complete_cb_2.callback()); |
134 base::ResetAndReturn(&write_packet_cb).Run(net::ERR_FAILED); | 134 base::ResetAndReturn(&write_packet_cb).Run(net::ERR_FAILED); |
135 EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult()); | 135 EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult()); |
136 } | 136 } |
137 | 137 |
138 } // namespace | 138 } // namespace |
139 } // namespace blimp | 139 } // namespace blimp |
OLD | NEW |