OLD | NEW |
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 NET_BASE_TEST_ROOT_CERTS_H_ | 5 #ifndef NET_BASE_TEST_ROOT_CERTS_H_ |
6 #define NET_BASE_TEST_ROOT_CERTS_H_ | 6 #define NET_BASE_TEST_ROOT_CERTS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "net/base/net_api.h" | 11 #include "net/base/net_export.h" |
12 | 12 |
13 #if defined(OS_WIN) | 13 #if defined(OS_WIN) |
14 #include <windows.h> | 14 #include <windows.h> |
15 #include <wincrypt.h> | 15 #include <wincrypt.h> |
16 #elif defined(OS_MACOSX) | 16 #elif defined(OS_MACOSX) |
17 #include <CoreFoundation/CFArray.h> | 17 #include <CoreFoundation/CFArray.h> |
18 #include <Security/SecTrust.h> | 18 #include <Security/SecTrust.h> |
19 #include "base/mac/scoped_cftyperef.h" | 19 #include "base/mac/scoped_cftyperef.h" |
20 #elif defined(USE_NSS) | 20 #elif defined(USE_NSS) |
21 #include <list> | 21 #include <list> |
22 #endif | 22 #endif |
23 | 23 |
24 class FilePath; | 24 class FilePath; |
25 | 25 |
26 namespace net { | 26 namespace net { |
27 | 27 |
28 class X509Certificate; | 28 class X509Certificate; |
29 | 29 |
30 // TestRootCerts is a helper class for unit tests that is used to | 30 // TestRootCerts is a helper class for unit tests that is used to |
31 // artificially mark a certificate as trusted, independent of the local | 31 // artificially mark a certificate as trusted, independent of the local |
32 // machine configuration. | 32 // machine configuration. |
33 class NET_TEST TestRootCerts { | 33 class NET_EXPORT_PRIVATE TestRootCerts { |
34 public: | 34 public: |
35 // Obtains the Singleton instance to the trusted certificates. | 35 // Obtains the Singleton instance to the trusted certificates. |
36 static TestRootCerts* GetInstance(); | 36 static TestRootCerts* GetInstance(); |
37 | 37 |
38 // Returns true if an instance exists, without forcing an initialization. | 38 // Returns true if an instance exists, without forcing an initialization. |
39 static bool HasInstance(); | 39 static bool HasInstance(); |
40 | 40 |
41 // Marks |certificate| as trusted for X509Certificate::Verify(). Returns | 41 // Marks |certificate| as trusted for X509Certificate::Verify(). Returns |
42 // false if the certificate could not be marked trusted. | 42 // false if the certificate could not be marked trusted. |
43 bool Add(X509Certificate* certificate); | 43 bool Add(X509Certificate* certificate); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // True if there are no temporarily trusted root certificates. | 95 // True if there are no temporarily trusted root certificates. |
96 bool empty_; | 96 bool empty_; |
97 #endif | 97 #endif |
98 | 98 |
99 DISALLOW_COPY_AND_ASSIGN(TestRootCerts); | 99 DISALLOW_COPY_AND_ASSIGN(TestRootCerts); |
100 }; | 100 }; |
101 | 101 |
102 } // namespace net | 102 } // namespace net |
103 | 103 |
104 #endif // NET_BASE_TEST_ROOT_CERTS_H_ | 104 #endif // NET_BASE_TEST_ROOT_CERTS_H_ |
OLD | NEW |