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

Side by Side Diff: webkit/fileapi/file_system_file_stream_reader_unittest.cc

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/fileapi/file_system_file_stream_reader.h" 5 #include "webkit/fileapi/file_system_file_stream_reader.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, 126 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
127 &handle, 127 &handle,
128 &created)); 128 &created));
129 EXPECT_TRUE(created); 129 EXPECT_TRUE(created);
130 ASSERT_NE(base::kInvalidPlatformFileValue, handle); 130 ASSERT_NE(base::kInvalidPlatformFileValue, handle);
131 ASSERT_EQ(buf_size, 131 ASSERT_EQ(buf_size,
132 base::WritePlatformFile(handle, 0 /* offset */, buf, buf_size)); 132 base::WritePlatformFile(handle, 0 /* offset */, buf, buf_size));
133 base::ClosePlatformFile(handle); 133 base::ClosePlatformFile(handle);
134 134
135 base::PlatformFileInfo file_info; 135 base::PlatformFileInfo file_info;
136 FilePath platform_path; 136 base::FilePath platform_path;
137 ASSERT_EQ(base::PLATFORM_FILE_OK, 137 ASSERT_EQ(base::PLATFORM_FILE_OK,
138 file_util->GetFileInfo(&context, url, &file_info, 138 file_util->GetFileInfo(&context, url, &file_info,
139 &platform_path)); 139 &platform_path));
140 if (modification_time) 140 if (modification_time)
141 *modification_time = file_info.last_modified; 141 *modification_time = file_info.last_modified;
142 } 142 }
143 143
144 private: 144 private:
145 static void OnValidateFileSystem(base::PlatformFileError result) { 145 static void OnValidateFileSystem(base::PlatformFileError result) {
146 ASSERT_EQ(base::PLATFORM_FILE_OK, result); 146 ASSERT_EQ(base::PLATFORM_FILE_OK, result);
147 } 147 }
148 148
149 FileSystemURL GetFileSystemURL(const std::string& file_name) { 149 FileSystemURL GetFileSystemURL(const std::string& file_name) {
150 return file_system_context_->CreateCrackedFileSystemURL( 150 return file_system_context_->CreateCrackedFileSystemURL(
151 GURL(kURLOrigin), 151 GURL(kURLOrigin),
152 kFileSystemTypeTemporary, 152 kFileSystemTypeTemporary,
153 FilePath().AppendASCII(file_name)); 153 base::FilePath().AppendASCII(file_name));
154 } 154 }
155 155
156 MessageLoop message_loop_; 156 MessageLoop message_loop_;
157 base::ScopedTempDir temp_dir_; 157 base::ScopedTempDir temp_dir_;
158 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy_; 158 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy_;
159 scoped_refptr<FileSystemContext> file_system_context_; 159 scoped_refptr<FileSystemContext> file_system_context_;
160 base::Time test_file_modification_time_; 160 base::Time test_file_modification_time_;
161 }; 161 };
162 162
163 TEST_F(FileSystemFileStreamReaderTest, NonExistent) { 163 TEST_F(FileSystemFileStreamReaderTest, NonExistent) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 new net::IOBufferWithSize(kTestDataSize)); 282 new net::IOBufferWithSize(kTestDataSize));
283 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled)); 283 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled));
284 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); 284 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0);
285 285
286 // Delete immediately. 286 // Delete immediately.
287 // Should not crash; nor should NeverCalled be callback. 287 // Should not crash; nor should NeverCalled be callback.
288 reader.reset(); 288 reader.reset();
289 } 289 }
290 290
291 } // namespace fileapi 291 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_file_stream_reader.cc ('k') | webkit/fileapi/file_system_file_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698