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

Side by Side Diff: chrome/browser/media_galleries/fileapi/picasa_file_util_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 using fileapi::FileSystemURL; 42 using fileapi::FileSystemURL;
43 43
44 namespace picasa { 44 namespace picasa {
45 45
46 namespace { 46 namespace {
47 47
48 base::Time::Exploded test_date_exploded = { 2013, 4, 0, 16, 0, 0, 0, 0 }; 48 base::Time::Exploded test_date_exploded = { 2013, 4, 0, 16, 0, 0, 0, 0 };
49 49
50 bool WriteJPEGHeader(const base::FilePath& path) { 50 bool WriteJPEGHeader(const base::FilePath& path) {
51 const char kJpegHeader[] = "\xFF\xD8\xFF"; // Per HTML5 specification. 51 const char kJpegHeader[] = "\xFF\xD8\xFF"; // Per HTML5 specification.
52 return file_util::WriteFile(path, kJpegHeader, arraysize(kJpegHeader)) != -1; 52 return base::WriteFile(path, kJpegHeader, arraysize(kJpegHeader)) != -1;
53 } 53 }
54 54
55 class TestFolder { 55 class TestFolder {
56 public: 56 public:
57 TestFolder(const std::string& name, const base::Time& timestamp, 57 TestFolder(const std::string& name, const base::Time& timestamp,
58 const std::string& uid, unsigned int image_files, 58 const std::string& uid, unsigned int image_files,
59 unsigned int non_image_files) 59 unsigned int non_image_files)
60 : name_(name), 60 : name_(name),
61 timestamp_(timestamp), 61 timestamp_(timestamp),
62 uid_(uid), 62 uid_(uid),
(...skipping 14 matching lines...) Expand all
77 77
78 base::FilePath path = folder_dir_.path().AppendASCII(image_filename); 78 base::FilePath path = folder_dir_.path().AppendASCII(image_filename);
79 79
80 if (!WriteJPEGHeader(path)) 80 if (!WriteJPEGHeader(path))
81 return false; 81 return false;
82 } 82 }
83 83
84 for (unsigned int i = 0; i < non_image_files_; ++i) { 84 for (unsigned int i = 0; i < non_image_files_; ++i) {
85 base::FilePath path = folder_dir_.path().AppendASCII( 85 base::FilePath path = folder_dir_.path().AppendASCII(
86 base::StringPrintf("hello%05d.txt", i)); 86 base::StringPrintf("hello%05d.txt", i));
87 if (file_util::WriteFile(path, NULL, 0) == -1) 87 if (base::WriteFile(path, NULL, 0) == -1)
88 return false; 88 return false;
89 } 89 }
90 90
91 return true; 91 return true;
92 } 92 }
93 93
94 double GetVariantTimestamp() const { 94 double GetVariantTimestamp() const {
95 DCHECK(!folder_dir_.path().empty()); 95 DCHECK(!folder_dir_.path().empty());
96 base::Time variant_epoch = base::Time::FromLocalExploded( 96 base::Time variant_epoch = base::Time::FromLocalExploded(
97 picasa::kPmpVariantTimeEpoch); 97 picasa::kPmpVariantTimeEpoch);
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 operation_runner()->CreateSnapshotFile( 587 operation_runner()->CreateSnapshotFile(
588 CreateURL(std::string(kPicasaDirAlbums) + 588 CreateURL(std::string(kPicasaDirAlbums) +
589 "/albumname 2013-04-16/mapped_name.jpg"), 589 "/albumname 2013-04-16/mapped_name.jpg"),
590 snapshot_callback); 590 snapshot_callback);
591 loop.Run(); 591 loop.Run();
592 EXPECT_EQ(base::File::FILE_OK, error); 592 EXPECT_EQ(base::File::FILE_OK, error);
593 EXPECT_EQ(image_path, platform_path_result); 593 EXPECT_EQ(image_path, platform_path_result);
594 } 594 }
595 595
596 } // namespace picasa 596 } // namespace picasa
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698