| 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 #ifndef WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_ | 5 #ifndef WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_ |
| 6 #define WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_ | 6 #define WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "webkit/fileapi/media/picasa/pmp_constants.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 14 | 15 |
| 15 class FilePath; | 16 class FilePath; |
| 16 | 17 |
| 17 } // namespace base | 18 } // namespace base |
| 18 | 19 |
| 19 namespace picasaimport { | 20 namespace picasaimport { |
| 20 | 21 |
| 21 class PmpColumnReader; | 22 class PmpColumnReader; |
| 22 | 23 |
| 23 // A helper class used for unit tests only | 24 // A helper class used for unit tests only |
| 24 class PmpTestHelper { | 25 class PmpTestHelper { |
| 25 public: | 26 public: |
| 26 PmpTestHelper(); | 27 PmpTestHelper(); |
| 27 | 28 |
| 28 bool Init(); | 29 bool Init(); |
| 29 | 30 |
| 30 base::FilePath GetTempDirPath(); | 31 base::FilePath GetTempDirPath(); |
| 31 | 32 |
| 32 template<class T> | 33 template<class T> |
| 33 bool WriteColumnFileFromVector(std::string table_name, | 34 bool WriteColumnFileFromVector(std::string table_name, |
| 34 std::string column_name, | 35 std::string column_name, |
| 35 const uint16 field_type, | 36 const PmpFieldType field_type, |
| 36 std::vector<T> elements_vector); | 37 std::vector<T> elements_vector); |
| 37 | 38 |
| 38 bool InitColumnReaderFromBytes(PmpColumnReader* const reader, | 39 bool InitColumnReaderFromBytes(PmpColumnReader* const reader, |
| 39 std::vector<uint8> data, uint32* rows_read); | 40 std::vector<uint8> data, |
| 41 const PmpFieldType expected_type, |
| 42 uint32* rows_read); |
| 40 | 43 |
| 41 static std::vector<uint8> MakeHeader(const uint16 field_type, | 44 static std::vector<uint8> MakeHeader(const PmpFieldType field_type, |
| 42 const uint32 row_count); | 45 const uint32 row_count); |
| 43 | 46 |
| 44 template<class T> | 47 template<class T> |
| 45 static std::vector<uint8> MakeHeaderAndBody(const uint16 field_type, | 48 static std::vector<uint8> MakeHeaderAndBody(const PmpFieldType field_type, |
| 46 const uint32 row_count, | 49 const uint32 row_count, |
| 47 const std::vector<T>& elems); | 50 const std::vector<T>& elems); |
| 48 | 51 |
| 49 private: | 52 private: |
| 50 base::ScopedTempDir temp_dir_; | 53 base::ScopedTempDir temp_dir_; |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 } // namespace picasaimport | 56 } // namespace picasaimport |
| 54 | 57 |
| 55 #endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_ | 58 #endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_ |
| OLD | NEW |