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