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

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

Issue 2800893002: Use ScopedTaskEnvironment instead of MessageLoop in content unit tests. (Closed)
Patch Set: Created 3 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
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 "storage/browser/fileapi/sandbox_file_system_backend.h" 5 #include "storage/browser/fileapi/sandbox_file_system_backend.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 11
12 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
13 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/test/scoped_task_environment.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "content/public/test/test_file_system_options.h" 18 #include "content/public/test/test_file_system_options.h"
18 #include "storage/browser/fileapi/file_system_backend.h" 19 #include "storage/browser/fileapi/file_system_backend.h"
19 #include "storage/browser/fileapi/file_system_url.h" 20 #include "storage/browser/fileapi/file_system_url.h"
20 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h" 21 #include "storage/browser/fileapi/sandbox_file_system_backend_delegate.h"
21 #include "storage/common/fileapi/file_system_util.h" 22 #include "storage/common/fileapi/file_system_util.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
24 25
25 using storage::FileSystemURL; 26 using storage::FileSystemURL;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 *root_path = returned_root_path; 121 *root_path = returned_root_path;
121 return !returned_root_path.empty(); 122 return !returned_root_path.empty();
122 } 123 }
123 124
124 base::FilePath file_system_path() const { 125 base::FilePath file_system_path() const {
125 return data_dir_.GetPath().Append( 126 return data_dir_.GetPath().Append(
126 SandboxFileSystemBackendDelegate::kFileSystemDirectory); 127 SandboxFileSystemBackendDelegate::kFileSystemDirectory);
127 } 128 }
128 129
129 base::ScopedTempDir data_dir_; 130 base::ScopedTempDir data_dir_;
130 base::MessageLoop message_loop_; 131 base::test::ScopedTaskEnvironment scoped_task_environment_;
131 std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_; 132 std::unique_ptr<storage::SandboxFileSystemBackendDelegate> delegate_;
132 std::unique_ptr<storage::SandboxFileSystemBackend> backend_; 133 std::unique_ptr<storage::SandboxFileSystemBackend> backend_;
133 }; 134 };
134 135
135 TEST_F(SandboxFileSystemBackendTest, Empty) { 136 TEST_F(SandboxFileSystemBackendTest, Empty) {
136 SetUpNewBackend(CreateAllowFileAccessOptions()); 137 SetUpNewBackend(CreateAllowFileAccessOptions());
137 std::unique_ptr<SandboxFileSystemBackendDelegate::OriginEnumerator> 138 std::unique_ptr<SandboxFileSystemBackendDelegate::OriginEnumerator>
138 enumerator(CreateOriginEnumerator()); 139 enumerator(CreateOriginEnumerator());
139 ASSERT_TRUE(enumerator->Next().is_empty()); 140 ASSERT_TRUE(enumerator->Next().is_empty());
140 } 141 }
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, 302 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
302 &root_path)); 303 &root_path));
303 base::FilePath expected = file_system_path().AppendASCII( 304 base::FilePath expected = file_system_path().AppendASCII(
304 kRootPathFileURITestCases[i].expected_path); 305 kRootPathFileURITestCases[i].expected_path);
305 EXPECT_EQ(expected.value(), root_path.value()); 306 EXPECT_EQ(expected.value(), root_path.value());
306 EXPECT_TRUE(base::DirectoryExists(root_path)); 307 EXPECT_TRUE(base::DirectoryExists(root_path));
307 } 308 }
308 } 309 }
309 310
310 } // namespace content 311 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698