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