| 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 | 10 |
| 10 namespace net { | 11 namespace net { |
| 11 | 12 |
| 12 namespace { | 13 namespace { |
| 13 const base::FilePath::CharType kCertificateRelativePath[] = | 14 const base::FilePath::CharType kCertificateRelativePath[] = |
| 14 FILE_PATH_LITERAL("net/data/ssl/certificates"); | 15 FILE_PATH_LITERAL("net/data/ssl/certificates"); |
| 15 } // namespace | 16 } // namespace |
| 16 | 17 |
| 17 base::FilePath GetTestCertsDirectory() { | 18 base::FilePath GetTestCertsDirectory() { |
| 18 base::FilePath src_root; | 19 base::FilePath src_root; |
| 19 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); | 20 { |
| 21 base::ThreadRestrictions::ScopedAllowIO allow_io_for_path_service; |
| 22 PathService::Get(base::DIR_SOURCE_ROOT, &src_root); |
| 23 } |
| 24 |
| 20 return src_root.Append(kCertificateRelativePath); | 25 return src_root.Append(kCertificateRelativePath); |
| 21 } | 26 } |
| 22 | 27 |
| 23 base::FilePath GetTestClientCertsDirectory() { | 28 base::FilePath GetTestClientCertsDirectory() { |
| 24 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 25 return base::FilePath(kCertificateRelativePath); | 30 return base::FilePath(kCertificateRelativePath); |
| 26 #else | 31 #else |
| 27 return GetTestCertsDirectory(); | 32 return GetTestCertsDirectory(); |
| 28 #endif | 33 #endif |
| 29 } | 34 } |
| 30 | 35 |
| 31 base::FilePath GetWebSocketTestDataDirectory() { | 36 base::FilePath GetWebSocketTestDataDirectory() { |
| 32 base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); | 37 base::FilePath data_dir(FILE_PATH_LITERAL("net/data/websocket")); |
| 33 return data_dir; | 38 return data_dir; |
| 34 } | 39 } |
| 35 | 40 |
| 36 } // namespace net | 41 } // namespace net |
| OLD | NEW |