Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Unified Diff: webkit/fileapi/media/picasa/pmp_test_helper.h

Issue 12704024: Simple PMP reader to parse Picasa's metadata (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused constant. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/media/picasa/pmp_test_helper.h
diff --git a/webkit/fileapi/media/picasa/pmp_test_helper.h b/webkit/fileapi/media/picasa/pmp_test_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd496d8df28be47e329ebf3f66d02471febde730
--- /dev/null
+++ b/webkit/fileapi/media/picasa/pmp_test_helper.h
@@ -0,0 +1,45 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_
+#define WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_
+
+#include <vector>
+
+#include "base/basictypes.h"
+
+namespace base {
+
+class FilePath;
+
+} // namespace base
+
+namespace fileapi {
+
+// A helper class used for unit tests only
+class PmpTestHelper {
vandebo (ex-Chrome) 2013/03/29 21:35:07 You might want to make this a functional class. I
tommycli 2013/04/01 22:19:18 I could see that being useful. I'll do it if I add
vandebo (ex-Chrome) 2013/04/02 18:10:55 But what if you're not the next one to add a test?
tommycli 2013/04/02 21:12:36 Oh. That's a good point. I'll clean it up then.
+ public:
+ static std::vector<uint8> MakeHeader(const uint16 field_type,
+ const uint32 row_count);
+
+ template<class T>
+ static std::vector<uint8> MakeHeaderAndBody(const uint16 field_type,
+ const uint32 row_count,
+ const std::vector<T>& elems);
+
+ static bool WriteToFile(const base::FilePath& path, std::vector<uint8> data);
+
+ private:
+ // Flatten a vector of elements into an array of bytes.
+ template<class T>
+ static std::vector<uint8> Flatten(const std::vector<T>& elems);
+
+ // Returns a new vector with the concatenated contents of |a| and |b|.
+ static std::vector<uint8> CombinedVectors(const std::vector<uint8>& a,
+ const std::vector<uint8>& b);
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_MEDIA_PICASA_PMP_TEST_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698