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

Side by Side Diff: components/ownership/mock_owner_key_util.h

Issue 494093002: OwnerKeyUtil is moved to components/ownership. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed GYP file. Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « components/ownership/OWNERS ('k') | components/ownership/mock_owner_key_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ 5 #ifndef COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_
6 #define CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ 6 #define COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/chromeos/settings/owner_key_util.h" 14 #include "components/ownership/owner_key_util.h"
15 #include "components/ownership/ownership_export.h"
15 16
16 namespace chromeos { 17 namespace ownership {
17 18
18 class MockOwnerKeyUtil : public OwnerKeyUtil { 19 // Implementation of OwnerKeyUtil which should be used only for
20 // testing.
21 class OWNERSHIP_EXPORT MockOwnerKeyUtil : public OwnerKeyUtil {
19 public: 22 public:
20 MockOwnerKeyUtil(); 23 MockOwnerKeyUtil();
21 24
22 // OwnerKeyUtil: 25 // OwnerKeyUtil implementation:
23 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE; 26 virtual bool ImportPublicKey(std::vector<uint8>* output) OVERRIDE;
27 #if defined(USE_NSS)
24 virtual crypto::RSAPrivateKey* FindPrivateKeyInSlot( 28 virtual crypto::RSAPrivateKey* FindPrivateKeyInSlot(
25 const std::vector<uint8>& key, 29 const std::vector<uint8>& key,
26 PK11SlotInfo* slot) OVERRIDE; 30 PK11SlotInfo* slot) OVERRIDE;
31 #endif // defined(USE_NSS)
27 virtual bool IsPublicKeyPresent() OVERRIDE; 32 virtual bool IsPublicKeyPresent() OVERRIDE;
28 33
29 // Clears the public and private keys. 34 // Clears the public and private keys.
30 void Clear(); 35 void Clear();
31 36
32 // Configures the mock to return the given public key. 37 // Configures the mock to return the given public key.
33 void SetPublicKey(const std::vector<uint8>& key); 38 void SetPublicKey(const std::vector<uint8>& key);
34 39
35 // Sets the public key to use from the given private key, but doesn't 40 // Sets the public key to use from the given private key, but doesn't
36 // configure the private key. 41 // configure the private key.
37 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key); 42 void SetPublicKeyFromPrivateKey(const crypto::RSAPrivateKey& key);
38 43
39 // Sets the private key (also configures the public key). 44 // Sets the private key (also configures the public key).
40 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key); 45 void SetPrivateKey(scoped_ptr<crypto::RSAPrivateKey> key);
41 46
42 protected: 47 private:
43 virtual ~MockOwnerKeyUtil(); 48 virtual ~MockOwnerKeyUtil();
44 49
45 private:
46 std::vector<uint8> public_key_; 50 std::vector<uint8> public_key_;
47 scoped_ptr<crypto::RSAPrivateKey> private_key_; 51 scoped_ptr<crypto::RSAPrivateKey> private_key_;
48 52
49 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil); 53 DISALLOW_COPY_AND_ASSIGN(MockOwnerKeyUtil);
50 }; 54 };
51 55
52 } // namespace chromeos 56 } // namespace ownership
53 57
54 #endif // CHROME_BROWSER_CHROMEOS_SETTINGS_MOCK_OWNER_KEY_UTIL_H_ 58 #endif // COMPONENTS_OWNERSHIP_MOCK_OWNER_KEY_UTIL_H_
OLDNEW
« no previous file with comments | « components/ownership/OWNERS ('k') | components/ownership/mock_owner_key_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698