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 kNetDataRelativePath[] = | |
15 FILE_PATH_LITERAL("net/data/"); | |
14 const base::FilePath::CharType kCertificateRelativePath[] = | 16 const base::FilePath::CharType kCertificateRelativePath[] = |
15 FILE_PATH_LITERAL("net/data/ssl/certificates"); | 17 FILE_PATH_LITERAL("net/data/ssl/certificates"); |
16 } // namespace | 18 } // namespace |
17 | 19 |
20 base::FilePath GetTestNetDataDirectory() { | |
21 base::FilePath src_root; | |
22 { | |
23 base::ThreadRestrictions::ScopedAllowIO allow_io_for_path_service; | |
24 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); | |
25 } | |
26 | |
27 return src_root.Append(kNetDataRelativePath); | |
28 } | |
29 | |
18 base::FilePath GetTestCertsDirectory() { | 30 base::FilePath GetTestCertsDirectory() { |
eroman
2017/05/05 17:55:29
Should this be re-implemented in terms of GetTestN
mattm
2017/05/05 19:58:39
Done.
| |
19 base::FilePath src_root; | 31 base::FilePath src_root; |
20 { | 32 { |
21 base::ThreadRestrictions::ScopedAllowIO allow_io_for_path_service; | 33 base::ThreadRestrictions::ScopedAllowIO allow_io_for_path_service; |
22 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); | 34 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); |
23 } | 35 } |
24 | 36 |
25 return src_root.Append(kCertificateRelativePath); | 37 return src_root.Append(kCertificateRelativePath); |
26 } | 38 } |
27 | 39 |
28 base::FilePath GetTestClientCertsDirectory() { | 40 base::FilePath GetTestClientCertsDirectory() { |
29 #if defined(OS_ANDROID) | 41 #if defined(OS_ANDROID) |
30 return base::FilePath(kCertificateRelativePath); | 42 return base::FilePath(kCertificateRelativePath); |
31 #else | 43 #else |
32 return GetTestCertsDirectory(); | 44 return GetTestCertsDirectory(); |
33 #endif | 45 #endif |
34 } | 46 } |
35 | 47 |
36 base::FilePath GetWebSocketTestDataDirectory() { | 48 base::FilePath GetWebSocketTestDataDirectory() { |
37 base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); | 49 base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); |
38 return data_dir; | 50 return data_dir; |
39 } | 51 } |
40 | 52 |
41 } // namespace net | 53 } // namespace net |
OLD | NEW |