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

Side by Side Diff: blimp/net/ssl_client_transport_unittest.cc

Issue 1962393004: Added a debug info UI for Blimp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added empty implementation for linux client 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 unified diff | Download patch
« no previous file with comments | « blimp/net/ssl_client_transport.cc ('k') | blimp/net/stream_packet_reader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "blimp/net/blimp_connection.h" 8 #include "blimp/net/blimp_connection.h"
9 #include "blimp/net/blimp_connection_statistics.h"
9 #include "blimp/net/ssl_client_transport.h" 10 #include "blimp/net/ssl_client_transport.h"
10 #include "net/base/address_list.h" 11 #include "net/base/address_list.h"
11 #include "net/base/ip_address.h" 12 #include "net/base/ip_address.h"
12 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
13 #include "net/socket/socket_test_util.h" 14 #include "net/socket/socket_test_util.h"
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 17
17 namespace blimp { 18 namespace blimp {
18 namespace { 19 namespace {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } 54 }
54 55
55 void SetupSSLAsyncSocketConnect(int result) { 56 void SetupSSLAsyncSocketConnect(int result) {
56 ssl_connect_.reset(new net::SSLSocketDataProvider(net::ASYNC, result)); 57 ssl_connect_.reset(new net::SSLSocketDataProvider(net::ASYNC, result));
57 socket_factory_.AddSSLSocketDataProvider(ssl_connect_.get()); 58 socket_factory_.AddSSLSocketDataProvider(ssl_connect_.get());
58 } 59 }
59 60
60 void ConfigureTransport(const net::IPEndPoint& ip_endpoint) { 61 void ConfigureTransport(const net::IPEndPoint& ip_endpoint) {
61 // The mock does not interact with the cert directly, so just leave it null. 62 // The mock does not interact with the cert directly, so just leave it null.
62 scoped_refptr<net::X509Certificate> cert; 63 scoped_refptr<net::X509Certificate> cert;
63 transport_.reset(new SSLClientTransport(ip_endpoint, cert, &net_log_)); 64 transport_.reset(
65 new SSLClientTransport(ip_endpoint, cert, &statistics_, &net_log_));
64 transport_->SetClientSocketFactoryForTest(&socket_factory_); 66 transport_->SetClientSocketFactoryForTest(&socket_factory_);
65 } 67 }
66 68
67 base::MessageLoop message_loop; 69 base::MessageLoop message_loop;
70 BlimpConnectionStatistics statistics_;
68 net::NetLog net_log_; 71 net::NetLog net_log_;
69 net::StaticSocketDataProvider tcp_connect_; 72 net::StaticSocketDataProvider tcp_connect_;
70 std::unique_ptr<net::SSLSocketDataProvider> ssl_connect_; 73 std::unique_ptr<net::SSLSocketDataProvider> ssl_connect_;
71 net::MockClientSocketFactory socket_factory_; 74 net::MockClientSocketFactory socket_factory_;
72 std::unique_ptr<SSLClientTransport> transport_; 75 std::unique_ptr<SSLClientTransport> transport_;
73 }; 76 };
74 77
75 TEST_F(SSLClientTransportTest, ConnectSyncOK) { 78 TEST_F(SSLClientTransportTest, ConnectSyncOK) {
76 net::IPEndPoint endpoint(kIPV4Address, kPort); 79 net::IPEndPoint endpoint(kIPV4Address, kPort);
77 ConfigureTransport(endpoint); 80 ConfigureTransport(endpoint);
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 EXPECT_CALL(*this, ConnectComplete(net::OK)); 156 EXPECT_CALL(*this, ConnectComplete(net::OK));
154 SetupTCPSyncSocketConnect(endpoint, net::OK); 157 SetupTCPSyncSocketConnect(endpoint, net::OK);
155 SetupSSLSyncSocketConnect(net::OK); 158 SetupSSLSyncSocketConnect(net::OK);
156 transport_->Connect(base::Bind(&SSLClientTransportTest::ConnectComplete, 159 transport_->Connect(base::Bind(&SSLClientTransportTest::ConnectComplete,
157 base::Unretained(this))); 160 base::Unretained(this)));
158 EXPECT_NE(nullptr, transport_->TakeConnection().get()); 161 EXPECT_NE(nullptr, transport_->TakeConnection().get());
159 base::RunLoop().RunUntilIdle(); 162 base::RunLoop().RunUntilIdle();
160 } 163 }
161 164
162 } // namespace blimp 165 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/net/ssl_client_transport.cc ('k') | blimp/net/stream_packet_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698