OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi
le_util.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/provider_async_fi
le_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Tests in this file are very lightweight and just test integration between | 112 // Tests in this file are very lightweight and just test integration between |
113 // AsyncFileUtil and ProvideFileSystemInterface. Currently it tests if not | 113 // AsyncFileUtil and ProvideFileSystemInterface. Currently it tests if not |
114 // implemented operations return a correct error code. For not allowed | 114 // implemented operations return a correct error code. For not allowed |
115 // operations it is FILE_ERROR_ACCESS_DENIED, and for not implemented the error | 115 // operations it is FILE_ERROR_ACCESS_DENIED, and for not implemented the error |
116 // is FILE_ERROR_INVALID_OPERATION. | 116 // is FILE_ERROR_INVALID_OPERATION. |
117 class FileSystemProviderProviderAsyncFileUtilTest : public testing::Test { | 117 class FileSystemProviderProviderAsyncFileUtilTest : public testing::Test { |
118 protected: | 118 protected: |
119 FileSystemProviderProviderAsyncFileUtilTest() {} | 119 FileSystemProviderProviderAsyncFileUtilTest() {} |
120 virtual ~FileSystemProviderProviderAsyncFileUtilTest() {} | 120 virtual ~FileSystemProviderProviderAsyncFileUtilTest() {} |
121 | 121 |
122 virtual void SetUp() OVERRIDE { | 122 virtual void SetUp() override { |
123 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 123 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
124 profile_manager_.reset( | 124 profile_manager_.reset( |
125 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 125 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
126 ASSERT_TRUE(profile_manager_->SetUp()); | 126 ASSERT_TRUE(profile_manager_->SetUp()); |
127 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); | 127 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); |
128 async_file_util_.reset(new internal::ProviderAsyncFileUtil); | 128 async_file_util_.reset(new internal::ProviderAsyncFileUtil); |
129 | 129 |
130 file_system_context_ = | 130 file_system_context_ = |
131 content::CreateFileSystemContextForTesting(NULL, data_dir_.path()); | 131 content::CreateFileSystemContextForTesting(NULL, data_dir_.path()); |
132 | 132 |
(...skipping 18 matching lines...) Expand all Loading... |
151 base::FilePath::FromUTF8Unsafe( | 151 base::FilePath::FromUTF8Unsafe( |
152 kFakeFilePath + 1 /* No leading slash. */)); | 152 kFakeFilePath + 1 /* No leading slash. */)); |
153 ASSERT_TRUE(file_url_.is_valid()); | 153 ASSERT_TRUE(file_url_.is_valid()); |
154 directory_url_ = CreateFileSystemURL( | 154 directory_url_ = CreateFileSystemURL( |
155 mount_point_name, base::FilePath::FromUTF8Unsafe("hello")); | 155 mount_point_name, base::FilePath::FromUTF8Unsafe("hello")); |
156 ASSERT_TRUE(directory_url_.is_valid()); | 156 ASSERT_TRUE(directory_url_.is_valid()); |
157 root_url_ = CreateFileSystemURL(mount_point_name, base::FilePath()); | 157 root_url_ = CreateFileSystemURL(mount_point_name, base::FilePath()); |
158 ASSERT_TRUE(root_url_.is_valid()); | 158 ASSERT_TRUE(root_url_.is_valid()); |
159 } | 159 } |
160 | 160 |
161 virtual void TearDown() OVERRIDE { | 161 virtual void TearDown() override { |
162 // Setting the testing factory to NULL will destroy the created service | 162 // Setting the testing factory to NULL will destroy the created service |
163 // associated with the testing profile. | 163 // associated with the testing profile. |
164 ServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); | 164 ServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); |
165 } | 165 } |
166 | 166 |
167 scoped_ptr<storage::FileSystemOperationContext> CreateOperationContext() { | 167 scoped_ptr<storage::FileSystemOperationContext> CreateOperationContext() { |
168 return make_scoped_ptr( | 168 return make_scoped_ptr( |
169 new storage::FileSystemOperationContext(file_system_context_.get())); | 169 new storage::FileSystemOperationContext(file_system_context_.get())); |
170 } | 170 } |
171 | 171 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 file_url_, | 419 file_url_, |
420 base::Bind(&EventLogger::OnCreateSnapshotFile, | 420 base::Bind(&EventLogger::OnCreateSnapshotFile, |
421 base::Unretained(&logger))); | 421 base::Unretained(&logger))); |
422 | 422 |
423 ASSERT_TRUE(logger.result()); | 423 ASSERT_TRUE(logger.result()); |
424 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, *logger.result()); | 424 EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, *logger.result()); |
425 } | 425 } |
426 | 426 |
427 } // namespace file_system_provider | 427 } // namespace file_system_provider |
428 } // namespace chromeos | 428 } // namespace chromeos |
OLD | NEW |