| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) | 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) |
| 6 // rather than as part of test_shell_tests because they rely on being able | 6 // rather than as part of test_shell_tests because they rely on being able |
| 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses | 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses |
| 8 // TYPE_UI, which URLRequest doesn't allow. | 8 // TYPE_UI, which URLRequest doesn't allow. |
| 9 // | 9 // |
| 10 | 10 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 TestRequestHelper(url, headers, true); | 137 TestRequestHelper(url, headers, true); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void TestRequestNoRun(const GURL& url) { | 140 void TestRequestNoRun(const GURL& url) { |
| 141 TestRequestHelper(url, NULL, false); | 141 TestRequestHelper(url, NULL, false); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void CreateDirectory(const base::StringPiece& dir_name) { | 144 void CreateDirectory(const base::StringPiece& dir_name) { |
| 145 FilePath path = FilePath().AppendASCII(dir_name); | 145 FilePath path = FilePath().AppendASCII(dir_name); |
| 146 FileSystemFileUtil* file_util = file_system_context_->path_manager()-> | 146 FileSystemFileUtil* file_util = file_system_context_->path_manager()-> |
| 147 sandbox_provider()->GetFileSystemFileUtil(); | 147 sandbox_provider()->GetFileUtil(); |
| 148 FileSystemOperationContext context(file_system_context_, file_util); | 148 FileSystemOperationContext context(file_system_context_, file_util); |
| 149 context.set_src_origin_url(GURL("http://remote")); | 149 context.set_src_origin_url(GURL("http://remote")); |
| 150 context.set_src_type(fileapi::kFileSystemTypeTemporary); | 150 context.set_src_type(fileapi::kFileSystemTypeTemporary); |
| 151 context.set_allowed_bytes_growth(1024); | 151 context.set_allowed_bytes_growth(1024); |
| 152 | 152 |
| 153 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateDirectory( | 153 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateDirectory( |
| 154 &context, | 154 &context, |
| 155 path, | 155 path, |
| 156 false /* exclusive */, | 156 false /* exclusive */, |
| 157 false /* recursive */)); | 157 false /* recursive */)); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void WriteFile(const base::StringPiece& file_name, | 160 void WriteFile(const base::StringPiece& file_name, |
| 161 const char* buf, int buf_size) { | 161 const char* buf, int buf_size) { |
| 162 FilePath path = FilePath().AppendASCII(file_name); | 162 FilePath path = FilePath().AppendASCII(file_name); |
| 163 FileSystemFileUtil* file_util = file_system_context_->path_manager()-> | 163 FileSystemFileUtil* file_util = file_system_context_->path_manager()-> |
| 164 sandbox_provider()->GetFileSystemFileUtil(); | 164 sandbox_provider()->GetFileUtil(); |
| 165 FileSystemOperationContext context(file_system_context_, file_util); | 165 FileSystemOperationContext context(file_system_context_, file_util); |
| 166 context.set_src_origin_url(GURL("http://remote")); | 166 context.set_src_origin_url(GURL("http://remote")); |
| 167 context.set_src_type(fileapi::kFileSystemTypeTemporary); | 167 context.set_src_type(fileapi::kFileSystemTypeTemporary); |
| 168 context.set_allowed_bytes_growth(1024); | 168 context.set_allowed_bytes_growth(1024); |
| 169 | 169 |
| 170 base::PlatformFile handle = base::kInvalidPlatformFileValue; | 170 base::PlatformFile handle = base::kInvalidPlatformFileValue; |
| 171 bool created = false; | 171 bool created = false; |
| 172 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( | 172 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( |
| 173 &context, | 173 &context, |
| 174 path, | 174 path, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 367 |
| 368 TestRequest(CreateFileSystemURL(kFilename)); | 368 TestRequest(CreateFileSystemURL(kFilename)); |
| 369 | 369 |
| 370 std::string mime_type_from_job; | 370 std::string mime_type_from_job; |
| 371 request_->GetMimeType(&mime_type_from_job); | 371 request_->GetMimeType(&mime_type_from_job); |
| 372 EXPECT_EQ(mime_type_direct, mime_type_from_job); | 372 EXPECT_EQ(mime_type_direct, mime_type_from_job); |
| 373 } | 373 } |
| 374 | 374 |
| 375 } // namespace (anonymous) | 375 } // namespace (anonymous) |
| 376 } // namespace fileapi | 376 } // namespace fileapi |
| OLD | NEW |