Chromium Code Reviews| 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/browser/media_galleries/media_galleries_test_util.h" | 5 #include "chrome/browser/media_galleries/media_galleries_test_util.h" |
| 6 | 6 |
| 7 #include "base/base_paths.h" | |
| 7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 10 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 11 #include "chrome/browser/extensions/extension_prefs.h" | 12 #include "chrome/browser/extensions/extension_prefs.h" |
| 12 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 13 #include "chrome/browser/extensions/extension_system.h" | 14 #include "chrome/browser/extensions/extension_system.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 chrome::DIR_USER_VIDEOS, | 84 chrome::DIR_USER_VIDEOS, |
| 84 }; | 85 }; |
| 85 | 86 |
| 86 const char* kDirectoryNames[] = { | 87 const char* kDirectoryNames[] = { |
| 87 "music", | 88 "music", |
| 88 "pictures", | 89 "pictures", |
| 89 "videos", | 90 "videos", |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 for (size_t i = 0; i < arraysize(kDirectoryKeys); ++i) { | 93 for (size_t i = 0; i < arraysize(kDirectoryKeys); ++i) { |
| 94 // This is to make sure the tests don't think iTunes is installed (unless | |
| 95 // we control it specifically). | |
| 96 #if defined(OS_WIN) || defined(OS_MACOSX) | |
| 97 PathService::OverrideAndCreateIfNeeded( | |
|
Lei Zhang
2013/06/18 19:57:17
You can just use PathService::Override(), which is
Greg Billock
2013/06/19 05:13:15
Switched to using ScopedPathOverride, but was havi
Lei Zhang
2013/06/19 05:18:54
Doh, ping me when there's a patch set 2 and I'll t
| |
| 98 base::DIR_APP_DATA, fake_dir_.path().AppendASCII("itunes"), true); | |
| 99 #endif | |
| 100 | |
| 93 PathService::OverrideAndCreateIfNeeded( | 101 PathService::OverrideAndCreateIfNeeded( |
| 94 kDirectoryKeys[i], fake_dir_.path().AppendASCII(kDirectoryNames[i]), | 102 kDirectoryKeys[i], fake_dir_.path().AppendASCII(kDirectoryNames[i]), |
| 95 true /*create*/); | 103 true /*create*/); |
| 96 base::FilePath path; | 104 base::FilePath path; |
| 97 if (PathService::Get(kDirectoryKeys[i], &path) && | 105 if (PathService::Get(kDirectoryKeys[i], &path) && |
| 98 file_util::DirectoryExists(path)) { | 106 file_util::DirectoryExists(path)) { |
| 99 ++num_galleries_; | 107 ++num_galleries_; |
| 100 } | 108 } |
| 101 } | 109 } |
| 102 ASSERT_GT(num_galleries_, 0); | 110 ASSERT_GT(num_galleries_, 0); |
| 103 #endif | 111 #endif |
| 104 } | 112 } |
| 105 | 113 |
| 106 } // namespace chrome | 114 } // namespace chrome |
| OLD | NEW |