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 const base::FilePath& GetFakeAppDataPath() const { |
| 79 DCHECK(fake_dir_.IsValid()); |
| 80 return fake_dir_.path().AppendASCII("appdata"); |
| 81 } |
| 82 |
| 83 #if defined(OS_WIN) |
| 84 const base::FilePath& GetFakeLocalAppDataPath() const { |
| 85 DCHECK(fake_dir_.IsValid()); |
| 86 return fake_dir_.path().AppendASCII("localappdata"); |
| 87 } |
| 88 #endif |
| 89 |
78 void EnsureMediaDirectoriesExists::Init() { | 90 void EnsureMediaDirectoriesExists::Init() { |
79 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) | 91 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) |
80 return; | 92 return; |
81 #else | 93 #else |
82 | 94 |
83 ASSERT_TRUE(fake_dir_.CreateUniqueTempDir()); | 95 ASSERT_TRUE(fake_dir_.CreateUniqueTempDir()); |
84 | 96 |
85 #if defined(OS_WIN) || defined(OS_MACOSX) | 97 #if defined(OS_WIN) || defined(OS_MACOSX) |
86 // This is to make sure the tests don't think iTunes is installed (unless | 98 // This is to control whether or not tests think iTunes and Picasa are |
87 // we control it specifically). | 99 // installed. |
88 appdir_override_.reset(new base::ScopedPathOverride( | 100 app_data_override_.reset(new base::ScopedPathOverride( |
89 base::DIR_APP_DATA, fake_dir_.path().AppendASCII("itunes"))); | 101 base::DIR_APP_DATA, GetFakeAppDataPath())); |
| 102 #if defined(OS_WIN) |
| 103 // Picasa on Windows is in the DIR_LOCAL_APP_DATA directory. |
| 104 local_app_data_override_.reset(new base::ScopedPathOverride( |
| 105 base::DIR_LOCAL_APP_DATA, GetFakeLocalAppDataPath())); |
| 106 #endif |
90 #endif | 107 #endif |
91 | 108 |
92 music_override_.reset(new base::ScopedPathOverride( | 109 music_override_.reset(new base::ScopedPathOverride( |
93 chrome::DIR_USER_MUSIC, fake_dir_.path().AppendASCII("music"))); | 110 chrome::DIR_USER_MUSIC, fake_dir_.path().AppendASCII("music"))); |
94 pictures_override_.reset(new base::ScopedPathOverride( | 111 pictures_override_.reset(new base::ScopedPathOverride( |
95 chrome::DIR_USER_PICTURES, fake_dir_.path().AppendASCII("pictures"))); | 112 chrome::DIR_USER_PICTURES, fake_dir_.path().AppendASCII("pictures"))); |
96 video_override_.reset(new base::ScopedPathOverride( | 113 video_override_.reset(new base::ScopedPathOverride( |
97 chrome::DIR_USER_VIDEOS, fake_dir_.path().AppendASCII("videos"))); | 114 chrome::DIR_USER_VIDEOS, fake_dir_.path().AppendASCII("videos"))); |
98 num_galleries_ = 3; | 115 num_galleries_ = 3; |
99 #endif | 116 #endif |
100 } | 117 } |
OLD | NEW |