| 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/client_connection_manager.h" | 5 #include "blimp/net/client_connection_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using testing::_; | 24 using testing::_; |
| 25 using testing::Eq; | 25 using testing::Eq; |
| 26 using testing::Return; | 26 using testing::Return; |
| 27 using testing::SaveArg; | 27 using testing::SaveArg; |
| 28 | 28 |
| 29 namespace blimp { | 29 namespace blimp { |
| 30 namespace { | 30 namespace { |
| 31 const char kDummyClientToken[] = "dummy-client-token"; | 31 const char kDummyClientAuthToken[] = "dummy-client-token"; |
| 32 } // namespace | 32 } // namespace |
| 33 | 33 |
| 34 class ClientConnectionManagerTest : public testing::Test { | 34 class ClientConnectionManagerTest : public testing::Test { |
| 35 public: | 35 public: |
| 36 ClientConnectionManagerTest() | 36 ClientConnectionManagerTest() |
| 37 : manager_(new ClientConnectionManager(&connection_handler_)), | 37 : manager_(new ClientConnectionManager(&connection_handler_)), |
| 38 transport1_(new testing::StrictMock<MockTransport>), | 38 transport1_(new testing::StrictMock<MockTransport>), |
| 39 transport2_(new testing::StrictMock<MockTransport>), | 39 transport2_(new testing::StrictMock<MockTransport>), |
| 40 reader_(new testing::StrictMock<MockPacketReader>), | 40 reader_(new testing::StrictMock<MockPacketReader>), |
| 41 writer_(new testing::StrictMock<MockPacketWriter>), | 41 writer_(new testing::StrictMock<MockPacketWriter>), |
| 42 start_connection_message_( | 42 start_connection_message_( |
| 43 CreateStartConnectionMessage(kDummyClientToken, kProtocolVersion)) { | 43 CreateStartConnectionMessage(kDummyClientAuthToken, |
| 44 manager_->set_client_token(kDummyClientToken); | 44 kProtocolVersion)) { |
| 45 manager_->set_client_auth_token(kDummyClientAuthToken); |
| 45 } | 46 } |
| 46 | 47 |
| 47 ~ClientConnectionManagerTest() override {} | 48 ~ClientConnectionManagerTest() override {} |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 base::MessageLoop message_loop_; | 51 base::MessageLoop message_loop_; |
| 51 testing::StrictMock<MockConnectionHandler> connection_handler_; | 52 testing::StrictMock<MockConnectionHandler> connection_handler_; |
| 52 std::unique_ptr<ClientConnectionManager> manager_; | 53 std::unique_ptr<ClientConnectionManager> manager_; |
| 53 std::unique_ptr<testing::StrictMock<MockTransport>> transport1_; | 54 std::unique_ptr<testing::StrictMock<MockTransport>> transport1_; |
| 54 std::unique_ptr<testing::StrictMock<MockTransport>> transport2_; | 55 std::unique_ptr<testing::StrictMock<MockTransport>> transport2_; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 manager_->AddTransport(std::move(transport2_)); | 121 manager_->AddTransport(std::move(transport2_)); |
| 121 manager_->Connect(); | 122 manager_->Connect(); |
| 122 EXPECT_FALSE(connect_cb_1.is_null()); | 123 EXPECT_FALSE(connect_cb_1.is_null()); |
| 123 EXPECT_TRUE(connect_cb_2.is_null()); | 124 EXPECT_TRUE(connect_cb_2.is_null()); |
| 124 base::ResetAndReturn(&connect_cb_1).Run(net::ERR_FAILED); | 125 base::ResetAndReturn(&connect_cb_1).Run(net::ERR_FAILED); |
| 125 EXPECT_FALSE(connect_cb_2.is_null()); | 126 EXPECT_FALSE(connect_cb_2.is_null()); |
| 126 base::ResetAndReturn(&connect_cb_2).Run(net::ERR_FAILED); | 127 base::ResetAndReturn(&connect_cb_2).Run(net::ERR_FAILED); |
| 127 } | 128 } |
| 128 | 129 |
| 129 } // namespace blimp | 130 } // namespace blimp |
| OLD | NEW |