Chromium Code Reviews| Index: chromeos/network/network_state_test.h |
| diff --git a/chromeos/network/network_state_test.h b/chromeos/network/network_state_test.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..801fc2ceb6c9a9d9b5033228ca376fd9bc4290cc |
| --- /dev/null |
| +++ b/chromeos/network/network_state_test.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2017 The Chromium 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 CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ |
| +#define CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ |
| + |
| +#include <memory> |
| + |
| +#include "chromeos/dbus/shill_manager_client.h" |
| +#include "chromeos/network/network_state_handler.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace chromeos { |
| + |
| +// Class for tests that need NetworkStateHandler. Handles initialization, |
| +// shutdown, and adds default profiles and a wifi device. |
| +class NetworkStateTest : public testing::Test { |
| + public: |
| + NetworkStateTest(); |
| + ~NetworkStateTest() override; |
| + |
| + // DBusThreadManager::Initialize() must be called before SetUp(). |
| + void SetUp() override; |
| + void TearDown() override; |
| + |
| + // Call this before TearDown() to shut down NetworkStateHandler. |
| + void ShutdownNetworkState(); |
| + |
| + // Configures a new service using Shill properties from |shill_json_string| |
| + // which must include a GUID and Type. |
| + bool ConfigureService(const std::string& shill_json_string); |
| + |
| + // Returns a string value for property |key| associated with |service_path|. |
| + // The result will be empty if the service or property do not exist. |
| + std::string GetServiceStringProperty(const std::string& service_path, |
|
Kyle Horimoto
2017/03/29 20:18:32
Should this class also have a mechanism for settin
stevenjb
2017/03/29 20:29:16
If/when we need it we can and should add it. The c
|
| + const std::string& key); |
| + |
| + ShillManagerClient::TestInterface* test_manager_client() { |
| + return test_manager_client_; |
| + } |
| + NetworkStateHandler* network_state_handler() { |
| + return network_state_handler_.get(); |
| + } |
| + |
| + static const char kUserHash[]; |
| + |
| + private: |
| + ShillManagerClient::TestInterface* test_manager_client_ = nullptr; |
| + std::unique_ptr<NetworkStateHandler> network_state_handler_; |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_DBUS_SHILL_CLIENT_UNITTEST_BASE_H_ |