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/base_paths.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 EnsureMediaDirectoriesExists::EnsureMediaDirectoriesExists() | 70 EnsureMediaDirectoriesExists::EnsureMediaDirectoriesExists() |
71 : num_galleries_(0) { | 71 : num_galleries_(0) { |
72 Init(); | 72 Init(); |
73 } | 73 } |
74 | 74 |
75 EnsureMediaDirectoriesExists::~EnsureMediaDirectoriesExists() { | 75 EnsureMediaDirectoriesExists::~EnsureMediaDirectoriesExists() { |
76 } | 76 } |
77 | 77 |
| 78 base::FilePath EnsureMediaDirectoriesExists::GetFakeAppDataPath() const { |
| 79 DCHECK(fake_dir_.IsValid()); |
| 80 return fake_dir_.path().AppendASCII("appdata"); |
| 81 } |
| 82 |
| 83 #if defined(OS_WIN) |
| 84 base::FilePath EnsureMediaDirectoriesExists::GetFakeLocalAppDataPath() const { |
| 85 DCHECK(fake_dir_.IsValid()); |
| 86 return fake_dir_.path().AppendASCII("localappdata"); |
| 87 } |
| 88 #endif |
| 89 |
| 90 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 91 base::FilePath |
| 92 EnsureMediaDirectoriesExists::GetFakePicasaFoldersRootPath() const { |
| 93 DCHECK(fake_dir_.IsValid()); |
| 94 return fake_dir_.path().AppendASCII("picasa_folders"); |
| 95 } |
| 96 #endif |
| 97 |
78 void EnsureMediaDirectoriesExists::Init() { | 98 void EnsureMediaDirectoriesExists::Init() { |
79 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 99 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
80 return; | 100 return; |
81 #else | 101 #else |
82 | 102 |
83 ASSERT_TRUE(fake_dir_.CreateUniqueTempDir()); | 103 ASSERT_TRUE(fake_dir_.CreateUniqueTempDir()); |
84 | 104 |
85 #if defined(OS_WIN) || defined(OS_MACOSX) | 105 #if defined(OS_WIN) || defined(OS_MACOSX) |
86 // This is to make sure the tests don't think iTunes is installed (unless | 106 // This is to control whether or not tests think iTunes and Picasa are |
87 // we control it specifically). | 107 // installed. |
88 appdir_override_.reset(new base::ScopedPathOverride( | 108 app_data_override_.reset(new base::ScopedPathOverride( |
89 base::DIR_APP_DATA, fake_dir_.path().AppendASCII("itunes"))); | 109 base::DIR_APP_DATA, GetFakeAppDataPath())); |
| 110 #if defined(OS_WIN) |
| 111 // Picasa on Windows is in the DIR_LOCAL_APP_DATA directory. |
| 112 local_app_data_override_.reset(new base::ScopedPathOverride( |
| 113 base::DIR_LOCAL_APP_DATA, GetFakeLocalAppDataPath())); |
| 114 #endif |
90 #endif | 115 #endif |
91 | 116 |
92 music_override_.reset(new base::ScopedPathOverride( | 117 music_override_.reset(new base::ScopedPathOverride( |
93 chrome::DIR_USER_MUSIC, fake_dir_.path().AppendASCII("music"))); | 118 chrome::DIR_USER_MUSIC, fake_dir_.path().AppendASCII("music"))); |
94 pictures_override_.reset(new base::ScopedPathOverride( | 119 pictures_override_.reset(new base::ScopedPathOverride( |
95 chrome::DIR_USER_PICTURES, fake_dir_.path().AppendASCII("pictures"))); | 120 chrome::DIR_USER_PICTURES, fake_dir_.path().AppendASCII("pictures"))); |
96 video_override_.reset(new base::ScopedPathOverride( | 121 video_override_.reset(new base::ScopedPathOverride( |
97 chrome::DIR_USER_VIDEOS, fake_dir_.path().AppendASCII("videos"))); | 122 chrome::DIR_USER_VIDEOS, fake_dir_.path().AppendASCII("videos"))); |
98 num_galleries_ = 3; | 123 num_galleries_ = 3; |
99 #endif | 124 #endif |
100 } | 125 } |
OLD | NEW |