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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/safe_numerics.h" | 10 #include "base/safe_numerics.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 &file_size)); | 159 &file_size)); |
160 test_jpg_size_ = base::checked_numeric_cast<int>(file_size); | 160 test_jpg_size_ = base::checked_numeric_cast<int>(file_size); |
161 } | 161 } |
162 | 162 |
163 #if defined(OS_WIN) || defined(OS_MACOSX) | 163 #if defined(OS_WIN) || defined(OS_MACOSX) |
164 void PopulatePicasaTestData(const base::FilePath& picasa_app_data_root) { | 164 void PopulatePicasaTestData(const base::FilePath& picasa_app_data_root) { |
165 base::FilePath picasa_database_path = | 165 base::FilePath picasa_database_path = |
166 picasa::MakePicasaDatabasePath(picasa_app_data_root); | 166 picasa::MakePicasaDatabasePath(picasa_app_data_root); |
167 base::FilePath picasa_temp_dir_path = | 167 base::FilePath picasa_temp_dir_path = |
168 picasa_database_path.DirName().AppendASCII(picasa::kPicasaTempDirName); | 168 picasa_database_path.DirName().AppendASCII(picasa::kPicasaTempDirName); |
169 ASSERT_TRUE(file_util::CreateDirectory(picasa_database_path)); | 169 ASSERT_TRUE(base::CreateDirectory(picasa_database_path)); |
170 ASSERT_TRUE(file_util::CreateDirectory(picasa_temp_dir_path)); | 170 ASSERT_TRUE(base::CreateDirectory(picasa_temp_dir_path)); |
171 | 171 |
172 // Create fake folder directories. | 172 // Create fake folder directories. |
173 base::FilePath folders_root = | 173 base::FilePath folders_root = |
174 ensure_media_directories_exists_->GetFakePicasaFoldersRootPath(); | 174 ensure_media_directories_exists_->GetFakePicasaFoldersRootPath(); |
175 base::FilePath fake_folder_1 = folders_root.AppendASCII("folder1"); | 175 base::FilePath fake_folder_1 = folders_root.AppendASCII("folder1"); |
176 base::FilePath fake_folder_2 = folders_root.AppendASCII("folder2"); | 176 base::FilePath fake_folder_2 = folders_root.AppendASCII("folder2"); |
177 ASSERT_TRUE(file_util::CreateDirectory(fake_folder_1)); | 177 ASSERT_TRUE(base::CreateDirectory(fake_folder_1)); |
178 ASSERT_TRUE(file_util::CreateDirectory(fake_folder_2)); | 178 ASSERT_TRUE(base::CreateDirectory(fake_folder_2)); |
179 | 179 |
180 // Write folder and album contents. | 180 // Write folder and album contents. |
181 picasa::WriteTestAlbumTable( | 181 picasa::WriteTestAlbumTable( |
182 picasa_database_path, fake_folder_1, fake_folder_2); | 182 picasa_database_path, fake_folder_1, fake_folder_2); |
183 picasa::WriteTestAlbumsImagesIndex(fake_folder_1, fake_folder_2); | 183 picasa::WriteTestAlbumsImagesIndex(fake_folder_1, fake_folder_2); |
184 | 184 |
185 base::FilePath test_jpg_path = GetCommonDataDir().AppendASCII("test.jpg"); | 185 base::FilePath test_jpg_path = GetCommonDataDir().AppendASCII("test.jpg"); |
186 ASSERT_TRUE(base::CopyFile( | 186 ASSERT_TRUE(base::CopyFile( |
187 test_jpg_path, fake_folder_1.AppendASCII("InBoth.jpg"))); | 187 test_jpg_path, fake_folder_1.AppendASCII("InBoth.jpg"))); |
188 ASSERT_TRUE(base::CopyFile( | 188 ASSERT_TRUE(base::CopyFile( |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 IN_PROC_BROWSER_TEST_F(MediaGalleriesPlatformAppBrowserTest, | 292 IN_PROC_BROWSER_TEST_F(MediaGalleriesPlatformAppBrowserTest, |
293 PicasaCustomLocation) { | 293 PicasaCustomLocation) { |
294 base::ScopedTempDir custom_picasa_app_data_root; | 294 base::ScopedTempDir custom_picasa_app_data_root; |
295 ASSERT_TRUE(custom_picasa_app_data_root.CreateUniqueTempDir()); | 295 ASSERT_TRUE(custom_picasa_app_data_root.CreateUniqueTempDir()); |
296 ensure_media_directories_exists()->SetCustomPicasaAppDataPath( | 296 ensure_media_directories_exists()->SetCustomPicasaAppDataPath( |
297 custom_picasa_app_data_root.path()); | 297 custom_picasa_app_data_root.path()); |
298 PopulatePicasaTestData(custom_picasa_app_data_root.path()); | 298 PopulatePicasaTestData(custom_picasa_app_data_root.path()); |
299 ASSERT_TRUE(RunMediaGalleriesTest("picasa")) << message_; | 299 ASSERT_TRUE(RunMediaGalleriesTest("picasa")) << message_; |
300 } | 300 } |
301 #endif // defined(OS_WIN) || defined(OS_MACOSX) | 301 #endif // defined(OS_WIN) || defined(OS_MACOSX) |
OLD | NEW |