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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 // Valid file, should show up in JS as a FileEntry. | 149 // Valid file, should show up in JS as a FileEntry. |
150 ASSERT_TRUE(base::CopyFile(test_data_path.AppendASCII("test.jpg"), | 150 ASSERT_TRUE(base::CopyFile(test_data_path.AppendASCII("test.jpg"), |
151 write_path.AppendASCII("test.jpg"))); | 151 write_path.AppendASCII("test.jpg"))); |
152 | 152 |
153 // Invalid file, should not show up as a FileEntry in JS at all. | 153 // Invalid file, should not show up as a FileEntry in JS at all. |
154 ASSERT_TRUE(base::CopyFile(test_data_path.AppendASCII("test.txt"), | 154 ASSERT_TRUE(base::CopyFile(test_data_path.AppendASCII("test.txt"), |
155 write_path.AppendASCII("test.txt"))); | 155 write_path.AppendASCII("test.txt"))); |
156 | 156 |
157 int64 file_size; | 157 int64 file_size; |
158 ASSERT_TRUE(file_util::GetFileSize(test_data_path.AppendASCII("test.jpg"), | 158 ASSERT_TRUE(base::GetFileSize(test_data_path.AppendASCII("test.jpg"), |
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(base::CreateDirectory(picasa_database_path)); | 169 ASSERT_TRUE(base::CreateDirectory(picasa_database_path)); |
(...skipping 122 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 |