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

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

Issue 16043006: Rename FileSystemMountPointProvider::ValidateFileSystemRoot to OpenFileSystem (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 public: 63 public:
64 FileSystemFileStreamReaderTest() 64 FileSystemFileStreamReaderTest()
65 : message_loop_(base::MessageLoop::TYPE_IO) {} 65 : message_loop_(base::MessageLoop::TYPE_IO) {}
66 66
67 virtual void SetUp() OVERRIDE { 67 virtual void SetUp() OVERRIDE {
68 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 68 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
69 69
70 file_system_context_ = CreateFileSystemContextForTesting( 70 file_system_context_ = CreateFileSystemContextForTesting(
71 NULL, temp_dir_.path()); 71 NULL, temp_dir_.path());
72 72
73 file_system_context_->sandbox_provider()->ValidateFileSystemRoot( 73 file_system_context_->sandbox_provider()->OpenFileSystem(
74 GURL(kURLOrigin), kFileSystemTypeTemporary, true, // create 74 GURL(kURLOrigin), kFileSystemTypeTemporary,
75 base::Bind(&OnValidateFileSystem)); 75 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
76 base::Bind(&OnOpenFileSystem));
76 base::MessageLoop::current()->RunUntilIdle(); 77 base::MessageLoop::current()->RunUntilIdle();
77 78
78 WriteFile(kTestFileName, kTestData, kTestDataSize, 79 WriteFile(kTestFileName, kTestData, kTestDataSize,
79 &test_file_modification_time_); 80 &test_file_modification_time_);
80 } 81 }
81 82
82 virtual void TearDown() OVERRIDE { 83 virtual void TearDown() OVERRIDE {
83 base::MessageLoop::current()->RunUntilIdle(); 84 base::MessageLoop::current()->RunUntilIdle();
84 } 85 }
85 86
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 base::PlatformFileInfo file_info; 127 base::PlatformFileInfo file_info;
127 base::FilePath platform_path; 128 base::FilePath platform_path;
128 ASSERT_EQ(base::PLATFORM_FILE_OK, 129 ASSERT_EQ(base::PLATFORM_FILE_OK,
129 file_util->GetFileInfo(&context, url, &file_info, 130 file_util->GetFileInfo(&context, url, &file_info,
130 &platform_path)); 131 &platform_path));
131 if (modification_time) 132 if (modification_time)
132 *modification_time = file_info.last_modified; 133 *modification_time = file_info.last_modified;
133 } 134 }
134 135
135 private: 136 private:
136 static void OnValidateFileSystem(base::PlatformFileError result) { 137 static void OnOpenFileSystem(base::PlatformFileError result) {
137 ASSERT_EQ(base::PLATFORM_FILE_OK, result); 138 ASSERT_EQ(base::PLATFORM_FILE_OK, result);
138 } 139 }
139 140
140 FileSystemURL GetFileSystemURL(const std::string& file_name) { 141 FileSystemURL GetFileSystemURL(const std::string& file_name) {
141 return file_system_context_->CreateCrackedFileSystemURL( 142 return file_system_context_->CreateCrackedFileSystemURL(
142 GURL(kURLOrigin), 143 GURL(kURLOrigin),
143 kFileSystemTypeTemporary, 144 kFileSystemTypeTemporary,
144 base::FilePath().AppendASCII(file_name)); 145 base::FilePath().AppendASCII(file_name));
145 } 146 }
146 147
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 new net::IOBufferWithSize(kTestDataSize)); 273 new net::IOBufferWithSize(kTestDataSize));
273 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled)); 274 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled));
274 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); 275 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0);
275 276
276 // Delete immediately. 277 // Delete immediately.
277 // Should not crash; nor should NeverCalled be callback. 278 // Should not crash; nor should NeverCalled be callback.
278 reader.reset(); 279 reader.reset();
279 } 280 }
280 281
281 } // namespace fileapi 282 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_context.cc ('k') | webkit/fileapi/syncable/canned_syncable_file_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698