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 "chrome/common/chrome_paths.h" | 5 #include "chrome/common/chrome_paths.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/bundle_locations.h" | 10 #include "base/mac/bundle_locations.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
15 #include "base/version.h" | 15 #include "base/version.h" |
16 #include "chrome/common/chrome_constants.h" | 16 #include "chrome/common/chrome_constants.h" |
17 #include "chrome/common/chrome_paths_internal.h" | 17 #include "chrome/common/chrome_paths_internal.h" |
18 #include "chrome/common/widevine_cdm_constants.h" | 18 #include "chrome/common/widevine_cdm_constants.h" |
19 #include "ui/base/ui_base_paths.h" | 19 #include "ui/base/ui_base_paths.h" |
20 | 20 |
21 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
22 #include "base/android/path_utils.h" | 22 #include "base/android/path_utils.h" |
| 23 #include "base/base_paths_android.h" |
23 #endif | 24 #endif |
24 | 25 |
25 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
26 #include "base/mac/foundation_util.h" | 27 #include "base/mac/foundation_util.h" |
27 #endif | 28 #endif |
28 | 29 |
29 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 30 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 case chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS: | 428 case chrome::DIR_SUPERVISED_USERS_DEFAULT_APPS: |
428 if (!PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, &cur)) | 429 if (!PathService::Get(chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS, &cur)) |
429 return false; | 430 return false; |
430 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); | 431 cur = cur.Append(FILE_PATH_LITERAL("managed_users")); |
431 break; | 432 break; |
432 #endif | 433 #endif |
433 // The following are only valid in the development environment, and | 434 // The following are only valid in the development environment, and |
434 // will fail if executed from an installed executable (because the | 435 // will fail if executed from an installed executable (because the |
435 // generated path won't exist). | 436 // generated path won't exist). |
436 case chrome::DIR_GEN_TEST_DATA: | 437 case chrome::DIR_GEN_TEST_DATA: |
| 438 #if defined(OS_ANDROID) |
| 439 // On Android, our tests don't have permission to write to DIR_MODULE. |
| 440 // gtest/test_runner.py pushes data to external storage. |
| 441 if (!PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &cur)) |
| 442 return false; |
| 443 #else |
437 if (!PathService::Get(base::DIR_MODULE, &cur)) | 444 if (!PathService::Get(base::DIR_MODULE, &cur)) |
438 return false; | 445 return false; |
| 446 #endif |
439 cur = cur.Append(FILE_PATH_LITERAL("test_data")); | 447 cur = cur.Append(FILE_PATH_LITERAL("test_data")); |
440 if (!base::PathExists(cur)) // We don't want to create this. | 448 if (!base::PathExists(cur)) // We don't want to create this. |
441 return false; | 449 return false; |
442 break; | 450 break; |
443 case chrome::DIR_TEST_DATA: | 451 case chrome::DIR_TEST_DATA: |
444 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) | 452 if (!PathService::Get(base::DIR_SOURCE_ROOT, &cur)) |
445 return false; | 453 return false; |
446 cur = cur.Append(FILE_PATH_LITERAL("chrome")); | 454 cur = cur.Append(FILE_PATH_LITERAL("chrome")); |
447 cur = cur.Append(FILE_PATH_LITERAL("test")); | 455 cur = cur.Append(FILE_PATH_LITERAL("test")); |
448 cur = cur.Append(FILE_PATH_LITERAL("data")); | 456 cur = cur.Append(FILE_PATH_LITERAL("data")); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 | 604 |
597 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { | 605 void SetInvalidSpecifiedUserDataDir(const base::FilePath& user_data_dir) { |
598 g_invalid_specified_user_data_dir.Get() = user_data_dir; | 606 g_invalid_specified_user_data_dir.Get() = user_data_dir; |
599 } | 607 } |
600 | 608 |
601 const base::FilePath& GetInvalidSpecifiedUserDataDir() { | 609 const base::FilePath& GetInvalidSpecifiedUserDataDir() { |
602 return g_invalid_specified_user_data_dir.Get(); | 610 return g_invalid_specified_user_data_dir.Get(); |
603 } | 611 } |
604 | 612 |
605 } // namespace chrome | 613 } // namespace chrome |
OLD | NEW |