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

Side by Side Diff: chrome/browser/chromeos/cros/mock_cryptohome_library.h

Issue 8602006: chromeos: Remove unused code from CryptohomeLibrary. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_BROWSER_CHROMEOS_CROS_MOCK_CRYPTOHOME_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_MOCK_CRYPTOHOME_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_CRYPTOHOME_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_MOCK_CRYPTOHOME_LIBRARY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/chromeos/cros/cryptohome_library.h" 11 #include "chrome/browser/chromeos/cros/cryptohome_library.h"
12 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
13 13
14 using ::testing::Invoke; 14 using ::testing::Invoke;
15 using ::testing::WithArgs; 15 using ::testing::WithArgs;
16 using ::testing::_; 16 using ::testing::_;
17 17
18 namespace chromeos { 18 namespace chromeos {
19 19
20 class MockCryptohomeLibrary : public CryptohomeLibrary { 20 class MockCryptohomeLibrary : public CryptohomeLibrary {
21 public: 21 public:
22 MockCryptohomeLibrary(); 22 MockCryptohomeLibrary();
23 virtual ~MockCryptohomeLibrary(); 23 virtual ~MockCryptohomeLibrary();
24 24
25 void SetUp(bool outcome, int code); 25 void SetUp(bool outcome, int code);
26 26
27 MOCK_METHOD0(Init, void(void)); 27 MOCK_METHOD0(Init, void(void));
28 MOCK_METHOD2(CheckKey, bool(const std::string& user_email,
29 const std::string& passhash));
30 MOCK_METHOD3(AsyncCheckKey, bool(const std::string& user_email, 28 MOCK_METHOD3(AsyncCheckKey, bool(const std::string& user_email,
31 const std::string& passhash, 29 const std::string& passhash,
32 Delegate* callback)); 30 Delegate* callback));
33 MOCK_METHOD3(MigrateKey, bool(const std::string& user_email,
34 const std::string& old_hash,
35 const std::string& new_hash));
36 MOCK_METHOD4(AsyncMigrateKey, bool(const std::string& user_email, 31 MOCK_METHOD4(AsyncMigrateKey, bool(const std::string& user_email,
37 const std::string& old_hash, 32 const std::string& old_hash,
38 const std::string& new_hash, 33 const std::string& new_hash,
39 Delegate* callback)); 34 Delegate* callback));
40 MOCK_METHOD3(Mount, bool(const std::string& user_email,
41 const std::string& passhash,
42 int* error_code));
43 MOCK_METHOD4(AsyncMount, bool(const std::string& user_email, 35 MOCK_METHOD4(AsyncMount, bool(const std::string& user_email,
44 const std::string& passhash, 36 const std::string& passhash,
45 const bool create_if_missing, 37 const bool create_if_missing,
46 Delegate* callback)); 38 Delegate* callback));
47 MOCK_METHOD1(MountForBwsi, bool(int*));
48 MOCK_METHOD1(AsyncMountForBwsi, bool(Delegate* callback)); 39 MOCK_METHOD1(AsyncMountForBwsi, bool(Delegate* callback));
49 MOCK_METHOD0(Unmount, bool(void));
50 MOCK_METHOD1(Remove, bool(const std::string& user_email));
51 MOCK_METHOD2(AsyncRemove, bool(const std::string& user_email, Delegate* d)); 40 MOCK_METHOD2(AsyncRemove, bool(const std::string& user_email, Delegate* d));
52 MOCK_METHOD0(IsMounted, bool(void)); 41 MOCK_METHOD0(IsMounted, bool(void));
53 MOCK_METHOD0(GetSystemSalt, CryptohomeBlob(void)); 42 MOCK_METHOD0(GetSystemSalt, CryptohomeBlob(void));
54 MOCK_METHOD1(AsyncDoAutomaticFreeDiskSpaceControl, bool(Delegate* callback));
55 MOCK_METHOD2(AsyncSetOwnerUser, bool(const std::string&, Delegate* callback)); 43 MOCK_METHOD2(AsyncSetOwnerUser, bool(const std::string&, Delegate* callback));
56 44
57 MOCK_METHOD0(TpmIsReady, bool(void)); 45 MOCK_METHOD0(TpmIsReady, bool(void));
58 MOCK_METHOD0(TpmIsEnabled, bool(void)); 46 MOCK_METHOD0(TpmIsEnabled, bool(void));
59 MOCK_METHOD0(TpmIsOwned, bool(void)); 47 MOCK_METHOD0(TpmIsOwned, bool(void));
60 MOCK_METHOD0(TpmIsBeingOwned, bool(void)); 48 MOCK_METHOD0(TpmIsBeingOwned, bool(void));
61 MOCK_METHOD1(TpmGetPassword, bool(std::string* password)); 49 MOCK_METHOD1(TpmGetPassword, bool(std::string* password));
62 MOCK_METHOD0(TpmCanAttemptOwnership, void(void)); 50 MOCK_METHOD0(TpmCanAttemptOwnership, void(void));
63 MOCK_METHOD0(TpmClearStoredPassword, void(void)); 51 MOCK_METHOD0(TpmClearStoredPassword, void(void));
64 MOCK_METHOD0(Pkcs11IsTpmTokenReady, bool(void)); 52 MOCK_METHOD0(Pkcs11IsTpmTokenReady, bool(void));
65 MOCK_METHOD2(Pkcs11GetTpmTokenInfo, void(std::string*, std::string*)); 53 MOCK_METHOD2(Pkcs11GetTpmTokenInfo, void(std::string*, std::string*));
66 54
67 MOCK_METHOD2(InstallAttributesGet, bool(const std::string&, std::string*)); 55 MOCK_METHOD2(InstallAttributesGet, bool(const std::string&, std::string*));
68 MOCK_METHOD2(InstallAttributesSet, bool(const std::string&, 56 MOCK_METHOD2(InstallAttributesSet, bool(const std::string&,
69 const std::string&)); 57 const std::string&));
70 MOCK_METHOD0(InstallAttributesCount, int(void));
71 MOCK_METHOD0(InstallAttributesFinalize, bool(void)); 58 MOCK_METHOD0(InstallAttributesFinalize, bool(void));
72 MOCK_METHOD0(InstallAttributesIsReady, bool(void)); 59 MOCK_METHOD0(InstallAttributesIsReady, bool(void));
73 MOCK_METHOD0(InstallAttributesIsSecure, bool(void));
74 MOCK_METHOD0(InstallAttributesIsInvalid, bool(void)); 60 MOCK_METHOD0(InstallAttributesIsInvalid, bool(void));
75 MOCK_METHOD0(InstallAttributesIsFirstInstall, bool(void)); 61 MOCK_METHOD0(InstallAttributesIsFirstInstall, bool(void));
76 62
77 void SetAsyncBehavior(bool outcome, int code) { 63 void SetAsyncBehavior(bool outcome, int code) {
78 outcome_ = outcome; 64 outcome_ = outcome;
79 code_ = code; 65 code_ = code;
80 } 66 }
81 67
82 bool DoCallback(Delegate* d) { 68 bool DoCallback(Delegate* d) {
83 d->OnComplete(outcome_, code_); 69 d->OnComplete(outcome_, code_);
84 return true; 70 return true;
85 } 71 }
86 72
87 private: 73 private:
88 bool outcome_; 74 bool outcome_;
89 int code_; 75 int code_;
90 DISALLOW_COPY_AND_ASSIGN(MockCryptohomeLibrary); 76 DISALLOW_COPY_AND_ASSIGN(MockCryptohomeLibrary);
91 }; 77 };
92 78
93 } // namespace chromeos 79 } // namespace chromeos
94 80
95 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_CRYPTOHOME_LIBRARY_H_ 81 #endif // CHROME_BROWSER_CHROMEOS_CROS_MOCK_CRYPTOHOME_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/cryptohome_library.cc ('k') | chrome/browser/chromeos/cros/mock_cryptohome_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698