Commit 793dae58 authored by Robbie McElrath's avatar Robbie McElrath Committed by Commit Bot

Enable a NetworkService unit test for ChromeOS and Fuchsia.

This test was initially disabled for them since they didn't have a
NetworkChangeNotifier implementation.

TBR=cmumford@google.com

Change-Id: I1e79f8dd6a7c9c3c596f990a88ec6db7539f76f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1532900Reviewed-by: default avatarRobbie McElrath <rmcelrath@chromium.org>
Commit-Queue: Robbie McElrath <rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642753}
parent b9a0afc3
......@@ -1312,9 +1312,9 @@ class NetworkChangeTest : public testing::Test {
public:
NetworkChangeTest()
: scoped_task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO) {
service_ = NetworkService::CreateForTesting();
}
base::test::ScopedTaskEnvironment::MainThreadType::IO),
network_change_notifier_(net::NetworkChangeNotifier::CreateMock()),
service_(NetworkService::CreateForTesting()) {}
~NetworkChangeTest() override {}
......@@ -1322,12 +1322,13 @@ class NetworkChangeTest : public testing::Test {
private:
base::test::ScopedTaskEnvironment scoped_task_environment_;
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
std::unique_ptr<NetworkService> service_;
};
// mojom:NetworkChangeManager isn't supported on these platforms.
// mojom:NetworkChangeManager isn't supported on iOS.
// See the same ifdef in CreateNetworkChangeNotifierIfNeeded.
#if defined(OS_CHROMEOS) || defined(OS_FUCHSIA) || defined(OS_IOS)
#if defined(OS_IOS)
#define MAYBE_NetworkChangeManagerRequest DISABLED_NetworkChangeManagerRequest
#else
#define MAYBE_NetworkChangeManagerRequest NetworkChangeManagerRequest
......@@ -1344,6 +1345,7 @@ class NetworkServiceNetworkChangeTest : public testing::Test {
NetworkServiceNetworkChangeTest()
: task_environment_(
base::test::ScopedTaskEnvironment::MainThreadType::IO),
network_change_notifier_(net::NetworkChangeNotifier::CreateMock()),
service_(NetworkService::CreateForTesting(
test_connector_factory_.RegisterInstance(kNetworkServiceName))) {
test_connector_factory_.GetDefaultConnector()->BindInterface(
......@@ -1354,13 +1356,10 @@ class NetworkServiceNetworkChangeTest : public testing::Test {
mojom::NetworkService* service() { return network_service_.get(); }
void SimulateNetworkChange() {
// This posts a task to simulate a network change notification
}
private:
base::test::ScopedTaskEnvironment task_environment_;
service_manager::TestConnectorFactory test_connector_factory_;
std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier_;
std::unique_ptr<NetworkService> service_;
mojom::NetworkServicePtr network_service_;
......
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