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

Unified Diff: chromeos/components/tether/tether_network_disconnection_handler_unittest.cc

Issue 2821103003: Remove the configuration of Tether-associated Wi-Fi networks once connectivity is lost. (Closed)
Patch Set: Rebase. Created 3 years, 8 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 | « chromeos/components/tether/tether_network_disconnection_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/components/tether/tether_network_disconnection_handler_unittest.cc
diff --git a/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc b/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc
index 4c4b3ede3b56a9a73f4d6bfab5769f389b1e73bc..e465134580ec4a9df295bfd978d5b018299e8ede 100644
--- a/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc
+++ b/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc
@@ -9,6 +9,7 @@
#include "base/memory/ptr_util.h"
#include "base/test/scoped_task_environment.h"
#include "chromeos/components/tether/fake_active_host.h"
+#include "chromeos/components/tether/network_configuration_remover.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/network/network_state.h"
#include "chromeos/network/network_state_test.h"
@@ -16,6 +17,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
+using testing::_;
+using testing::NiceMock;
+
namespace chromeos {
namespace tether {
@@ -36,6 +40,15 @@ std::string CreateConnectedWifiConfigurationJsonString() {
return ss.str();
}
+class MockNetworkConfigurationRemover : public NetworkConfigurationRemover {
+ public:
+ MockNetworkConfigurationRemover()
+ : NetworkConfigurationRemover(nullptr, nullptr) {}
+ ~MockNetworkConfigurationRemover() override {}
+
+ MOCK_METHOD1(RemoveNetworkConfiguration, void(const std::string&));
+};
+
} // namespace
class TetherNetworkDisconnectionHandlerTest : public NetworkStateTest {
@@ -51,9 +64,12 @@ class TetherNetworkDisconnectionHandlerTest : public NetworkStateTest {
ConfigureService(CreateConnectedWifiConfigurationJsonString());
fake_active_host_ = base::MakeUnique<FakeActiveHost>();
+ mock_network_configuration_remover_ =
+ base::WrapUnique(new NiceMock<MockNetworkConfigurationRemover>);
handler_ = base::WrapUnique(new TetherNetworkDisconnectionHandler(
- fake_active_host_.get(), network_state_handler()));
+ fake_active_host_.get(), network_state_handler(),
+ mock_network_configuration_remover_.get()));
}
void TearDown() override {
@@ -73,6 +89,8 @@ class TetherNetworkDisconnectionHandlerTest : public NetworkStateTest {
std::string wifi_service_path_;
std::unique_ptr<FakeActiveHost> fake_active_host_;
+ std::unique_ptr<MockNetworkConfigurationRemover>
+ mock_network_configuration_remover_;
std::unique_ptr<TetherNetworkDisconnectionHandler> handler_;
@@ -81,6 +99,10 @@ class TetherNetworkDisconnectionHandlerTest : public NetworkStateTest {
};
TEST_F(TetherNetworkDisconnectionHandlerTest, TestConnectAndDisconnect) {
+ EXPECT_CALL(*mock_network_configuration_remover_,
+ RemoveNetworkConfiguration(kWifiNetworkGuid))
+ .Times(1);
+
// Connect to the network. |handler_| should start tracking the connection.
fake_active_host_->SetActiveHostConnecting(kDeviceId, kTetherNetworkGuid);
fake_active_host_->SetActiveHostConnected(kDeviceId, kTetherNetworkGuid,
@@ -95,4 +117,4 @@ TEST_F(TetherNetworkDisconnectionHandlerTest, TestConnectAndDisconnect) {
} // namespace tether
-} // namespace cryptauth
+} // namespace chromeos
« no previous file with comments | « chromeos/components/tether/tether_network_disconnection_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698