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

Unified Diff: chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.cc

Issue 17101030: Media Galleries API - Picasa: Change PMP Parsing to deal with PlatformFile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.cc
diff --git a/chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.cc b/chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.cc
index b2c28c78e8f3a09f86b0163b5900b24550823eec..ad878b36d9eee0e6308b856d411176cc15130cc1 100644
--- a/chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.cc
+++ b/chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.cc
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/platform_file.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/media_galleries/fileapi/picasa/pmp_column_reader.h"
@@ -110,10 +111,10 @@ template bool PmpTestHelper::WriteColumnFileFromVector<uint8>(
template bool PmpTestHelper::WriteColumnFileFromVector<uint64>(
const std::string&, const PmpFieldType, const std::vector<uint64>&);
-bool PmpTestHelper::InitColumnReaderFromBytes(PmpColumnReader* const reader,
- const std::vector<uint8>& data,
- const PmpFieldType expected_type,
- uint32* rows_read) {
+bool PmpTestHelper::InitColumnReaderFromBytes(
+ PmpColumnReader* const reader,
+ const std::vector<uint8>& data,
+ const PmpFieldType expected_type) {
DCHECK(temp_dir_.IsValid());
base::FilePath temp_path;
@@ -123,12 +124,18 @@ bool PmpTestHelper::InitColumnReaderFromBytes(PmpColumnReader* const reader,
return false;
}
- bool success = reader->Init(temp_path, expected_type, rows_read);
+ int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ;
+ base::PlatformFile platform_file =
+ base::CreatePlatformFile(temp_path, flags, NULL, NULL);
+ if (platform_file == base::kInvalidPlatformFileValue)
+ return false;
- file_util::Delete(temp_path, true);
+ bool read_success = reader->ReadFile(platform_file, expected_type);
- return success;
+ base::ClosePlatformFile(platform_file);
+ file_util::Delete(temp_path, false /* recursive */);
+ return read_success;
}
// Return a vector so we don't have to worry about memory management.
« no previous file with comments | « chrome/browser/media_galleries/fileapi/picasa/pmp_test_helper.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698