Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FAKE_CRYPTOHOME_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 155 |
| 156 // Changes the behavior of WaitForServiceToBeAvailable(). This method runs | 156 // Changes the behavior of WaitForServiceToBeAvailable(). This method runs |
| 157 // pending callbacks if is_available is true. | 157 // pending callbacks if is_available is true. |
| 158 void SetServiceIsAvailable(bool is_available); | 158 void SetServiceIsAvailable(bool is_available); |
| 159 | 159 |
| 160 // Sets the unmount result of Unmount() call. | 160 // Sets the unmount result of Unmount() call. |
| 161 void set_unmount_result(bool result) { | 161 void set_unmount_result(bool result) { |
| 162 unmount_result_= result; | 162 unmount_result_= result; |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Sets the system salt which will be returned from GetSystemSalt(). | |
| 166 void set_system_salt(const std::vector<uint8>& system_salt) { | |
| 167 system_salt_ = system_salt; | |
| 168 } | |
| 169 | |
| 165 // Returns the stub system salt as raw bytes. (not as a string encoded in the | 170 // Returns the stub system salt as raw bytes. (not as a string encoded in the |
| 166 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). | 171 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). |
|
hashimoto
2013/10/24 07:49:01
nit: Could you make it clear that GetSystemSalt()
satorux1
2013/10/24 08:31:28
Done.
| |
| 167 static std::vector<uint8> GetStubSystemSalt(); | 172 static std::vector<uint8> GetStubSystemSalt(); |
| 168 | 173 |
| 169 private: | 174 private: |
| 170 // Posts tasks which return fake results to the UI thread. | 175 // Posts tasks which return fake results to the UI thread. |
| 171 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback, | 176 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback, |
| 172 bool returns_data); | 177 bool returns_data); |
| 173 | 178 |
| 174 // This method is used to implement ReturnAsyncMethodResult. | 179 // This method is used to implement ReturnAsyncMethodResult. |
| 175 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, | 180 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, |
| 176 bool returns_data); | 181 bool returns_data); |
| 177 | 182 |
| 178 bool service_is_available_; | 183 bool service_is_available_; |
| 179 int async_call_id_; | 184 int async_call_id_; |
| 180 AsyncCallStatusHandler async_call_status_handler_; | 185 AsyncCallStatusHandler async_call_status_handler_; |
| 181 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 186 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
| 182 int tpm_is_ready_counter_; | 187 int tpm_is_ready_counter_; |
| 183 bool unmount_result_; | 188 bool unmount_result_; |
| 189 std::vector<uint8> system_salt_; | |
| 184 | 190 |
| 185 std::vector<WaitForServiceToBeAvailableCallback> | 191 std::vector<WaitForServiceToBeAvailableCallback> |
| 186 pending_wait_for_service_to_be_available_callbacks_; | 192 pending_wait_for_service_to_be_available_callbacks_; |
| 187 | 193 |
| 188 // A stub store for InstallAttributes, mapping an attribute name to the | 194 // A stub store for InstallAttributes, mapping an attribute name to the |
| 189 // associated data blob. Used to implement InstallAttributesSet and -Get. | 195 // associated data blob. Used to implement InstallAttributesSet and -Get. |
| 190 std::map<std::string, std::vector<uint8> > install_attrs_; | 196 std::map<std::string, std::vector<uint8> > install_attrs_; |
| 191 bool locked_; | 197 bool locked_; |
| 192 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 198 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
| 193 | 199 |
| 194 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 200 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
| 195 }; | 201 }; |
| 196 | 202 |
| 197 } // namespace chromeos | 203 } // namespace chromeos |
| 198 | 204 |
| 199 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 205 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |