Index: blimp/net/tcp_connection_unittest.cc |
diff --git a/blimp/net/blimp_connection_unittest.cc b/blimp/net/tcp_connection_unittest.cc |
similarity index 91% |
rename from blimp/net/blimp_connection_unittest.cc |
rename to blimp/net/tcp_connection_unittest.cc |
index 681ea2b77be4ab9030c39962aeb3343bcd665bcf..330ff4e9dedaa9614c10121b6a653f1a35396f2c 100644 |
--- a/blimp/net/blimp_connection_unittest.cc |
+++ b/blimp/net/tcp_connection_unittest.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "blimp/net/blimp_connection.h" |
+#include "blimp/net/tcp_connection.h" |
#include <stddef.h> |
@@ -17,6 +17,7 @@ |
#include "blimp/net/common.h" |
#include "blimp/net/connection_error_observer.h" |
#include "blimp/net/message_port.h" |
+#include "blimp/net/tcp_connection.h" |
#include "blimp/net/test_common.h" |
#include "net/base/completion_callback.h" |
#include "net/base/io_buffer.h" |
@@ -33,6 +34,9 @@ using testing::SaveArg; |
namespace blimp { |
namespace { |
+// NOTE: TCPConnection and BlimpConnection will soon be replaced with a |
+// pure-gRPC implementation. So not adding more unit-tests here. Instead, |
+// we are reusing TCPConnection as the implementation under test here. |
Garrett Casto
2016/10/25 18:33:50
Nit: Not sure if you need this disclaimer since yo
perumaal
2016/10/25 23:02:40
I avoided renaming BlimpConnectionTest but you are
|
class BlimpConnectionTest : public testing::Test { |
public: |
BlimpConnectionTest() { |
@@ -40,9 +44,8 @@ class BlimpConnectionTest : public testing::Test { |
std::unique_ptr<MockPacketWriter> mock_writer(new MockPacketWriter); |
mock_reader_ = mock_reader.get(); |
mock_writer_ = mock_writer.get(); |
- connection_ = |
- base::MakeUnique<BlimpConnection>(base::MakeUnique<MessagePort>( |
- std::move(mock_reader), std::move(mock_writer))); |
+ connection_ = base::MakeUnique<TCPConnection>(base::MakeUnique<MessagePort>( |
+ std::move(mock_reader), std::move(mock_writer))); |
connection_->AddConnectionErrorObserver(&error_observer1_); |
connection_->AddConnectionErrorObserver(&error_observer2_); |
@@ -99,16 +102,14 @@ TEST_F(BlimpConnectionTest, AsyncTwoPacketsWrite) { |
BlimpMessageProcessor* sender = connection_->GetOutgoingMessageProcessor(); |
net::TestCompletionCallback complete_cb_1; |
ASSERT_TRUE(write_packet_cb.is_null()); |
- sender->ProcessMessage(CreateInputMessage(), |
- complete_cb_1.callback()); |
+ sender->ProcessMessage(CreateInputMessage(), complete_cb_1.callback()); |
ASSERT_FALSE(write_packet_cb.is_null()); |
base::ResetAndReturn(&write_packet_cb).Run(net::OK); |
EXPECT_EQ(net::OK, complete_cb_1.WaitForResult()); |
net::TestCompletionCallback complete_cb_2; |
ASSERT_TRUE(write_packet_cb.is_null()); |
- sender->ProcessMessage(CreateControlMessage(), |
- complete_cb_2.callback()); |
+ sender->ProcessMessage(CreateControlMessage(), complete_cb_2.callback()); |
ASSERT_FALSE(write_packet_cb.is_null()); |
base::ResetAndReturn(&write_packet_cb).Run(net::OK); |
EXPECT_EQ(net::OK, complete_cb_2.WaitForResult()); |
@@ -134,14 +135,12 @@ TEST_F(BlimpConnectionTest, AsyncTwoPacketsWriteWithError) { |
BlimpMessageProcessor* sender = connection_->GetOutgoingMessageProcessor(); |
net::TestCompletionCallback complete_cb_1; |
- sender->ProcessMessage(CreateInputMessage(), |
- complete_cb_1.callback()); |
+ sender->ProcessMessage(CreateInputMessage(), complete_cb_1.callback()); |
base::ResetAndReturn(&write_packet_cb).Run(net::OK); |
EXPECT_EQ(net::OK, complete_cb_1.WaitForResult()); |
net::TestCompletionCallback complete_cb_2; |
- sender->ProcessMessage(CreateControlMessage(), |
- complete_cb_2.callback()); |
+ sender->ProcessMessage(CreateControlMessage(), complete_cb_2.callback()); |
base::ResetAndReturn(&write_packet_cb).Run(net::ERR_FAILED); |
EXPECT_EQ(net::ERR_FAILED, complete_cb_2.WaitForResult()); |
} |