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

Unified Diff: blimp/net/client_connection_manager_unittest.cc

Issue 1501463003: [Blimp Net] Client sends START_CONNECTION message (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses wez's comments. Created 5 years 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/client_connection_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/net/client_connection_manager_unittest.cc
diff --git a/blimp/net/client_connection_manager_unittest.cc b/blimp/net/client_connection_manager_unittest.cc
index 31d6a2bffffa198a41decebf4e9c231461f1a2f6..3aba2c849d8e86caef60f5f2ca4174ae4ca15352 100644
--- a/blimp/net/client_connection_manager_unittest.cc
+++ b/blimp/net/client_connection_manager_unittest.cc
@@ -7,6 +7,9 @@
#include "base/callback_helpers.h"
#include "base/message_loop/message_loop.h"
+#include "blimp/common/create_blimp_message.h"
+#include "blimp/common/proto/blimp_message.pb.h"
+#include "blimp/common/protocol_version.h"
#include "blimp/net/blimp_connection.h"
#include "blimp/net/blimp_transport.h"
#include "blimp/net/client_connection_manager.h"
@@ -30,9 +33,12 @@ class ClientConnectionManagerTest : public testing::Test {
: manager_(new ClientConnectionManager(&connection_handler_)),
transport1_(new testing::StrictMock<MockTransport>),
transport2_(new testing::StrictMock<MockTransport>),
- connection_(
- new BlimpConnection(make_scoped_ptr(new MockPacketReader),
- make_scoped_ptr(new MockPacketWriter))) {}
+ reader_(new MockPacketReader),
+ writer_(new MockPacketWriter),
+ connection_(new BlimpConnection(make_scoped_ptr(reader_),
+ make_scoped_ptr(writer_))),
+ start_connection_message_(
+ CreateStartConnectionMessage("", kProtocolVersion)) {}
~ClientConnectionManagerTest() override {}
@@ -42,7 +48,10 @@ class ClientConnectionManagerTest : public testing::Test {
scoped_ptr<ClientConnectionManager> manager_;
scoped_ptr<testing::StrictMock<MockTransport>> transport1_;
scoped_ptr<testing::StrictMock<MockTransport>> transport2_;
+ MockPacketReader* reader_;
+ MockPacketWriter* writer_;
scoped_ptr<BlimpConnection> connection_;
+ scoped_ptr<BlimpMessage> start_connection_message_;
};
// The 1st transport connects, and the 2nd transport is not used.
@@ -50,6 +59,8 @@ TEST_F(ClientConnectionManagerTest, FirstTransportConnects) {
net::CompletionCallback connect_cb_1;
EXPECT_CALL(*transport1_, Connect(_)).WillOnce(SaveArg<0>(&connect_cb_1));
EXPECT_CALL(connection_handler_, HandleConnectionPtr(Eq(connection_.get())));
+ EXPECT_CALL(*writer_,
+ WritePacket(BufferEqualsProto(*start_connection_message_), _));
EXPECT_CALL(*transport1_, TakeConnectionPtr())
.WillOnce(Return(connection_.release()));
@@ -67,6 +78,8 @@ TEST_F(ClientConnectionManagerTest, SecondTransportConnects) {
EXPECT_CALL(*transport1_, Connect(_)).WillOnce(SaveArg<0>(&connect_cb_1));
net::CompletionCallback connect_cb_2;
EXPECT_CALL(*transport2_, Connect(_)).WillOnce(SaveArg<0>(&connect_cb_2));
+ EXPECT_CALL(*writer_,
+ WritePacket(BufferEqualsProto(*start_connection_message_), _));
EXPECT_CALL(connection_handler_, HandleConnectionPtr(Eq(connection_.get())));
EXPECT_CALL(*transport2_, TakeConnectionPtr())
.WillOnce(Return(connection_.release()));
« no previous file with comments | « blimp/net/client_connection_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698