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

Side by Side Diff: net/disk_cache/disk_cache_test_util.cc

Issue 8843: Add write and read/write support to FileStream (renamed from FileInputStream)... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month 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 | « net/disk_cache/block_files.cc ('k') | net/disk_cache/file.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "net/disk_cache/disk_cache_test_util.h" 5 #include "net/disk_cache/disk_cache_test_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "net/disk_cache/backend_impl.h" 9 #include "net/disk_cache/backend_impl.h"
10 #include "net/disk_cache/cache_util.h" 10 #include "net/disk_cache/cache_util.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 PathService::Get(base::DIR_TEMP, &path); 43 PathService::Get(base::DIR_TEMP, &path);
44 file_util::AppendToPath(&path, L"cache_test"); 44 file_util::AppendToPath(&path, L"cache_test");
45 if (!file_util::PathExists(path)) 45 if (!file_util::PathExists(path))
46 file_util::CreateDirectory(path); 46 file_util::CreateDirectory(path);
47 47
48 return path; 48 return path;
49 } 49 }
50 50
51 bool CreateCacheTestFile(const wchar_t* name) { 51 bool CreateCacheTestFile(const wchar_t* name) {
52 using namespace disk_cache; 52 using namespace disk_cache;
53 int flags = OS_FILE_CREATE_ALWAYS | OS_FILE_READ | OS_FILE_WRITE | 53 int flags = base::PLATFORM_FILE_CREATE_ALWAYS |
54 OS_FILE_SHARE_READ | OS_FILE_SHARE_WRITE; 54 base::PLATFORM_FILE_READ |
55 base::PLATFORM_FILE_WRITE;
55 56
56 scoped_refptr<File> file(new File(CreateOSFile(name, flags, NULL))); 57 scoped_refptr<File> file(new File(
58 base::CreatePlatformFile(name, flags, NULL)));
57 if (!file->IsValid()) 59 if (!file->IsValid())
58 return false; 60 return false;
59 61
60 file->SetLength(4 * 1024 * 1024); 62 file->SetLength(4 * 1024 * 1024);
61 return true; 63 return true;
62 } 64 }
63 65
64 bool DeleteCache(const wchar_t* path) { 66 bool DeleteCache(const wchar_t* path) {
65 disk_cache::DeleteCache(path, false); 67 disk_cache::DeleteCache(path, false);
66 return true; 68 return true;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } else { 131 } else {
130 // Not finished yet. See if we have to abort. 132 // Not finished yet. See if we have to abort.
131 if (last_ == g_cache_tests_received) 133 if (last_ == g_cache_tests_received)
132 num_iterations_++; 134 num_iterations_++;
133 else 135 else
134 last_ = g_cache_tests_received; 136 last_ = g_cache_tests_received;
135 if (40 == num_iterations_) 137 if (40 == num_iterations_)
136 MessageLoop::current()->Quit(); 138 MessageLoop::current()->Quit();
137 } 139 }
138 } 140 }
OLDNEW
« no previous file with comments | « net/disk_cache/block_files.cc ('k') | net/disk_cache/file.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698