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

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

Issue 11747020: Cleanup: Remove using statements from webkit/fileapi header files. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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/obfuscated_file_util.cc ('k') | webkit/fileapi/sandbox_mount_point_provider.h » ('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) 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector>
7 8
8 #include "base/bind.h" 9 #include "base/bind.h"
9 #include "base/file_path.h" 10 #include "base/file_path.h"
10 #include "base/file_util.h" 11 #include "base/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop.h" 14 #include "base/message_loop.h"
14 #include "base/platform_file.h" 15 #include "base/platform_file.h"
15 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
16 #include "webkit/fileapi/file_system_context.h" 17 #include "webkit/fileapi/file_system_context.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 return test_helper_.CreateURL(path); 257 return test_helper_.CreateURL(path);
257 } 258 }
258 259
259 void OnGetUsage(quota::QuotaStatusCode status, int64 usage, int64 unused) { 260 void OnGetUsage(quota::QuotaStatusCode status, int64 usage, int64 unused) {
260 EXPECT_EQ(quota::kQuotaStatusOk, status); 261 EXPECT_EQ(quota::kQuotaStatusOk, status);
261 quota_status_ = status; 262 quota_status_ = status;
262 usage_ = usage; 263 usage_ = usage;
263 } 264 }
264 265
265 void CheckFileAndCloseHandle( 266 void CheckFileAndCloseHandle(
266 const FileSystemURL& url, PlatformFile file_handle) { 267 const FileSystemURL& url, base::PlatformFile file_handle) {
267 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); 268 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
268 FilePath local_path; 269 FilePath local_path;
269 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( 270 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath(
270 context.get(), url, &local_path)); 271 context.get(), url, &local_path));
271 272
272 base::PlatformFileInfo file_info0; 273 base::PlatformFileInfo file_info0;
273 FilePath data_path; 274 FilePath data_path;
274 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( 275 EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo(
275 context.get(), url, &file_info0, &data_path)); 276 context.get(), url, &file_info0, &data_path));
276 EXPECT_EQ(data_path, local_path); 277 EXPECT_EQ(data_path, local_path);
277 EXPECT_TRUE(FileExists(data_path)); 278 EXPECT_TRUE(FileExists(data_path));
278 EXPECT_EQ(0, GetSize(data_path)); 279 EXPECT_EQ(0, GetSize(data_path));
279 280
280 const char data[] = "test data"; 281 const char data[] = "test data";
281 const int length = arraysize(data) - 1; 282 const int length = arraysize(data) - 1;
282 283
283 if (base::kInvalidPlatformFileValue == file_handle) { 284 if (base::kInvalidPlatformFileValue == file_handle) {
284 bool created = true; 285 bool created = true;
285 PlatformFileError error; 286 base::PlatformFileError error;
286 file_handle = base::CreatePlatformFile( 287 file_handle = base::CreatePlatformFile(
287 data_path, 288 data_path,
288 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE, 289 base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_WRITE,
289 &created, 290 &created,
290 &error); 291 &error);
291 ASSERT_NE(base::kInvalidPlatformFileValue, file_handle); 292 ASSERT_NE(base::kInvalidPlatformFileValue, file_handle);
292 ASSERT_EQ(base::PLATFORM_FILE_OK, error); 293 ASSERT_EQ(base::PLATFORM_FILE_OK, error);
293 EXPECT_FALSE(created); 294 EXPECT_FALSE(created);
294 } 295 }
295 ASSERT_EQ(length, base::WritePlatformFile(file_handle, 0, data, length)); 296 ASSERT_EQ(length, base::WritePlatformFile(file_handle, 0, data, length));
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 ofu()->CreateDirectory(context.get(), url, false, false)); 1691 ofu()->CreateDirectory(context.get(), url, false, false));
1691 1692
1692 ClearTimestamp(dir_url); 1693 ClearTimestamp(dir_url);
1693 context.reset(NewContext(NULL)); 1694 context.reset(NewContext(NULL));
1694 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE, 1695 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE,
1695 ofu()->EnsureFileExists(context.get(), url, &created)); 1696 ofu()->EnsureFileExists(context.get(), url, &created));
1696 EXPECT_EQ(base::Time(), GetModifiedTime(dir_url)); 1697 EXPECT_EQ(base::Time(), GetModifiedTime(dir_url));
1697 1698
1698 // CreateOrOpen, create case. 1699 // CreateOrOpen, create case.
1699 url = dir_url.WithPath(dir_url.path().AppendASCII("CreateOrOpen_file")); 1700 url = dir_url.WithPath(dir_url.path().AppendASCII("CreateOrOpen_file"));
1700 PlatformFile file_handle = base::kInvalidPlatformFileValue; 1701 base::PlatformFile file_handle = base::kInvalidPlatformFileValue;
1701 created = false; 1702 created = false;
1702 ClearTimestamp(dir_url); 1703 ClearTimestamp(dir_url);
1703 context.reset(NewContext(NULL)); 1704 context.reset(NewContext(NULL));
1704 EXPECT_EQ(base::PLATFORM_FILE_OK, 1705 EXPECT_EQ(base::PLATFORM_FILE_OK,
1705 ofu()->CreateOrOpen( 1706 ofu()->CreateOrOpen(
1706 context.get(), url, 1707 context.get(), url,
1707 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, 1708 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
1708 &file_handle, &created)); 1709 &file_handle, &created));
1709 EXPECT_NE(base::kInvalidPlatformFileValue, file_handle); 1710 EXPECT_NE(base::kInvalidPlatformFileValue, file_handle);
1710 EXPECT_TRUE(created); 1711 EXPECT_TRUE(created);
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2225 ASSERT_EQ(base::PLATFORM_FILE_OK, 2226 ASSERT_EQ(base::PLATFORM_FILE_OK,
2226 ofu()->CreateOrOpen( 2227 ofu()->CreateOrOpen(
2227 AllowUsageIncrease(-length)->context(), file, 2228 AllowUsageIncrease(-length)->context(), file,
2228 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE, 2229 base::PLATFORM_FILE_OPEN_TRUNCATED | base::PLATFORM_FILE_WRITE,
2229 &file_handle, &created)); 2230 &file_handle, &created));
2230 ASSERT_EQ(0, ComputeTotalFileSize()); 2231 ASSERT_EQ(0, ComputeTotalFileSize());
2231 EXPECT_TRUE(base::ClosePlatformFile(file_handle)); 2232 EXPECT_TRUE(base::ClosePlatformFile(file_handle));
2232 } 2233 }
2233 2234
2234 } // namespace fileapi 2235 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/obfuscated_file_util.cc ('k') | webkit/fileapi/sandbox_mount_point_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698