Rename and cleanup WifiProvider Added generic SuccessCallback and ErrorCallback. Replaced callback with generic ones in WifiProvider and Stream. BUG: 24267885 Change-Id: Iabdb8ed90fa463b4c8e0cae60de234f674e770ce Reviewed-on: https://weave-review.googlesource.com/1153 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/libweave/examples/ubuntu/event_http_server.cc b/libweave/examples/ubuntu/event_http_server.cc index 3fefac7..8e45648 100644 --- a/libweave/examples/ubuntu/event_http_server.cc +++ b/libweave/examples/ubuntu/event_http_server.cc
@@ -37,8 +37,8 @@ void Read(void* buffer, size_t size_to_read, - const base::Callback<void(size_t)>& success_callback, - const base::Callback<void(const Error*)>& error_callback) override { + const ReadSuccessCallback& success_callback, + const ErrorCallback& error_callback) override { CHECK_LE(read_position_, data_.size()); size_t size_read = std::min(size_to_read, data_.size() - read_position_); if (size_read > 0) @@ -47,11 +47,10 @@ success_callback.Run(size_read); } - void Write( - const void* buffer, - size_t size_to_write, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) override { + void Write(const void* buffer, + size_t size_to_write, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) override { LOG(FATAL) << "Unsupported"; }
diff --git a/libweave/examples/ubuntu/network_manager.cc b/libweave/examples/ubuntu/network_manager.cc index 56e9544..f86f12b 100644 --- a/libweave/examples/ubuntu/network_manager.cc +++ b/libweave/examples/ubuntu/network_manager.cc
@@ -43,11 +43,11 @@ SSL_load_error_strings(); SSL_library_init(); - DisableAccessPoint(); + StopAccessPoint(); UpdateNetworkState(); } NetworkImpl::~NetworkImpl() { - DisableAccessPoint(); + StopAccessPoint(); } void NetworkImpl::AddOnConnectionChangedCallback( @@ -105,11 +105,10 @@ base::TimeDelta::FromSeconds(1)); } -void NetworkImpl::ConnectToService( - const std::string& ssid, - const std::string& passphrase, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) { +void NetworkImpl::Connect(const std::string& ssid, + const std::string& passphrase, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) { force_bootstrapping_ = false; CHECK(!hostapd_started_); if (hostapd_started_) { @@ -151,7 +150,7 @@ return network_state_; } -void NetworkImpl::EnableAccessPoint(const std::string& ssid) { +void NetworkImpl::StartAccessPoint(const std::string& ssid) { if (hostapd_started_) return; @@ -193,7 +192,7 @@ CHECK_EQ(0, std::system(("dnsmasq --conf-file=" + dnsmasq_conf).c_str())); } -void NetworkImpl::DisableAccessPoint() { +void NetworkImpl::StopAccessPoint() { int res = std::system("pkill -f dnsmasq.*/tmp/weave"); res = std::system("pkill -f hostapd.*/tmp/weave"); CHECK_EQ(0, std::system("nmcli nm wifi on"));
diff --git a/libweave/examples/ubuntu/network_manager.h b/libweave/examples/ubuntu/network_manager.h index 4e1b6bd..f56e391 100644 --- a/libweave/examples/ubuntu/network_manager.h +++ b/libweave/examples/ubuntu/network_manager.h
@@ -11,7 +11,7 @@ #include <base/memory/weak_ptr.h> #include <base/time/time.h> #include <weave/network.h> -#include <weave/wifi.h> +#include <weave/wifi_provider.h> namespace weave { @@ -21,7 +21,7 @@ // Basic weave::Network implementation. // Production version of SSL socket needs secure server certificate check. -class NetworkImpl : public Network, public Wifi { +class NetworkImpl : public Network, public WifiProvider { public: explicit NetworkImpl(TaskRunner* task_runner, bool force_bootstrapping); ~NetworkImpl(); @@ -37,13 +37,12 @@ const base::Callback<void(const Error*)>& error_callback) override; // Wifi implementation - void ConnectToService( - const std::string& ssid, - const std::string& passphrase, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) override; - void EnableAccessPoint(const std::string& ssid) override; - void DisableAccessPoint() override; + void Connect(const std::string& ssid, + const std::string& passphrase, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) override; + void StartAccessPoint(const std::string& ssid) override; + void StopAccessPoint() override; static bool HasWifiCapability();
diff --git a/libweave/examples/ubuntu/ssl_stream.cc b/libweave/examples/ubuntu/ssl_stream.cc index 85ffae5..71d5148 100644 --- a/libweave/examples/ubuntu/ssl_stream.cc +++ b/libweave/examples/ubuntu/ssl_stream.cc
@@ -22,8 +22,8 @@ void SSLStream::Read(void* buffer, size_t size_to_read, - const base::Callback<void(size_t)>& success_callback, - const base::Callback<void(const Error*)>& error_callback) { + const ReadSuccessCallback& success_callback, + const ErrorCallback& error_callback) { int res = SSL_read(ssl_.get(), buffer, size_to_read); if (res > 0) { task_runner_->PostDelayedTask( @@ -57,11 +57,10 @@ return; } -void SSLStream::Write( - const void* buffer, - size_t size_to_write, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) { +void SSLStream::Write(const void* buffer, + size_t size_to_write, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) { int res = SSL_write(ssl_.get(), buffer, size_to_write); if (res > 0) { buffer = static_cast<const char*>(buffer) + res;
diff --git a/libweave/examples/ubuntu/ssl_stream.h b/libweave/examples/ubuntu/ssl_stream.h index 9c0d604..7343df9 100644 --- a/libweave/examples/ubuntu/ssl_stream.h +++ b/libweave/examples/ubuntu/ssl_stream.h
@@ -24,20 +24,20 @@ void Read(void* buffer, size_t size_to_read, - const base::Callback<void(size_t)>& success_callback, - const base::Callback<void(const Error*)>& error_callback) override; + const ReadSuccessCallback& success_callback, + const ErrorCallback& error_callback) override; void Write(const void* buffer, size_t size_to_write, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) override; + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) override; void CancelPendingOperations() override; bool Init(const std::string& host, uint16_t port); private: - void RunDelayedTask(const base::Closure& success_callback); + void RunDelayedTask(const base::Closure& task); TaskRunner* task_runner_{nullptr}; std::unique_ptr<SSL_CTX, decltype(&SSL_CTX_free)> ctx_{nullptr, SSL_CTX_free};
diff --git a/libweave/include/weave/device.h b/libweave/include/weave/device.h index e45d727..0d01910 100644 --- a/libweave/include/weave/device.h +++ b/libweave/include/weave/device.h
@@ -21,7 +21,7 @@ #include <weave/privet.h> #include <weave/state.h> #include <weave/task_runner.h> -#include <weave/wifi.h> +#include <weave/wifi_provider.h> namespace weave { @@ -44,7 +44,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, Bluetooth* bluetooth) = 0; virtual Commands* GetCommands() = 0;
diff --git a/libweave/include/weave/error.h b/libweave/include/weave/error.h index 314f685..b9f07a5 100644 --- a/libweave/include/weave/error.h +++ b/libweave/include/weave/error.h
@@ -8,6 +8,7 @@ #include <memory> #include <string> +#include <base/callback.h> #include <base/macros.h> #include <base/location.h> #include <base/compiler_specific.h> @@ -125,6 +126,9 @@ DISALLOW_COPY_AND_ASSIGN(Error); }; +using SuccessCallback = base::Closure; +using ErrorCallback = base::Callback<void(const Error*)>; + } // namespace weave #endif // LIBWEAVE_INCLUDE_WEAVE_ERROR_H_
diff --git a/libweave/include/weave/stream.h b/libweave/include/weave/stream.h index 5c317a0..99385a7 100644 --- a/libweave/include/weave/stream.h +++ b/libweave/include/weave/stream.h
@@ -17,14 +17,16 @@ public: virtual ~InputStream() = default; + // Callbacks types for Read. + using ReadSuccessCallback = base::Callback<void(size_t)>; + // Implementation should return immediately and post either success_callback // or error_callback. Caller guarantees that buffet is alive until either of // callback is called. - virtual void Read( - void* buffer, - size_t size_to_read, - const base::Callback<void(size_t)>& success_callback, - const base::Callback<void(const Error*)>& error_callback) = 0; + virtual void Read(void* buffer, + size_t size_to_read, + const ReadSuccessCallback& success_callback, + const ErrorCallback& error_callback) = 0; }; // Interface for async input streaming. @@ -36,11 +38,10 @@ // or error_callback. Caller guarantees that buffet is alive until either of // callback is called. // Success callback must be called only after all data is written. - virtual void Write( - const void* buffer, - size_t size_to_write, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) = 0; + virtual void Write(const void* buffer, + size_t size_to_write, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) = 0; }; // Interface for async bi-directional streaming.
diff --git a/libweave/include/weave/test/mock_wifi.h b/libweave/include/weave/test/mock_wifi.h deleted file mode 100644 index 20223ed..0000000 --- a/libweave/include/weave/test/mock_wifi.h +++ /dev/null
@@ -1,34 +0,0 @@ -// Copyright 2015 The Chromium OS Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_H_ -#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_H_ - -#include <weave/network.h> - -#include <string> - -#include <gmock/gmock.h> - -namespace weave { -namespace test { - -class MockWifi : public Wifi { - public: - MockWifi() {} - ~MockWifi() override = default; - - MOCK_METHOD4(ConnectToService, - void(const std::string&, - const std::string&, - const base::Closure&, - const base::Callback<void(const Error*)>&)); - MOCK_METHOD1(EnableAccessPoint, void(const std::string&)); - MOCK_METHOD0(DisableAccessPoint, void()); -}; - -} // namespace test -} // namespace weave - -#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_H_
diff --git a/libweave/include/weave/test/mock_wifi_provider.h b/libweave/include/weave/test/mock_wifi_provider.h new file mode 100644 index 0000000..33d4cc4 --- /dev/null +++ b/libweave/include/weave/test/mock_wifi_provider.h
@@ -0,0 +1,34 @@ +// Copyright 2015 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_PROVIDER_H_ +#define LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_PROVIDER_H_ + +#include <weave/network.h> + +#include <string> + +#include <gmock/gmock.h> + +namespace weave { +namespace test { + +class MockWifiProvider : public WifiProvider { + public: + MockWifiProvider() {} + ~MockWifiProvider() override = default; + + MOCK_METHOD4(Connect, + void(const std::string&, + const std::string&, + const base::Closure&, + const base::Callback<void(const Error*)>&)); + MOCK_METHOD1(StartAccessPoint, void(const std::string&)); + MOCK_METHOD0(StopAccessPoint, void()); +}; + +} // namespace test +} // namespace weave + +#endif // LIBWEAVE_INCLUDE_WEAVE_TEST_MOCK_WIFI_PROVIDER_H_
diff --git a/libweave/include/weave/wifi.h b/libweave/include/weave/wifi.h deleted file mode 100644 index e763afa..0000000 --- a/libweave/include/weave/wifi.h +++ /dev/null
@@ -1,38 +0,0 @@ -// Copyright 2015 The Chromium OS Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef LIBWEAVE_INCLUDE_WEAVE_WIFI_H_ -#define LIBWEAVE_INCLUDE_WEAVE_WIFI_H_ - -#include <string> - -#include <base/callback.h> -#include <weave/error.h> - -namespace weave { - -class Wifi { - public: - // Implementation should attempt to connect to the given network with the - // given passphrase. Implementation should run either of callback. - // Callback should be posted. - virtual void ConnectToService( - const std::string& ssid, - const std::string& passphrase, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) = 0; - - // Starts WiFi access point for wifi setup. - virtual void EnableAccessPoint(const std::string& ssid) = 0; - - // Stops WiFi access point. - virtual void DisableAccessPoint() = 0; - - protected: - virtual ~Wifi() = default; -}; - -} // namespace weave - -#endif // LIBWEAVE_INCLUDE_WEAVE_WIFI_H_
diff --git a/libweave/include/weave/wifi_provider.h b/libweave/include/weave/wifi_provider.h new file mode 100644 index 0000000..4173796 --- /dev/null +++ b/libweave/include/weave/wifi_provider.h
@@ -0,0 +1,37 @@ +// Copyright 2015 The Chromium OS Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef LIBWEAVE_INCLUDE_WEAVE_WIFI_PROVIDER_H_ +#define LIBWEAVE_INCLUDE_WEAVE_WIFI_PROVIDER_H_ + +#include <string> + +#include <base/callback.h> +#include <weave/error.h> + +namespace weave { + +// Interface with methods to control WiFi capability of the device. +class WifiProvider { + public: + // Connects to the given network with the given pass-phrase. Implementation + // should post either of callbacks. + virtual void Connect(const std::string& ssid, + const std::string& passphrase, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) = 0; + + // Starts WiFi access point for wifi setup. + virtual void StartAccessPoint(const std::string& ssid) = 0; + + // Stops WiFi access point. + virtual void StopAccessPoint() = 0; + + protected: + virtual ~WifiProvider() = default; +}; + +} // namespace weave + +#endif // LIBWEAVE_INCLUDE_WEAVE_WIFI_PROVIDER_H_
diff --git a/libweave/src/device_manager.cc b/libweave/src/device_manager.cc index 111b87e..15c5e49 100644 --- a/libweave/src/device_manager.cc +++ b/libweave/src/device_manager.cc
@@ -36,7 +36,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, Bluetooth* bluetooth) { command_manager_ = std::make_shared<CommandManager>(); command_manager_->Startup(config_store); @@ -91,7 +91,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, Bluetooth* bluetooth) { privet_.reset(new privet::Manager{}); privet_->Start(options, task_runner, network, mdns, http_server, wifi,
diff --git a/libweave/src/device_manager.h b/libweave/src/device_manager.h index bc6f031..de0cfa5 100644 --- a/libweave/src/device_manager.h +++ b/libweave/src/device_manager.h
@@ -33,7 +33,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, Bluetooth* bluetooth) override; Commands* GetCommands() override; @@ -49,7 +49,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, Bluetooth* bluetooth); void OnWiFiBootstrapStateChanged(weave::WifiSetupState state);
diff --git a/libweave/src/notification/xmpp_channel_unittest.cc b/libweave/src/notification/xmpp_channel_unittest.cc index 1f5961f..4d8ab76 100644 --- a/libweave/src/notification/xmpp_channel_unittest.cc +++ b/libweave/src/notification/xmpp_channel_unittest.cc
@@ -95,8 +95,8 @@ void Read(void* buffer, size_t size_to_read, - const base::Callback<void(size_t)>& success_callback, - const base::Callback<void(const Error*)>& error_callback) override { + const ReadSuccessCallback& success_callback, + const ErrorCallback& error_callback) override { if (read_data_.empty()) { task_runner_->PostDelayedTask( FROM_HERE, @@ -112,11 +112,10 @@ base::TimeDelta::FromSeconds(0)); } - void Write( - const void* buffer, - size_t size_to_write, - const base::Closure& success_callback, - const base::Callback<void(const Error*)>& error_callback) override { + void Write(const void* buffer, + size_t size_to_write, + const SuccessCallback& success_callback, + const ErrorCallback& error_callback) override { size_t size = std::min(size_to_write, write_data_.size()); EXPECT_EQ( write_data_.substr(0, size),
diff --git a/libweave/src/privet/privet_manager.cc b/libweave/src/privet/privet_manager.cc index feaab2c..1bc7caf 100644 --- a/libweave/src/privet/privet_manager.cc +++ b/libweave/src/privet/privet_manager.cc
@@ -38,7 +38,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, DeviceRegistrationInfo* device, CommandManager* command_manager, StateManager* state_manager) {
diff --git a/libweave/src/privet/privet_manager.h b/libweave/src/privet/privet_manager.h index 50f7416..a452a6b 100644 --- a/libweave/src/privet/privet_manager.h +++ b/libweave/src/privet/privet_manager.h
@@ -52,7 +52,7 @@ Network* network, Mdns* mdns, HttpServer* http_server, - Wifi* wifi, + WifiProvider* wifi, DeviceRegistrationInfo* device, CommandManager* command_manager, StateManager* state_manager);
diff --git a/libweave/src/privet/wifi_bootstrap_manager.cc b/libweave/src/privet/wifi_bootstrap_manager.cc index 1cb3cd4..bd84e14 100644 --- a/libweave/src/privet/wifi_bootstrap_manager.cc +++ b/libweave/src/privet/wifi_bootstrap_manager.cc
@@ -9,7 +9,7 @@ #include <weave/enum_to_string.h> #include <weave/network.h> #include <weave/task_runner.h> -#include <weave/wifi.h> +#include <weave/wifi_provider.h> #include "libweave/src/bind_lambda.h" #include "libweave/src/privet/constants.h" @@ -23,7 +23,7 @@ bool ble_setup_enabled, TaskRunner* task_runner, Network* network, - Wifi* wifi, + WifiProvider* wifi, CloudDelegate* gcd) : task_runner_{task_runner}, network_{network}, @@ -80,13 +80,13 @@ // TODO(vitalybuka): Add SSID probing. privet_ssid_ = GenerateSsid(); CHECK(!privet_ssid_.empty()); - wifi_->EnableAccessPoint(privet_ssid_); + wifi_->StartAccessPoint(privet_ssid_); LOG_IF(INFO, ble_setup_enabled_) << "BLE Bootstrap start: not implemented."; } void WifiBootstrapManager::EndBootstrapping() { LOG_IF(INFO, ble_setup_enabled_) << "BLE Bootstrap stop: not implemented."; - wifi_->DisableAccessPoint(); + wifi_->StopAccessPoint(); privet_ssid_.clear(); } @@ -99,11 +99,11 @@ FROM_HERE, base::Bind(&WifiBootstrapManager::OnConnectError, tasks_weak_factory_.GetWeakPtr(), nullptr), base::TimeDelta::FromMinutes(3)); - wifi_->ConnectToService(ssid, passphrase, - base::Bind(&WifiBootstrapManager::OnConnectSuccess, - tasks_weak_factory_.GetWeakPtr(), ssid), - base::Bind(&WifiBootstrapManager::OnConnectError, - tasks_weak_factory_.GetWeakPtr())); + wifi_->Connect(ssid, passphrase, + base::Bind(&WifiBootstrapManager::OnConnectSuccess, + tasks_weak_factory_.GetWeakPtr(), ssid), + base::Bind(&WifiBootstrapManager::OnConnectError, + tasks_weak_factory_.GetWeakPtr())); } void WifiBootstrapManager::OnConnectError(const Error* error) {
diff --git a/libweave/src/privet/wifi_bootstrap_manager.h b/libweave/src/privet/wifi_bootstrap_manager.h index 6c091cd..f0cb20e 100644 --- a/libweave/src/privet/wifi_bootstrap_manager.h +++ b/libweave/src/privet/wifi_bootstrap_manager.h
@@ -24,7 +24,7 @@ class Network; class TaskRunner; -class Wifi; +class WifiProvider; namespace privet { @@ -42,7 +42,7 @@ bool wifi_setup_enabled, TaskRunner* task_runner, Network* shill_client, - Wifi* wifi, + WifiProvider* wifi, CloudDelegate* gcd); ~WifiBootstrapManager() override = default; virtual void Init(); @@ -98,7 +98,7 @@ ConnectionState connection_state_{ConnectionState::kDisabled}; TaskRunner* task_runner_{nullptr}; Network* network_{nullptr}; - Wifi* wifi_{nullptr}; + WifiProvider* wifi_{nullptr}; WifiSsidGenerator ssid_generator_; base::Time monitor_until_;
diff --git a/libweave/src/weave_unittest.cc b/libweave/src/weave_unittest.cc index 43a7282..d495f32 100644 --- a/libweave/src/weave_unittest.cc +++ b/libweave/src/weave_unittest.cc
@@ -13,7 +13,7 @@ #include <weave/test/mock_mdns.h> #include <weave/test/mock_network.h> #include <weave/test/mock_task_runner.h> -#include <weave/test/mock_wifi.h> +#include <weave/test/mock_wifi_provider.h> #include <weave/test/unittest_utils.h> #include "libweave/src/bind_lambda.h" @@ -283,7 +283,7 @@ void InitDefaultExpectations() { InitConfigStore(); InitNetwork(); - EXPECT_CALL(wifi_, EnableAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) + EXPECT_CALL(wifi_, StartAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) .WillOnce(Return()); InitHttpServer(); InitMdns(); @@ -328,7 +328,7 @@ StrictMock<test::MockNetwork> network_; StrictMock<test::MockMdns> mdns_; StrictMock<test::MockHttpServer> http_server_; - StrictMock<test::MockWifi> wifi_; + StrictMock<test::MockWifiProvider> wifi_; StrictMock<test::MockBluetooth> bluetooth_; std::vector<Network::OnConnectionChangedCallback> network_callbacks_; @@ -439,7 +439,7 @@ // Long disconnect. NotifyNetworkChanged(NetworkState::kOffline, {}); auto offline_from = task_runner_.GetClock()->Now(); - EXPECT_CALL(wifi_, EnableAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) + EXPECT_CALL(wifi_, StartAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) .WillOnce(InvokeWithoutArgs([this, offline_from]() { EXPECT_GT(task_runner_.GetClock()->Now() - offline_from, base::TimeDelta::FromMinutes(1)); @@ -461,7 +461,7 @@ for (int i = 0; i < 5; ++i) { auto offline_from = task_runner_.GetClock()->Now(); // Temporarily offline mode. - EXPECT_CALL(wifi_, EnableAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) + EXPECT_CALL(wifi_, StartAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) .WillOnce(InvokeWithoutArgs([this, &offline_from]() { EXPECT_GT(task_runner_.GetClock()->Now() - offline_from, base::TimeDelta::FromMinutes(1)); @@ -471,7 +471,7 @@ // Try to reconnect again. offline_from = task_runner_.GetClock()->Now(); - EXPECT_CALL(wifi_, DisableAccessPoint()) + EXPECT_CALL(wifi_, StopAccessPoint()) .WillOnce(InvokeWithoutArgs([this, offline_from]() { EXPECT_GT(task_runner_.GetClock()->Now() - offline_from, base::TimeDelta::FromMinutes(5)); @@ -491,7 +491,7 @@ .WillRepeatedly(Return(NetworkState::kOffline)); auto offline_from = task_runner_.GetClock()->Now(); - EXPECT_CALL(wifi_, EnableAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) + EXPECT_CALL(wifi_, StartAccessPoint(MatchesRegex("DEVICE_NAME.*prv"))) .WillOnce(InvokeWithoutArgs([this, &offline_from]() { EXPECT_GT(task_runner_.GetClock()->Now() - offline_from, base::TimeDelta::FromMinutes(1));