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

Unified Diff: chromeos/network/network_state_test.h

Issue 2787613002: Add NetworkStateTest helper class (Closed)
Patch Set: Also convert ProhibitedTechnologiesHandlerTest Created 3 years, 9 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/network/network_connection_handler_unittest.cc ('k') | chromeos/network/network_state_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
+ 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_
« no previous file with comments | « chromeos/network/network_connection_handler_unittest.cc ('k') | chromeos/network/network_state_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698