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

Side by Side Diff: webkit/fileapi/upload_file_system_file_element_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
« no previous file with comments | « webkit/fileapi/test_mount_point_provider.cc ('k') | webkit/glue/dom_operations_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "webkit/fileapi/upload_file_system_file_element_reader.h" 5 #include "webkit/fileapi/upload_file_system_file_element_reader.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 } 78 }
79 79
80 void WriteFileSystemFile(const std::string& filename, 80 void WriteFileSystemFile(const std::string& filename,
81 const char* buf, 81 const char* buf,
82 int buf_size, 82 int buf_size,
83 base::Time* modification_time) { 83 base::Time* modification_time) {
84 fileapi::FileSystemURL url = 84 fileapi::FileSystemURL url =
85 file_system_context_->CreateCrackedFileSystemURL( 85 file_system_context_->CreateCrackedFileSystemURL(
86 GURL(kFileSystemURLOrigin), 86 GURL(kFileSystemURLOrigin),
87 kFileSystemType, 87 kFileSystemType,
88 FilePath().AppendASCII(filename)); 88 base::FilePath().AppendASCII(filename));
89 89
90 fileapi::FileSystemFileUtil* file_util = 90 fileapi::FileSystemFileUtil* file_util =
91 file_system_context_->GetFileUtil(kFileSystemType); 91 file_system_context_->GetFileUtil(kFileSystemType);
92 92
93 fileapi::FileSystemOperationContext context(file_system_context_); 93 fileapi::FileSystemOperationContext context(file_system_context_);
94 context.set_allowed_bytes_growth(1024); 94 context.set_allowed_bytes_growth(1024);
95 95
96 base::PlatformFile handle = base::kInvalidPlatformFileValue; 96 base::PlatformFile handle = base::kInvalidPlatformFileValue;
97 bool created = false; 97 bool created = false;
98 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( 98 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen(
99 &context, 99 &context,
100 url, 100 url,
101 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, 101 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
102 &handle, 102 &handle,
103 &created)); 103 &created));
104 EXPECT_TRUE(created); 104 EXPECT_TRUE(created);
105 ASSERT_NE(base::kInvalidPlatformFileValue, handle); 105 ASSERT_NE(base::kInvalidPlatformFileValue, handle);
106 ASSERT_EQ(buf_size, 106 ASSERT_EQ(buf_size,
107 base::WritePlatformFile(handle, 0 /* offset */, buf, buf_size)); 107 base::WritePlatformFile(handle, 0 /* offset */, buf, buf_size));
108 base::ClosePlatformFile(handle); 108 base::ClosePlatformFile(handle);
109 109
110 base::PlatformFileInfo file_info; 110 base::PlatformFileInfo file_info;
111 FilePath platform_path; 111 base::FilePath platform_path;
112 ASSERT_EQ(base::PLATFORM_FILE_OK, 112 ASSERT_EQ(base::PLATFORM_FILE_OK,
113 file_util->GetFileInfo(&context, url, &file_info, 113 file_util->GetFileInfo(&context, url, &file_info,
114 &platform_path)); 114 &platform_path));
115 *modification_time = file_info.last_modified; 115 *modification_time = file_info.last_modified;
116 } 116 }
117 117
118 void OnValidateFileSystem(base::PlatformFileError result, 118 void OnValidateFileSystem(base::PlatformFileError result,
119 const std::string& name, 119 const std::string& name,
120 const GURL& root) { 120 const GURL& root) {
121 ASSERT_EQ(base::PLATFORM_FILE_OK, result); 121 ASSERT_EQ(base::PLATFORM_FILE_OK, result);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) { 281 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) {
282 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat"); 282 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat");
283 reader_.reset(new UploadFileSystemFileElementReader( 283 reader_.reset(new UploadFileSystemFileElementReader(
284 file_system_context_, wrong_url, 0, kuint64max, base::Time())); 284 file_system_context_, wrong_url, 0, kuint64max, base::Time()));
285 net::TestCompletionCallback init_callback; 285 net::TestCompletionCallback init_callback;
286 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback())); 286 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback()));
287 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); 287 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult());
288 } 288 }
289 289
290 } // namespace fileapi 290 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/test_mount_point_provider.cc ('k') | webkit/glue/dom_operations_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698