OLD | NEW |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 protected: | 73 protected: |
74 GURL GetFileSystemURL(const std::string& filename) { | 74 GURL GetFileSystemURL(const std::string& filename) { |
75 return GURL(file_system_root_url_.spec() + filename); | 75 return GURL(file_system_root_url_.spec() + filename); |
76 } | 76 } |
77 | 77 |
78 void WriteFileSystemFile(const std::string& filename, | 78 void WriteFileSystemFile(const std::string& filename, |
79 const char* buf, | 79 const char* buf, |
80 int buf_size, | 80 int buf_size, |
81 base::Time* modification_time) { | 81 base::Time* modification_time) { |
82 fileapi::FileSystemURL url(GURL(kFileSystemURLOrigin), | 82 fileapi::FileSystemURL url = |
83 kFileSystemType, | 83 file_system_context_->CreateCrackedFileSystemURL( |
84 FilePath().AppendASCII(filename)); | 84 GURL(kFileSystemURLOrigin), |
| 85 kFileSystemType, |
| 86 FilePath().AppendASCII(filename)); |
85 | 87 |
86 fileapi::FileSystemFileUtil* file_util = | 88 fileapi::FileSystemFileUtil* file_util = |
87 file_system_context_->GetFileUtil(kFileSystemType); | 89 file_system_context_->GetFileUtil(kFileSystemType); |
88 | 90 |
89 fileapi::FileSystemOperationContext context(file_system_context_); | 91 fileapi::FileSystemOperationContext context(file_system_context_); |
90 context.set_allowed_bytes_growth(1024); | 92 context.set_allowed_bytes_growth(1024); |
91 | 93 |
92 base::PlatformFile handle = base::kInvalidPlatformFileValue; | 94 base::PlatformFile handle = base::kInvalidPlatformFileValue; |
93 bool created = false; | 95 bool created = false; |
94 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( | 96 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) { | 279 TEST_F(UploadFileSystemFileElementReaderTest, WrongURL) { |
278 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat"); | 280 const GURL wrong_url = GetFileSystemURL("wrong_file_name.dat"); |
279 reader_.reset(new UploadFileSystemFileElementReader( | 281 reader_.reset(new UploadFileSystemFileElementReader( |
280 file_system_context_, wrong_url, 0, kuint64max, base::Time())); | 282 file_system_context_, wrong_url, 0, kuint64max, base::Time())); |
281 net::TestCompletionCallback init_callback; | 283 net::TestCompletionCallback init_callback; |
282 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback())); | 284 ASSERT_EQ(net::ERR_IO_PENDING, reader_->Init(init_callback.callback())); |
283 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); | 285 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, init_callback.WaitForResult()); |
284 } | 286 } |
285 | 287 |
286 } // namespace fileapi | 288 } // namespace fileapi |
OLD | NEW |