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/bind.h" | 6 #include "base/bind.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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 // Set up TestFileSystemBackend to require CopyOrMoveFileValidator. | 58 // Set up TestFileSystemBackend to require CopyOrMoveFileValidator. |
59 FileSystemBackend* test_file_system_backend = | 59 FileSystemBackend* test_file_system_backend = |
60 file_system_context_->GetFileSystemBackend(kWithValidatorType); | 60 file_system_context_->GetFileSystemBackend(kWithValidatorType); |
61 static_cast<TestFileSystemBackend*>(test_file_system_backend)-> | 61 static_cast<TestFileSystemBackend*>(test_file_system_backend)-> |
62 set_require_copy_or_move_validator(true); | 62 set_require_copy_or_move_validator(true); |
63 | 63 |
64 // Sets up source. | 64 // Sets up source. |
65 FileSystemBackend* src_file_system_backend = | 65 FileSystemBackend* src_file_system_backend = |
66 file_system_context_->GetFileSystemBackend(src_type_); | 66 file_system_context_->GetFileSystemBackend(src_type_); |
67 src_file_system_backend->InitializeFileSystem( | 67 src_file_system_backend->OpenFileSystem( |
68 origin_, src_type_, | 68 origin_, src_type_, |
69 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 69 OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
70 NULL /* context */, | |
71 base::Bind(&ExpectOk)); | 70 base::Bind(&ExpectOk)); |
72 base::MessageLoop::current()->RunUntilIdle(); | 71 base::MessageLoop::current()->RunUntilIdle(); |
73 ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(SourceURL(""))); | 72 ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(SourceURL(""))); |
74 | 73 |
75 // Sets up dest. | 74 // Sets up dest. |
76 DCHECK_EQ(kWithValidatorType, dest_type_); | 75 DCHECK_EQ(kWithValidatorType, dest_type_); |
77 ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(DestURL(""))); | 76 ASSERT_EQ(base::PLATFORM_FILE_OK, CreateDirectory(DestURL(""))); |
78 | 77 |
79 copy_src_ = SourceURL("copy_src.jpg"); | 78 copy_src_ = SourceURL("copy_src.jpg"); |
80 move_src_ = SourceURL("move_src.jpg"); | 79 move_src_ = SourceURL("move_src.jpg"); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( | 312 scoped_ptr<CopyOrMoveFileValidatorFactory> factory( |
314 // accept pre-copy, reject post-copy | 313 // accept pre-copy, reject post-copy |
315 new TestCopyOrMoveFileValidatorFactory(true, false)); | 314 new TestCopyOrMoveFileValidatorFactory(true, false)); |
316 helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); | 315 helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); |
317 | 316 |
318 helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); | 317 helper.CopyTest(base::PLATFORM_FILE_ERROR_SECURITY); |
319 helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY); | 318 helper.MoveTest(base::PLATFORM_FILE_ERROR_SECURITY); |
320 } | 319 } |
321 | 320 |
322 } // namespace fileapi | 321 } // namespace fileapi |
OLD | NEW |