OLD | NEW |
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 #include "net/test/test_data_directory.h" | 5 #include "net/test/test_data_directory.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 namespace { | 13 namespace { |
14 const base::FilePath::CharType kCertificateRelativePath[] = | 14 |
15 FILE_PATH_LITERAL("net/data/ssl/certificates"); | 15 // Net data directory, relative to source root. |
| 16 const base::FilePath::CharType kNetDataRelativePath[] = |
| 17 FILE_PATH_LITERAL("net/data"); |
| 18 |
| 19 // Test certificates directory, relative to kNetDataRelativePath. |
| 20 const base::FilePath::CharType kCertificateDataSubPath[] = |
| 21 FILE_PATH_LITERAL("ssl/certificates"); |
| 22 |
16 } // namespace | 23 } // namespace |
17 | 24 |
18 base::FilePath GetTestCertsDirectory() { | 25 base::FilePath GetTestNetDataDirectory() { |
19 base::FilePath src_root; | 26 base::FilePath src_root; |
20 { | 27 { |
21 base::ThreadRestrictions::ScopedAllowIO allow_io_for_path_service; | 28 base::ThreadRestrictions::ScopedAllowIO allow_io_for_path_service; |
22 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); | 29 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); |
23 } | 30 } |
24 | 31 |
25 return src_root.Append(kCertificateRelativePath); | 32 return src_root.Append(kNetDataRelativePath); |
| 33 } |
| 34 |
| 35 base::FilePath GetTestCertsDirectory() { |
| 36 return GetTestNetDataDirectory().Append(kCertificateDataSubPath); |
26 } | 37 } |
27 | 38 |
28 base::FilePath GetTestClientCertsDirectory() { | 39 base::FilePath GetTestClientCertsDirectory() { |
29 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
30 return base::FilePath(kCertificateRelativePath); | 41 return base::FilePath(kNetDataRelativePath).Append(kCertificateDataSubPath); |
31 #else | 42 #else |
32 return GetTestCertsDirectory(); | 43 return GetTestCertsDirectory(); |
33 #endif | 44 #endif |
34 } | 45 } |
35 | 46 |
36 base::FilePath GetWebSocketTestDataDirectory() { | 47 base::FilePath GetWebSocketTestDataDirectory() { |
37 base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); | 48 base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); |
38 return data_dir; | 49 return data_dir; |
39 } | 50 } |
40 | 51 |
41 } // namespace net | 52 } // namespace net |
OLD | NEW |