| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 5 #ifndef CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
| 6 #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 6 #define CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // to be used in |Initialize()| for testing. Tests that call | 87 // to be used in |Initialize()| for testing. Tests that call |
| 88 // DBusThreadManager::Initialize() (such as browser_tests and | 88 // DBusThreadManager::Initialize() (such as browser_tests and |
| 89 // interactive_ui_tests) should use this instead of calling | 89 // interactive_ui_tests) should use this instead of calling |
| 90 // |InitiailzeForTesting|. The injected object will be owned by the | 90 // |InitiailzeForTesting|. The injected object will be owned by the |
| 91 // internal pointer and deleted by Shutdown(). | 91 // internal pointer and deleted by Shutdown(). |
| 92 static void SetInstanceForTesting(DBusThreadManager* dbus_thread_manager); | 92 static void SetInstanceForTesting(DBusThreadManager* dbus_thread_manager); |
| 93 | 93 |
| 94 // Similar to Initialize(), but injects an alternative | 94 // Similar to Initialize(), but injects an alternative |
| 95 // DBusThreadManager using SetInstanceForTest first. The injected | 95 // DBusThreadManager using SetInstanceForTest first. The injected |
| 96 // object will be owned by the internal pointer and deleted by | 96 // object will be owned by the internal pointer and deleted by |
| 97 // Shutdown(). | 97 // Shutdown(). Does not create any Fake client implementations. |
| 98 static void InitializeForTesting(DBusThreadManager* dbus_thread_manager); | 98 static void InitializeForTesting(DBusThreadManager* dbus_thread_manager); |
| 99 | 99 |
| 100 // Initialize with stub implementations for tests based on stubs. | 100 // Initialize with stub implementations for tests, creating a complete set |
| 101 // of fake/stub client implementations. Also initializes a default set of |
| 102 // fake Shill devices and services, customizable with switches::kShillStub. |
| 101 static void InitializeWithStub(); | 103 static void InitializeWithStub(); |
| 102 | 104 |
| 103 // Returns true if DBusThreadManager has been initialized. Call this to | 105 // Returns true if DBusThreadManager has been initialized. Call this to |
| 104 // avoid initializing + shutting down DBusThreadManager more than once. | 106 // avoid initializing + shutting down DBusThreadManager more than once. |
| 105 static bool IsInitialized(); | 107 static bool IsInitialized(); |
| 106 | 108 |
| 107 // Destroys the global instance. | 109 // Destroys the global instance. |
| 108 static void Shutdown(); | 110 static void Shutdown(); |
| 109 | 111 |
| 110 // Gets the global instance. Initialize() must be called first. | 112 // Gets the global instance. Initialize() must be called first. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 165 |
| 164 // Initializes |client| with the |system_bus_|. | 166 // Initializes |client| with the |system_bus_|. |
| 165 static void InitClient(DBusClient* client); | 167 static void InitClient(DBusClient* client); |
| 166 | 168 |
| 167 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); | 169 DISALLOW_COPY_AND_ASSIGN(DBusThreadManager); |
| 168 }; | 170 }; |
| 169 | 171 |
| 170 } // namespace chromeos | 172 } // namespace chromeos |
| 171 | 173 |
| 172 #endif // CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ | 174 #endif // CHROMEOS_DBUS_DBUS_THREAD_MANAGER_H_ |
| OLD | NEW |