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

Unified Diff: blimp/net/blimp_connection_unittest.cc

Issue 1909143002: Use ConnectionErrorObserver, not callbacks, for error handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/net/blimp_connection.cc ('k') | blimp/net/blimp_message_output_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..76683299c29eeba07dc4d4390a069c2f093be7aa 100644
--- a/blimp/net/blimp_connection_unittest.cc
+++ b/blimp/net/blimp_connection_unittest.cc
@@ -47,6 +47,8 @@ class BlimpConnectionTest : public testing::Test {
~BlimpConnectionTest() override {}
+ void DropConnection() { connection_.reset(); }
+
protected:
std::unique_ptr<BlimpMessage> CreateInputMessage() {
InputMessage* input;
@@ -134,5 +136,25 @@ TEST_F(BlimpConnectionTest, AsyncTwoPacketsWriteWithError) {
EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult());
}
+TEST_F(BlimpConnectionTest, DeleteHappyObserversAreOK) {
+ net::CompletionCallback write_packet_cb;
+
+ InSequence s;
+ EXPECT_CALL(*writer_,
+ WritePacket(BufferEqualsProto(*CreateInputMessage()), _))
+ .WillOnce(SaveArg<1>(&write_packet_cb))
+ .RetiresOnSaturation();
+ EXPECT_CALL(error_observer1_, OnConnectionError(net::ERR_FAILED))
+ .WillOnce(testing::InvokeWithoutArgs(
+ this, &BlimpConnectionTest::DropConnection));
+
+ BlimpMessageProcessor* sender = connection_->GetOutgoingMessageProcessor();
+ net::TestCompletionCallback complete_cb_1;
+ sender->ProcessMessage(CreateInputMessage(),
+ complete_cb_1.callback());
+ base::ResetAndReturn(&write_packet_cb).Run(net::ERR_FAILED);
+ EXPECT_EQ(net::ERR_FAILED, complete_cb_1.WaitForResult());
+}
+
} // namespace
} // namespace blimp
« no previous file with comments | « blimp/net/blimp_connection.cc ('k') | blimp/net/blimp_message_output_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698