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

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: Addressed Kevin's comments Created 4 years, 6 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
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(new SSLClientTransport(
65 ip_endpoint, cert, new BlimpConnectionStatistics(), &net_log_));
Kevin M 2016/05/24 21:49:00 This leaks the statistics object, need to pass in
shaktisahu 2016/05/24 22:42:14 Done.
64 transport_->SetClientSocketFactoryForTest(&socket_factory_); 66 transport_->SetClientSocketFactoryForTest(&socket_factory_);
65 } 67 }
66 68
67 base::MessageLoop message_loop; 69 base::MessageLoop message_loop;
68 net::NetLog net_log_; 70 net::NetLog net_log_;
69 net::StaticSocketDataProvider tcp_connect_; 71 net::StaticSocketDataProvider tcp_connect_;
70 std::unique_ptr<net::SSLSocketDataProvider> ssl_connect_; 72 std::unique_ptr<net::SSLSocketDataProvider> ssl_connect_;
71 net::MockClientSocketFactory socket_factory_; 73 net::MockClientSocketFactory socket_factory_;
72 std::unique_ptr<SSLClientTransport> transport_; 74 std::unique_ptr<SSLClientTransport> transport_;
73 }; 75 };
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 EXPECT_CALL(*this, ConnectComplete(net::OK)); 155 EXPECT_CALL(*this, ConnectComplete(net::OK));
154 SetupTCPSyncSocketConnect(endpoint, net::OK); 156 SetupTCPSyncSocketConnect(endpoint, net::OK);
155 SetupSSLSyncSocketConnect(net::OK); 157 SetupSSLSyncSocketConnect(net::OK);
156 transport_->Connect(base::Bind(&SSLClientTransportTest::ConnectComplete, 158 transport_->Connect(base::Bind(&SSLClientTransportTest::ConnectComplete,
157 base::Unretained(this))); 159 base::Unretained(this)));
158 EXPECT_NE(nullptr, transport_->TakeConnection().get()); 160 EXPECT_NE(nullptr, transport_->TakeConnection().get());
159 base::RunLoop().RunUntilIdle(); 161 base::RunLoop().RunUntilIdle();
160 } 162 }
161 163
162 } // namespace blimp 164 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698