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

Side by Side Diff: content/browser/fileapi/file_system_context_unittest.cc

Issue 214233005: Move mock_quota_manager and friends from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits Created 6 years, 8 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 "webkit/browser/fileapi/file_system_context.h" 5 #include "webkit/browser/fileapi/file_system_context.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "content/browser/quota/mock_quota_manager.h"
10 #include "content/public/test/test_file_system_options.h" 11 #include "content/public/test/test_file_system_options.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "webkit/browser/fileapi/external_mount_points.h" 13 #include "webkit/browser/fileapi/external_mount_points.h"
13 #include "webkit/browser/fileapi/file_system_backend.h" 14 #include "webkit/browser/fileapi/file_system_backend.h"
14 #include "webkit/browser/fileapi/isolated_context.h" 15 #include "webkit/browser/fileapi/isolated_context.h"
15 #include "webkit/browser/quota/mock_quota_manager.h"
16 #include "webkit/browser/quota/mock_special_storage_policy.h" 16 #include "webkit/browser/quota/mock_special_storage_policy.h"
17 17
18 #define FPL(x) FILE_PATH_LITERAL(x) 18 #define FPL(x) FILE_PATH_LITERAL(x)
19 19
20 #if defined(FILE_PATH_USES_DRIVE_LETTERS) 20 #if defined(FILE_PATH_USES_DRIVE_LETTERS)
21 #define DRIVE FPL("C:") 21 #define DRIVE FPL("C:")
22 #else 22 #else
23 #define DRIVE 23 #define DRIVE
24 #endif 24 #endif
25 25
(...skipping 23 matching lines...) Expand all
49 class FileSystemContextTest : public testing::Test { 49 class FileSystemContextTest : public testing::Test {
50 public: 50 public:
51 FileSystemContextTest() {} 51 FileSystemContextTest() {}
52 52
53 virtual void SetUp() { 53 virtual void SetUp() {
54 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); 54 ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
55 55
56 storage_policy_ = new quota::MockSpecialStoragePolicy(); 56 storage_policy_ = new quota::MockSpecialStoragePolicy();
57 57
58 mock_quota_manager_ = 58 mock_quota_manager_ =
59 new quota::MockQuotaManager(false /* is_incognito */, 59 new MockQuotaManager(false /* is_incognito */,
60 data_dir_.path(), 60 data_dir_.path(),
61 base::MessageLoopProxy::current().get(), 61 base::MessageLoopProxy::current().get(),
62 base::MessageLoopProxy::current().get(), 62 base::MessageLoopProxy::current().get(),
63 storage_policy_.get()); 63 storage_policy_.get());
64 } 64 }
65 65
66 protected: 66 protected:
67 FileSystemContext* CreateFileSystemContextForTest( 67 FileSystemContext* CreateFileSystemContextForTest(
68 fileapi::ExternalMountPoints* external_mount_points) { 68 fileapi::ExternalMountPoints* external_mount_points) {
69 return new FileSystemContext( 69 return new FileSystemContext(
(...skipping 23 matching lines...) Expand all
93 EXPECT_EQ(expect_type, url.type()); 93 EXPECT_EQ(expect_type, url.type());
94 EXPECT_EQ(expect_path, url.path()); 94 EXPECT_EQ(expect_path, url.path());
95 EXPECT_EQ(expect_virtual_path, url.virtual_path()); 95 EXPECT_EQ(expect_virtual_path, url.virtual_path());
96 EXPECT_EQ(expect_filesystem_id, url.filesystem_id()); 96 EXPECT_EQ(expect_filesystem_id, url.filesystem_id());
97 } 97 }
98 98
99 private: 99 private:
100 base::ScopedTempDir data_dir_; 100 base::ScopedTempDir data_dir_;
101 base::MessageLoop message_loop_; 101 base::MessageLoop message_loop_;
102 scoped_refptr<quota::SpecialStoragePolicy> storage_policy_; 102 scoped_refptr<quota::SpecialStoragePolicy> storage_policy_;
103 scoped_refptr<quota::MockQuotaManager> mock_quota_manager_; 103 scoped_refptr<MockQuotaManager> mock_quota_manager_;
104 }; 104 };
105 105
106 // It is not valid to pass NULL ExternalMountPoints to FileSystemContext on 106 // It is not valid to pass NULL ExternalMountPoints to FileSystemContext on
107 // ChromeOS. 107 // ChromeOS.
108 #if !defined(OS_CHROMEOS) 108 #if !defined(OS_CHROMEOS)
109 TEST_F(FileSystemContextTest, NullExternalMountPoints) { 109 TEST_F(FileSystemContextTest, NullExternalMountPoints) {
110 scoped_refptr<FileSystemContext> file_system_context( 110 scoped_refptr<FileSystemContext> file_system_context(
111 CreateFileSystemContextForTest(NULL)); 111 CreateFileSystemContextForTest(NULL));
112 112
113 // Cracking system external mount and isolated mount points should work. 113 // Cracking system external mount and isolated mount points should work.
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 EXPECT_TRUE(context->CanServeURLRequest(cracked_url)); 377 EXPECT_TRUE(context->CanServeURLRequest(cracked_url));
378 378
379 ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( 379 ExternalMountPoints::GetSystemInstance()->RevokeFileSystem(
380 kExternalMountName); 380 kExternalMountName);
381 IsolatedContext::GetInstance()->RevokeFileSystem(isolated_fs_id); 381 IsolatedContext::GetInstance()->RevokeFileSystem(isolated_fs_id);
382 } 382 }
383 383
384 } // namespace 384 } // namespace
385 385
386 } // namespace content 386 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698