OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <stddef.h> | 5 #include <stddef.h> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/format_macros.h" | 13 #include "base/format_macros.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/single_thread_task_runner.h" |
20 #include "base/strings/string_piece.h" | 21 #include "base/strings/string_piece.h" |
21 #include "base/strings/stringprintf.h" | 22 #include "base/strings/stringprintf.h" |
22 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
23 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
24 #include "content/public/test/async_file_test_helper.h" | 25 #include "content/public/test/async_file_test_helper.h" |
25 #include "content/public/test/test_file_system_backend.h" | 26 #include "content/public/test/test_file_system_backend.h" |
26 #include "content/public/test/test_file_system_context.h" | 27 #include "content/public/test/test_file_system_context.h" |
27 #include "net/base/load_flags.h" | 28 #include "net/base/load_flags.h" |
28 #include "net/base/mime_util.h" | 29 #include "net/base/mime_util.h" |
29 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 ASSERT_FALSE(request_->is_pending()); | 385 ASSERT_FALSE(request_->is_pending()); |
385 EXPECT_TRUE(delegate_->request_failed()); | 386 EXPECT_TRUE(delegate_->request_failed()); |
386 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 387 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
387 } | 388 } |
388 | 389 |
389 TEST_F(FileSystemURLRequestJobTest, Cancel) { | 390 TEST_F(FileSystemURLRequestJobTest, Cancel) { |
390 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); | 391 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); |
391 TestRequestNoRun(CreateFileSystemURL("file1.dat")); | 392 TestRequestNoRun(CreateFileSystemURL("file1.dat")); |
392 | 393 |
393 // Run StartAsync() and only StartAsync(). | 394 // Run StartAsync() and only StartAsync(). |
394 base::MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 395 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, |
| 396 request_.release()); |
395 base::RunLoop().RunUntilIdle(); | 397 base::RunLoop().RunUntilIdle(); |
396 // If we get here, success! we didn't crash! | 398 // If we get here, success! we didn't crash! |
397 } | 399 } |
398 | 400 |
399 TEST_F(FileSystemURLRequestJobTest, GetMimeType) { | 401 TEST_F(FileSystemURLRequestJobTest, GetMimeType) { |
400 const char kFilename[] = "hoge.html"; | 402 const char kFilename[] = "hoge.html"; |
401 | 403 |
402 std::string mime_type_direct; | 404 std::string mime_type_direct; |
403 base::FilePath::StringType extension = | 405 base::FilePath::StringType extension = |
404 base::FilePath().AppendASCII(kFilename).Extension(); | 406 base::FilePath().AppendASCII(kFilename).Extension(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 EXPECT_TRUE(delegate_->request_failed()); | 476 EXPECT_TRUE(delegate_->request_failed()); |
475 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 477 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
476 | 478 |
477 ASSERT_FALSE( | 479 ASSERT_FALSE( |
478 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( | 480 storage::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
479 kValidExternalMountPoint)); | 481 kValidExternalMountPoint)); |
480 } | 482 } |
481 | 483 |
482 } // namespace | 484 } // namespace |
483 } // namespace content | 485 } // namespace content |
OLD | NEW |