Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Side by Side Diff: chrome/browser/sync_file_system/local/syncable_file_system_unittest.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/thread_task_runner_handle.h" 6 #include "base/thread_task_runner_handle.h"
7 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" 7 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" 8 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h"
9 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" 9 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" 10 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" 11 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
12 #include "content/public/test/async_file_test_helper.h" 12 #include "content/public/test/async_file_test_helper.h"
13 #include "content/public/test/sandbox_file_system_test_helper.h" 13 #include "content/public/test/sandbox_file_system_test_helper.h"
14 #include "content/public/test/test_browser_thread_bundle.h" 14 #include "content/public/test/test_browser_thread_bundle.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" 16 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h"
17 #include "third_party/leveldatabase/src/include/leveldb/env.h" 17 #include "third_party/leveldatabase/src/include/leveldb/env.h"
18 #include "webkit/browser/fileapi/file_system_context.h" 18 #include "storage/browser/fileapi/file_system_context.h"
19 #include "webkit/browser/fileapi/file_system_operation_context.h" 19 #include "storage/browser/fileapi/file_system_operation_context.h"
20 #include "webkit/browser/fileapi/isolated_context.h" 20 #include "storage/browser/fileapi/isolated_context.h"
21 #include "webkit/browser/quota/quota_manager.h" 21 #include "storage/browser/quota/quota_manager.h"
22 #include "webkit/common/fileapi/file_system_types.h" 22 #include "storage/common/fileapi/file_system_types.h"
23 #include "webkit/common/quota/quota_types.h" 23 #include "storage/common/quota/quota_types.h"
24 24
25 using content::SandboxFileSystemTestHelper; 25 using content::SandboxFileSystemTestHelper;
26 using fileapi::FileSystemContext; 26 using storage::FileSystemContext;
27 using fileapi::FileSystemOperationContext; 27 using storage::FileSystemOperationContext;
28 using fileapi::FileSystemURL; 28 using storage::FileSystemURL;
29 using fileapi::FileSystemURLSet; 29 using storage::FileSystemURLSet;
30 using quota::QuotaManager; 30 using quota::QuotaManager;
31 using quota::QuotaStatusCode; 31 using quota::QuotaStatusCode;
32 32
33 namespace sync_file_system { 33 namespace sync_file_system {
34 34
35 class SyncableFileSystemTest : public testing::Test { 35 class SyncableFileSystemTest : public testing::Test {
36 public: 36 public:
37 SyncableFileSystemTest() 37 SyncableFileSystemTest()
38 : in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())), 38 : in_memory_env_(leveldb::NewMemEnv(leveldb::Env::Default())),
39 file_system_(GURL("http://example.com/"), 39 file_system_(GURL("http://example.com/"),
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 EXPECT_EQ(base::File::FILE_OK, 255 EXPECT_EQ(base::File::FILE_OK,
256 file_system_.OpenFileSystem()); 256 file_system_.OpenFileSystem());
257 257
258 // Try some directory operations (which should fail). 258 // Try some directory operations (which should fail).
259 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, 259 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION,
260 file_system_.CreateDirectory(URL("dir"))); 260 file_system_.CreateDirectory(URL("dir")));
261 261
262 // Set up another (non-syncable) local file system. 262 // Set up another (non-syncable) local file system.
263 SandboxFileSystemTestHelper other_file_system_( 263 SandboxFileSystemTestHelper other_file_system_(
264 GURL("http://foo.com/"), fileapi::kFileSystemTypeTemporary); 264 GURL("http://foo.com/"), storage::kFileSystemTypeTemporary);
265 other_file_system_.SetUp(file_system_.file_system_context()); 265 other_file_system_.SetUp(file_system_.file_system_context());
266 266
267 // Create directory '/a' and file '/a/b' in the other file system. 267 // Create directory '/a' and file '/a/b' in the other file system.
268 const FileSystemURL kSrcDir = other_file_system_.CreateURLFromUTF8("/a"); 268 const FileSystemURL kSrcDir = other_file_system_.CreateURLFromUTF8("/a");
269 const FileSystemURL kSrcChild = other_file_system_.CreateURLFromUTF8("/a/b"); 269 const FileSystemURL kSrcChild = other_file_system_.CreateURLFromUTF8("/a/b");
270 270
271 EXPECT_EQ(base::File::FILE_OK, 271 EXPECT_EQ(base::File::FILE_OK,
272 content::AsyncFileTestHelper::CreateDirectory( 272 content::AsyncFileTestHelper::CreateDirectory(
273 other_file_system_.file_system_context(), kSrcDir)); 273 other_file_system_.file_system_context(), kSrcDir));
274 EXPECT_EQ(base::File::FILE_OK, 274 EXPECT_EQ(base::File::FILE_OK,
275 content::AsyncFileTestHelper::CreateFile( 275 content::AsyncFileTestHelper::CreateFile(
276 other_file_system_.file_system_context(), kSrcChild)); 276 other_file_system_.file_system_context(), kSrcChild));
277 277
278 // Now try copying the directory into the syncable file system, which should 278 // Now try copying the directory into the syncable file system, which should
279 // fail if directory operation is disabled. (http://crbug.com/161442) 279 // fail if directory operation is disabled. (http://crbug.com/161442)
280 EXPECT_NE(base::File::FILE_OK, 280 EXPECT_NE(base::File::FILE_OK,
281 file_system_.Copy(kSrcDir, URL("dest"))); 281 file_system_.Copy(kSrcDir, URL("dest")));
282 282
283 other_file_system_.TearDown(); 283 other_file_system_.TearDown();
284 } 284 }
285 285
286 } // namespace sync_file_system 286 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698