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

Unified Diff: extensions/browser/api/cast_channel/cast_socket_unittest.cc

Issue 2042493002: Fix use-before-new issue in TestCastSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/cast_channel/cast_socket_unittest.cc
diff --git a/extensions/browser/api/cast_channel/cast_socket_unittest.cc b/extensions/browser/api/cast_channel/cast_socket_unittest.cc
index 4db753a17755b65dfde494e485360b0e7572099f..7a237544ce4ea04a31b084391c048db146ed94b8 100644
--- a/extensions/browser/api/cast_channel/cast_socket_unittest.cc
+++ b/extensions/browser/api/cast_channel/cast_socket_unittest.cc
@@ -190,14 +190,28 @@ class TestCastSocket : public CastSocketImpl {
int64_t timeout_ms,
Logger* logger,
uint64_t device_capabilities)
+ : TestCastSocket(ip_endpoint,
+ channel_auth,
+ timeout_ms,
+ logger,
+ new net::TestNetLog(),
+ device_capabilities) {}
+
+ explicit TestCastSocket(const net::IPEndPoint& ip_endpoint,
+ ChannelAuthType channel_auth,
+ int64_t timeout_ms,
+ Logger* logger,
+ net::TestNetLog* capturing_net_log,
+ uint64_t device_capabilities)
: CastSocketImpl("some_extension_id",
ip_endpoint,
channel_auth,
- &capturing_net_log_,
+ capturing_net_log,
base::TimeDelta::FromMilliseconds(timeout_ms),
false,
logger,
device_capabilities),
+ capturing_net_log_(capturing_net_log),
ip_(ip_endpoint),
extract_cert_result_(true),
verify_challenge_result_(true),
@@ -296,7 +310,7 @@ class TestCastSocket : public CastSocketImpl {
ssl_data_->set_connect_data(*connect_data);
// NOTE: net::MockTCPClientSocket inherits from net::SSLClientSocket !!
return std::unique_ptr<net::SSLClientSocket>(new net::MockTCPClientSocket(
- net::AddressList(), &capturing_net_log_, ssl_data_.get()));
+ net::AddressList(), capturing_net_log_.get(), ssl_data_.get()));
}
scoped_refptr<net::X509Certificate> ExtractPeerCert() override {
@@ -313,7 +327,7 @@ class TestCastSocket : public CastSocketImpl {
base::Timer* GetTimer() override { return mock_timer_.get(); }
- net::TestNetLog capturing_net_log_;
+ std::unique_ptr<net::TestNetLog> capturing_net_log_;
net::IPEndPoint ip_;
// Simulated connect data
std::unique_ptr<net::MockConnect> tcp_connect_data_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698