Commit b6f5756e authored by Yuta Kitamura's avatar Yuta Kitamura Committed by Commit Bot

Speculative fix for flaky leaks in gcm_unit_tests.

This CL tries to fix the test flakiness in gcm_unit_tests by using
the mock NetworkChangeNotifier in tests, which avoids receiving real
network status changes.

Bug: 906769
Change-Id: I08227a6f303328fe2f44cecc84c0ea64bd145415
Tbr: rmcelrath@chromium.org
Tbr: dimich@chromium.org
Reviewed-on: https://chromium-review.googlesource.com/c/1343592Reviewed-by: default avatarYuta Kitamura <yutak@chromium.org>
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609632}
parent 91a4c9a7
......@@ -91,6 +91,7 @@ class GCMSocketStreamTest : public testing::Test {
// net:: components.
net::AddressList address_list_;
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
std::unique_ptr<network::NetworkService> network_service_;
network::mojom::NetworkContextPtr network_context_ptr_;
net::MockClientSocketFactory socket_factory_;
......@@ -104,6 +105,7 @@ class GCMSocketStreamTest : public testing::Test {
GCMSocketStreamTest::GCMSocketStreamTest()
: scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO),
network_change_notifier_(net::NetworkChangeNotifier::CreateMock()),
network_service_(network::NetworkService::CreateForTesting()),
url_request_context_(true /* delay_initialization */) {
address_list_ = net::AddressList::CreateFromIPAddress(
......
......@@ -304,6 +304,7 @@ class ConnectionFactoryImplTest
std::unique_ptr<base::RunLoop> run_loop_;
GURL connected_server_;
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
std::unique_ptr<network::NetworkService> network_service_;
network::mojom::NetworkContextPtr network_context_ptr_;
std::unique_ptr<network::NetworkContext> network_context_;
......@@ -320,6 +321,7 @@ ConnectionFactoryImplTest::ConnectionFactoryImplTest()
base::Bind(&ConnectionFactoryImplTest::ConnectionsComplete,
base::Unretained(this))),
run_loop_(new base::RunLoop()),
network_change_notifier_(net::NetworkChangeNotifier::CreateMock()),
network_service_(network::NetworkService::CreateForTesting()) {
network::mojom::NetworkContextParamsPtr params =
network::mojom::NetworkContextParams::New();
......
......@@ -191,6 +191,7 @@ class GCMConnectionHandlerImplTest : public testing::Test {
net::AddressList address_list_;
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<base::RunLoop> run_loop_;
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
std::unique_ptr<network::NetworkService> network_service_;
network::mojom::NetworkContextPtr network_context_ptr_;
net::MockClientSocketFactory socket_factory_;
......@@ -205,6 +206,7 @@ GCMConnectionHandlerImplTest::GCMConnectionHandlerImplTest()
: last_error_(0),
scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO),
network_change_notifier_(net::NetworkChangeNotifier::CreateMock()),
network_service_(network::NetworkService::CreateForTesting()),
url_request_context_(true /* delay_initialization */) {
address_list_ = net::AddressList::CreateFromIPAddress(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment