| 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/stl_util.h" | 5 #include "base/stl_util.h" |
| 6 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 6 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 7 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 7 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 8 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 9 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 10 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 10 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 11 #include "content/public/test/async_file_test_helper.h" |
| 11 #include "content/public/test/sandbox_file_system_test_helper.h" | 12 #include "content/public/test/sandbox_file_system_test_helper.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 15 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
| 15 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 16 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
| 16 #include "webkit/browser/fileapi/async_file_test_helper.h" | |
| 17 #include "webkit/browser/fileapi/file_system_context.h" | 17 #include "webkit/browser/fileapi/file_system_context.h" |
| 18 #include "webkit/browser/fileapi/file_system_operation_context.h" | 18 #include "webkit/browser/fileapi/file_system_operation_context.h" |
| 19 #include "webkit/browser/fileapi/isolated_context.h" | 19 #include "webkit/browser/fileapi/isolated_context.h" |
| 20 #include "webkit/browser/quota/quota_manager.h" | 20 #include "webkit/browser/quota/quota_manager.h" |
| 21 #include "webkit/common/fileapi/file_system_types.h" | 21 #include "webkit/common/fileapi/file_system_types.h" |
| 22 #include "webkit/common/quota/quota_types.h" | 22 #include "webkit/common/quota/quota_types.h" |
| 23 | 23 |
| 24 using base::PlatformFileError; | 24 using base::PlatformFileError; |
| 25 using content::SandboxFileSystemTestHelper; | 25 using content::SandboxFileSystemTestHelper; |
| 26 using fileapi::FileSystemContext; | 26 using fileapi::FileSystemContext; |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // Set up another (non-syncable) local file system. | 264 // Set up another (non-syncable) local file system. |
| 265 SandboxFileSystemTestHelper other_file_system_( | 265 SandboxFileSystemTestHelper other_file_system_( |
| 266 GURL("http://foo.com/"), fileapi::kFileSystemTypeTemporary); | 266 GURL("http://foo.com/"), fileapi::kFileSystemTypeTemporary); |
| 267 other_file_system_.SetUp(file_system_.file_system_context()); | 267 other_file_system_.SetUp(file_system_.file_system_context()); |
| 268 | 268 |
| 269 // Create directory '/a' and file '/a/b' in the other file system. | 269 // Create directory '/a' and file '/a/b' in the other file system. |
| 270 const FileSystemURL kSrcDir = other_file_system_.CreateURLFromUTF8("/a"); | 270 const FileSystemURL kSrcDir = other_file_system_.CreateURLFromUTF8("/a"); |
| 271 const FileSystemURL kSrcChild = other_file_system_.CreateURLFromUTF8("/a/b"); | 271 const FileSystemURL kSrcChild = other_file_system_.CreateURLFromUTF8("/a/b"); |
| 272 | 272 |
| 273 EXPECT_EQ(base::File::FILE_OK, | 273 EXPECT_EQ(base::File::FILE_OK, |
| 274 fileapi::AsyncFileTestHelper::CreateDirectory( | 274 content::AsyncFileTestHelper::CreateDirectory( |
| 275 other_file_system_.file_system_context(), kSrcDir)); | 275 other_file_system_.file_system_context(), kSrcDir)); |
| 276 EXPECT_EQ(base::File::FILE_OK, | 276 EXPECT_EQ(base::File::FILE_OK, |
| 277 fileapi::AsyncFileTestHelper::CreateFile( | 277 content::AsyncFileTestHelper::CreateFile( |
| 278 other_file_system_.file_system_context(), kSrcChild)); | 278 other_file_system_.file_system_context(), kSrcChild)); |
| 279 | 279 |
| 280 // Now try copying the directory into the syncable file system, which should | 280 // Now try copying the directory into the syncable file system, which should |
| 281 // fail if directory operation is disabled. (http://crbug.com/161442) | 281 // fail if directory operation is disabled. (http://crbug.com/161442) |
| 282 EXPECT_NE(base::File::FILE_OK, | 282 EXPECT_NE(base::File::FILE_OK, |
| 283 file_system_.Copy(kSrcDir, URL("dest"))); | 283 file_system_.Copy(kSrcDir, URL("dest"))); |
| 284 | 284 |
| 285 other_file_system_.TearDown(); | 285 other_file_system_.TearDown(); |
| 286 SetEnableSyncFSDirectoryOperation(was_enabled); | 286 SetEnableSyncFSDirectoryOperation(was_enabled); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace sync_file_system | 289 } // namespace sync_file_system |
| OLD | NEW |