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

Unified Diff: chrome/browser/chromeos/cros/cryptohome_library.h

Issue 1142005: Mocks for all libcros elements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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
Index: chrome/browser/chromeos/cros/cryptohome_library.h
===================================================================
--- chrome/browser/chromeos/cros/cryptohome_library.h (revision 42341)
+++ chrome/browser/chromeos/cros/cryptohome_library.h (working copy)
@@ -11,37 +11,45 @@
#include "third_party/cros/chromeos_cryptohome.h"
namespace chromeos {
-class MockCryptohomeLibrary;
-// This class handles the interaction with the ChromeOS cryptohome library APIs.
-// Users can get an instance of this library class like this:
-// CryptohomeLibrary::Get()
+// This interface defines the interaction with the ChromeOS cryptohome library
+// APIs.
class CryptohomeLibrary {
public:
- // This gets the singleton CryptohomeLibrary.
- static CryptohomeLibrary* Get();
+ virtual ~CryptohomeLibrary() {}
// Asks cryptohomed to try to find the cryptohome for |user_email| and then
// mount it using |passhash| to unlock the key.
virtual bool Mount(const std::string& user_email,
- const std::string& passhash);
+ const std::string& passhash) = 0;
// Asks cryptohomed to try to find the cryptohome for |user_email| and then
// use |passhash| to unlock the key.
virtual bool CheckKey(const std::string& user_email,
+ const std::string& passhash) = 0;
+
+ // Asks cryptohomed if a drive is currently mounted.
+ virtual bool IsMounted() = 0;
+
+};
+
+// This class handles the interaction with the ChromeOS cryptohome library APIs.
+class CryptohomeLibraryImpl : public CryptohomeLibrary {
+ public:
+ CryptohomeLibraryImpl() {}
+ virtual ~CryptohomeLibraryImpl() {}
+
+ // CryptohomeLibrary overrides.
+ virtual bool Mount(const std::string& user_email,
+ const std::string& passhash);
+ virtual bool CheckKey(const std::string& user_email,
const std::string& passhash);
// Asks cryptohomed if a drive is currently mounted.
virtual bool IsMounted();
private:
- friend struct DefaultSingletonTraits<CryptohomeLibrary>;
- friend class MockCryptohomeLibrary;
-
- CryptohomeLibrary() {}
- ~CryptohomeLibrary() {}
-
- DISALLOW_COPY_AND_ASSIGN(CryptohomeLibrary);
+ DISALLOW_COPY_AND_ASSIGN(CryptohomeLibraryImpl);
};
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/cros/cros_library_loader.cc ('k') | chrome/browser/chromeos/cros/cryptohome_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698