| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 void CreateAndRegisterTemporaryFile( | 41 void CreateAndRegisterTemporaryFile( |
| 42 FileSystemURL* file_url, | 42 FileSystemURL* file_url, |
| 43 base::FilePath* file_path) { | 43 base::FilePath* file_path) { |
| 44 EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.path(), file_path)); | 44 EXPECT_TRUE(base::CreateTemporaryFileInDir(data_dir_.path(), file_path)); |
| 45 fileapi::IsolatedContext* isolated_context = | 45 fileapi::IsolatedContext* isolated_context = |
| 46 fileapi::IsolatedContext::GetInstance(); | 46 fileapi::IsolatedContext::GetInstance(); |
| 47 std::string name = "tmp"; | 47 std::string name = "tmp"; |
| 48 std::string fsid = isolated_context->RegisterFileSystemForPath( | 48 std::string fsid = isolated_context->RegisterFileSystemForPath( |
| 49 fileapi::kFileSystemTypeForTransientFile, | 49 fileapi::kFileSystemTypeForTransientFile, |
| 50 std::string(), |
| 50 *file_path, | 51 *file_path, |
| 51 &name); | 52 &name); |
| 52 ASSERT_TRUE(!fsid.empty()); | 53 ASSERT_TRUE(!fsid.empty()); |
| 53 base::FilePath virtual_path = isolated_context->CreateVirtualRootPath( | 54 base::FilePath virtual_path = isolated_context->CreateVirtualRootPath( |
| 54 fsid).AppendASCII(name); | 55 fsid).AppendASCII(name); |
| 55 *file_url = file_system_context_->CreateCrackedFileSystemURL( | 56 *file_url = file_system_context_->CreateCrackedFileSystemURL( |
| 56 GURL("http://foo"), | 57 GURL("http://foo"), |
| 57 fileapi::kFileSystemTypeIsolated, | 58 fileapi::kFileSystemTypeIsolated, |
| 58 virtual_path); | 59 virtual_path); |
| 59 } | 60 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 base::RunLoop().RunUntilIdle(); | 117 base::RunLoop().RunUntilIdle(); |
| 117 | 118 |
| 118 // Now the temporary file and the transient filesystem must be gone too. | 119 // Now the temporary file and the transient filesystem must be gone too. |
| 119 ASSERT_FALSE(base::PathExists(temp_path)); | 120 ASSERT_FALSE(base::PathExists(temp_path)); |
| 120 ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, | 121 ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
| 121 file_util()->GetFileInfo(NewOperationContext().get(), | 122 file_util()->GetFileInfo(NewOperationContext().get(), |
| 122 temp_url, &file_info, &path)); | 123 temp_url, &file_info, &path)); |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace content | 126 } // namespace content |
| OLD | NEW |