Index: blimp/net/blimp_connection_unittest.cc |
diff --git a/blimp/net/blimp_connection_unittest.cc b/blimp/net/blimp_connection_unittest.cc |
index ee04e92c86508d450bb281e42448bb6f5963dc17..b11dde8e882eae1772d596ce3268405efcb16828 100644 |
--- a/blimp/net/blimp_connection_unittest.cc |
+++ b/blimp/net/blimp_connection_unittest.cc |
@@ -37,6 +37,8 @@ class BlimpConnectionTest : public testing::Test { |
std::unique_ptr<testing::StrictMock<MockPacketWriter>> writer( |
new testing::StrictMock<MockPacketWriter>); |
writer_ = writer.get(); |
+ std::unique_ptr<testing::StrictMock<MockPacketWriter>> reader( |
+ new testing::StrictMock<MockPacketWriter>); |
connection_.reset(new BlimpConnection( |
base::WrapUnique(new MockPacketReader), std::move(writer))); |
connection_->AddConnectionErrorObserver(&error_observer1_); |
@@ -84,6 +86,9 @@ TEST_F(BlimpConnectionTest, AsyncTwoPacketsWrite) { |
WritePacket(BufferEqualsProto(*CreateControlMessage()), _)) |
.WillOnce(SaveArg<1>(&write_packet_cb)) |
.RetiresOnSaturation(); |
+ EXPECT_CALL(error_observer1_, OnConnectionError(_)).Times(0); |
+ EXPECT_CALL(error_observer2_, OnConnectionError(_)).Times(0); |
+ EXPECT_CALL(error_observer3_, OnConnectionError(_)).Times(0); |
BlimpMessageProcessor* sender = connection_->GetOutgoingMessageProcessor(); |
net::TestCompletionCallback complete_cb_1; |
@@ -119,6 +124,7 @@ TEST_F(BlimpConnectionTest, AsyncTwoPacketsWriteWithError) { |
.RetiresOnSaturation(); |
EXPECT_CALL(error_observer1_, OnConnectionError(net::ERR_FAILED)); |
EXPECT_CALL(error_observer2_, OnConnectionError(net::ERR_FAILED)); |
+ EXPECT_CALL(error_observer3_, OnConnectionError(_)).Times(0); |
BlimpMessageProcessor* sender = connection_->GetOutgoingMessageProcessor(); |
net::TestCompletionCallback complete_cb_1; |
@@ -134,5 +140,13 @@ TEST_F(BlimpConnectionTest, AsyncTwoPacketsWriteWithError) { |
EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult()); |
} |
+// Verifies that EndConnection messages received from the peer are |
+// routed through to registered ConnectionErrorObservers as errors. |
+TEST_F(BlimpConnectionTest, EndConnectionInvokesErrorObservers) { |
+ // XXX test of how EndConnection messages are processed goes here. |
Kevin M
2016/05/25 21:19:19
Is this a TODO for this CL or for a followup? If i
Wez
2016/05/25 23:11:37
TODO for this CL; wanted to get your input on whet
|
+ // XXX we should also have a test that we invoke error observers on read |
+ // failures! |
+} |
+ |
} // namespace |
} // namespace blimp |