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

Unified Diff: chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h

Issue 444903002: [cros] user_manager component - move UserManagerBase and UserManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 4 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
Index: chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h
diff --git a/chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h b/chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h
new file mode 100644
index 0000000000000000000000000000000000000000..38880f6e0b1fd893eb01e176f7573a363d6e30dc
--- /dev/null
+++ b/chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h
@@ -0,0 +1,34 @@
+// Copyright 2014 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 CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SCOPED_USER_MANAGER_ENABLER_H_
+#define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SCOPED_USER_MANAGER_ENABLER_H_
+
+#include "base/basictypes.h"
+
+namespace user_manager {
+class UserManager;
+}
+
+namespace chromeos {
+
+// Helper class for unit tests. Initializes the UserManager singleton to the
+// given |user_manager| and tears it down again on destruction. If the singleton
+// had already been initialized, its previous value is restored after tearing
+// down |user_manager|.
+class ScopedUserManagerEnabler {
+ public:
+ // Takes ownership of |user_manager|.
+ explicit ScopedUserManagerEnabler(user_manager::UserManager* user_manager);
+ ~ScopedUserManagerEnabler();
+
+ private:
+ user_manager::UserManager* previous_user_manager_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedUserManagerEnabler);
+};
+
+} // namespace chromeos
+
+#endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_SCOPED_USER_MANAGER_ENABLER_H_

Powered by Google App Engine
This is Rietveld 408576698