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

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

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win 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
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (modification_time) 138 if (modification_time)
139 *modification_time = file_info.last_modified; 139 *modification_time = file_info.last_modified;
140 } 140 }
141 141
142 private: 142 private:
143 static void OnValidateFileSystem(base::PlatformFileError result) { 143 static void OnValidateFileSystem(base::PlatformFileError result) {
144 ASSERT_EQ(base::PLATFORM_FILE_OK, result); 144 ASSERT_EQ(base::PLATFORM_FILE_OK, result);
145 } 145 }
146 146
147 FileSystemURL GetFileSystemURL(const std::string& file_name) { 147 FileSystemURL GetFileSystemURL(const std::string& file_name) {
148 return FileSystemURL(GURL(kURLOrigin), 148 return file_system_context_->CreateCrackedFileSystemURL(
149 kFileSystemTypeTemporary, 149 GURL(kURLOrigin),
150 FilePath().AppendASCII(file_name)); 150 kFileSystemTypeTemporary,
151 FilePath().AppendASCII(file_name));
151 } 152 }
152 153
153 MessageLoop message_loop_; 154 MessageLoop message_loop_;
154 base::ScopedTempDir temp_dir_; 155 base::ScopedTempDir temp_dir_;
155 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy_; 156 scoped_refptr<quota::MockSpecialStoragePolicy> special_storage_policy_;
156 scoped_refptr<FileSystemContext> file_system_context_; 157 scoped_refptr<FileSystemContext> file_system_context_;
157 base::Time test_file_modification_time_; 158 base::Time test_file_modification_time_;
158 }; 159 };
159 160
160 TEST_F(FileSystemFileStreamReaderTest, NonExistent) { 161 TEST_F(FileSystemFileStreamReaderTest, NonExistent) {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 new net::IOBufferWithSize(kTestDataSize)); 280 new net::IOBufferWithSize(kTestDataSize));
280 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled)); 281 int rv = reader->Read(buf, buf->size(), base::Bind(&NeverCalled));
281 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0); 282 ASSERT_TRUE(rv == net::ERR_IO_PENDING || rv >= 0);
282 283
283 // Delete immediately. 284 // Delete immediately.
284 // Should not crash; nor should NeverCalled be callback. 285 // Should not crash; nor should NeverCalled be callback.
285 reader.reset(); 286 reader.reset();
286 } 287 }
287 288
288 } // namespace fileapi 289 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698