OLD | NEW |
1 // Copyright (c) 2010 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_LOGIN_MOCK_OWNER_KEY_UTILS_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_OWNER_KEY_UTILS_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_OWNER_KEY_UTILS_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_OWNER_KEY_UTILS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/crypto/rsa_private_key.h" | |
13 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "crypto/rsa_private_key.h" |
14 #include "chrome/browser/chromeos/cros/login_library.h" | 14 #include "chrome/browser/chromeos/cros/login_library.h" |
15 #include "chrome/browser/chromeos/login/owner_key_utils.h" | 15 #include "chrome/browser/chromeos/login/owner_key_utils.h" |
16 #include "content/browser/browser_thread.h" | 16 #include "content/browser/browser_thread.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 using ::base::RSAPrivateKey; | |
21 | |
22 namespace chromeos { | 20 namespace chromeos { |
23 | 21 |
24 class MockKeyUtils : public OwnerKeyUtils { | 22 class MockKeyUtils : public OwnerKeyUtils { |
25 public: | 23 public: |
26 MockKeyUtils() {} | 24 MockKeyUtils() {} |
27 MOCK_METHOD2(ImportPublicKey, bool(const FilePath& key_file, | 25 MOCK_METHOD2(ImportPublicKey, bool(const FilePath& key_file, |
28 std::vector<uint8>* output)); | 26 std::vector<uint8>* output)); |
29 MOCK_METHOD3(Verify, bool(const std::string& data, | 27 MOCK_METHOD3(Verify, bool(const std::string& data, |
30 const std::vector<uint8> signature, | 28 const std::vector<uint8> signature, |
31 const std::vector<uint8> public_key)); | 29 const std::vector<uint8> public_key)); |
32 MOCK_METHOD3(Sign, bool(const std::string& data, | 30 MOCK_METHOD3(Sign, bool(const std::string& data, |
33 std::vector<uint8>* OUT_signature, | 31 std::vector<uint8>* OUT_signature, |
34 base::RSAPrivateKey* key)); | 32 crypto::RSAPrivateKey* key)); |
35 MOCK_METHOD1(FindPrivateKey, RSAPrivateKey*(const std::vector<uint8>& key)); | 33 MOCK_METHOD1(FindPrivateKey, |
| 34 crypto::RSAPrivateKey*(const std::vector<uint8>& key)); |
36 MOCK_METHOD0(GetOwnerKeyFilePath, FilePath()); | 35 MOCK_METHOD0(GetOwnerKeyFilePath, FilePath()); |
37 MOCK_METHOD2(ExportPublicKeyToFile, bool(base::RSAPrivateKey* pair, | 36 MOCK_METHOD2(ExportPublicKeyToFile, bool(crypto::RSAPrivateKey* pair, |
38 const FilePath& key_file)); | 37 const FilePath& key_file)); |
39 protected: | 38 protected: |
40 virtual ~MockKeyUtils() {} | 39 virtual ~MockKeyUtils() {} |
41 | 40 |
42 private: | 41 private: |
43 DISALLOW_COPY_AND_ASSIGN(MockKeyUtils); | 42 DISALLOW_COPY_AND_ASSIGN(MockKeyUtils); |
44 }; | 43 }; |
45 | 44 |
46 class MockInjector : public OwnerKeyUtils::Factory { | 45 class MockInjector : public OwnerKeyUtils::Factory { |
47 public: | 46 public: |
(...skipping 10 matching lines...) Expand all Loading... |
58 } | 57 } |
59 | 58 |
60 private: | 59 private: |
61 scoped_refptr<MockKeyUtils> transient_; | 60 scoped_refptr<MockKeyUtils> transient_; |
62 DISALLOW_COPY_AND_ASSIGN(MockInjector); | 61 DISALLOW_COPY_AND_ASSIGN(MockInjector); |
63 }; | 62 }; |
64 | 63 |
65 } // namespace chromeos | 64 } // namespace chromeos |
66 | 65 |
67 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_OWNER_KEY_UTILS_H_ | 66 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_OWNER_KEY_UTILS_H_ |
OLD | NEW |