| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/common/media_galleries/picasa_test_util.h" | 5 #include "chrome/common/media_galleries/picasa_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" |
| 9 #include "chrome/common/media_galleries/picasa_types.h" | 10 #include "chrome/common/media_galleries/picasa_types.h" |
| 10 #include "chrome/common/media_galleries/pmp_test_util.h" | 11 #include "chrome/common/media_galleries/pmp_test_util.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace picasa { | 14 namespace picasa { |
| 14 | 15 |
| 15 void WriteAlbumTable(const base::FilePath& column_file_destination, | 16 void WriteAlbumTable(const base::FilePath& column_file_destination, |
| 16 const std::vector<uint32>& category_vector, | 17 const std::vector<uint32_t>& category_vector, |
| 17 const std::vector<double>& date_vector, | 18 const std::vector<double>& date_vector, |
| 18 const std::vector<std::string>& filename_vector, | 19 const std::vector<std::string>& filename_vector, |
| 19 const std::vector<std::string>& name_vector, | 20 const std::vector<std::string>& name_vector, |
| 20 const std::vector<std::string>& token_vector, | 21 const std::vector<std::string>& token_vector, |
| 21 const std::vector<std::string>& uid_vector) { | 22 const std::vector<std::string>& uid_vector) { |
| 22 ASSERT_TRUE(PmpTestUtil::WriteIndicatorFile( | 23 ASSERT_TRUE(PmpTestUtil::WriteIndicatorFile( |
| 23 column_file_destination, kPicasaAlbumTableName)); | 24 column_file_destination, kPicasaAlbumTableName)); |
| 24 ASSERT_TRUE(PmpTestUtil::WriteColumnFileFromVector( | 25 ASSERT_TRUE(PmpTestUtil::WriteColumnFileFromVector( |
| 25 column_file_destination, kPicasaAlbumTableName, "category", | 26 column_file_destination, kPicasaAlbumTableName, "category", |
| 26 PMP_TYPE_UINT32, category_vector)); | 27 PMP_TYPE_UINT32, category_vector)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 38 PMP_TYPE_STRING, token_vector)); | 39 PMP_TYPE_STRING, token_vector)); |
| 39 ASSERT_TRUE(PmpTestUtil::WriteColumnFileFromVector( | 40 ASSERT_TRUE(PmpTestUtil::WriteColumnFileFromVector( |
| 40 column_file_destination, kPicasaAlbumTableName, "uid", | 41 column_file_destination, kPicasaAlbumTableName, "uid", |
| 41 PMP_TYPE_STRING, uid_vector)); | 42 PMP_TYPE_STRING, uid_vector)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void WriteTestAlbumTable( | 45 void WriteTestAlbumTable( |
| 45 const base::FilePath& column_file_destination, | 46 const base::FilePath& column_file_destination, |
| 46 const base::FilePath& test_folder_1_path, | 47 const base::FilePath& test_folder_1_path, |
| 47 const base::FilePath& test_folder_2_path) { | 48 const base::FilePath& test_folder_2_path) { |
| 48 std::vector<uint32> category_vector; | 49 std::vector<uint32_t> category_vector; |
| 49 category_vector.push_back(kAlbumCategoryFolder); | 50 category_vector.push_back(kAlbumCategoryFolder); |
| 50 category_vector.push_back(kAlbumCategoryInvalid); | 51 category_vector.push_back(kAlbumCategoryInvalid); |
| 51 category_vector.push_back(kAlbumCategoryAlbum); | 52 category_vector.push_back(kAlbumCategoryAlbum); |
| 52 category_vector.push_back(kAlbumCategoryFolder); | 53 category_vector.push_back(kAlbumCategoryFolder); |
| 53 category_vector.push_back(kAlbumCategoryAlbum); | 54 category_vector.push_back(kAlbumCategoryAlbum); |
| 54 | 55 |
| 55 std::vector<double> date_vector; | 56 std::vector<double> date_vector; |
| 56 date_vector.push_back(0.0); | 57 date_vector.push_back(0.0); |
| 57 date_vector.push_back(0.0); | 58 date_vector.push_back(0.0); |
| 58 date_vector.push_back(0.0); | 59 date_vector.push_back(0.0); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 const char folder_2_test_ini[] = | 107 const char folder_2_test_ini[] = |
| 107 "[InFirstAlbumOnly.jpg]\n" | 108 "[InFirstAlbumOnly.jpg]\n" |
| 108 "albums=uid3\n"; | 109 "albums=uid3\n"; |
| 109 ASSERT_TRUE( | 110 ASSERT_TRUE( |
| 110 base::WriteFile(test_folder_2_path.AppendASCII(kPicasaINIFilename), | 111 base::WriteFile(test_folder_2_path.AppendASCII(kPicasaINIFilename), |
| 111 folder_2_test_ini, | 112 folder_2_test_ini, |
| 112 arraysize(folder_2_test_ini))); | 113 arraysize(folder_2_test_ini))); |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace picasa | 116 } // namespace picasa |
| OLD | NEW |