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

Side by Side Diff: webkit/fileapi/file_system_dir_url_request_job_unittest.cc

Issue 9004019: Cleanup: Removing FileSystemPathManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 11 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit)
6 // rather than as part of test_shell_tests because they rely on being able 6 // rather than as part of test_shell_tests because they rely on being able
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses
8 // TYPE_UI, which URLRequest doesn't allow. 8 // TYPE_UI, which URLRequest doesn't allow.
9 // 9 //
10 10
(...skipping 14 matching lines...) Expand all
25 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
26 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
27 #include "net/http/http_request_headers.h" 27 #include "net/http/http_request_headers.h"
28 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
29 #include "net/url_request/url_request_test_util.h" 29 #include "net/url_request/url_request_test_util.h"
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 #include "unicode/regex.h" 31 #include "unicode/regex.h"
32 #include "webkit/fileapi/file_system_context.h" 32 #include "webkit/fileapi/file_system_context.h"
33 #include "webkit/fileapi/file_system_file_util.h" 33 #include "webkit/fileapi/file_system_file_util.h"
34 #include "webkit/fileapi/file_system_operation_context.h" 34 #include "webkit/fileapi/file_system_operation_context.h"
35 #include "webkit/fileapi/file_system_path_manager.h" 35 #include "webkit/fileapi/mock_file_system_options.h"
36 #include "webkit/fileapi/sandbox_mount_point_provider.h" 36 #include "webkit/fileapi/sandbox_mount_point_provider.h"
37 #include "webkit/quota/mock_special_storage_policy.h" 37 #include "webkit/quota/mock_special_storage_policy.h"
38 38
39 namespace fileapi { 39 namespace fileapi {
40 namespace { 40 namespace {
41 41
42 // We always use the TEMPORARY FileSystem in this test. 42 // We always use the TEMPORARY FileSystem in this test.
43 static const char kFileSystemURLPrefix[] = 43 static const char kFileSystemURLPrefix[] =
44 "filesystem:http://remote/temporary/"; 44 "filesystem:http://remote/temporary/";
45 45
46 } // namespace 46 } // namespace
47 47
48 class FileSystemDirURLRequestJobTest : public testing::Test { 48 class FileSystemDirURLRequestJobTest : public testing::Test {
49 protected: 49 protected:
50 FileSystemDirURLRequestJobTest() 50 FileSystemDirURLRequestJobTest()
51 : message_loop_(MessageLoop::TYPE_IO), // simulate an IO thread 51 : message_loop_(MessageLoop::TYPE_IO), // simulate an IO thread
52 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { 52 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
53 } 53 }
54 54
55 virtual void SetUp() OVERRIDE { 55 virtual void SetUp() OVERRIDE {
56 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 56 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
57 57
58 file_thread_proxy_ = base::MessageLoopProxy::current(); 58 file_thread_proxy_ = base::MessageLoopProxy::current();
59 59
60 special_storage_policy_ = new quota::MockSpecialStoragePolicy; 60 special_storage_policy_ = new quota::MockSpecialStoragePolicy;
61 file_system_context_ = 61 file_system_context_ =
62 new FileSystemContext( 62 new FileSystemContext(
63 base::MessageLoopProxy::current(), 63 file_thread_proxy_,
64 base::MessageLoopProxy::current(), 64 base::MessageLoopProxy::current(),
65 special_storage_policy_, NULL, 65 special_storage_policy_, NULL,
66 FilePath(), false /* is_incognito */, true /* allow_file_access */, 66 temp_dir_.path(),
67 new FileSystemPathManager( 67 CreateAllowFileAccessOptions());
68 file_thread_proxy_, temp_dir_.path(),
69 NULL, false, false));
70 68
71 file_system_context_->path_manager()->ValidateFileSystemRootAndGetURL( 69 file_system_context_->sandbox_provider()->ValidateFileSystemRootAndGetURL(
72 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create 70 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create
73 base::Bind(&FileSystemDirURLRequestJobTest::OnGetRootPath, 71 base::Bind(&FileSystemDirURLRequestJobTest::OnGetRootPath,
74 weak_factory_.GetWeakPtr())); 72 weak_factory_.GetWeakPtr()));
75 MessageLoop::current()->RunAllPending(); 73 MessageLoop::current()->RunAllPending();
76 74
77 net::URLRequest::Deprecated::RegisterProtocolFactory( 75 net::URLRequest::Deprecated::RegisterProtocolFactory(
78 "filesystem", &FileSystemDirURLRequestJobFactory); 76 "filesystem", &FileSystemDirURLRequestJobFactory);
79 } 77 }
80 78
81 virtual void TearDown() OVERRIDE { 79 virtual void TearDown() OVERRIDE {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 static net::URLRequestJob* FileSystemDirURLRequestJobFactory( 192 static net::URLRequestJob* FileSystemDirURLRequestJobFactory(
195 net::URLRequest* request, 193 net::URLRequest* request,
196 const std::string& scheme) { 194 const std::string& scheme) {
197 DCHECK(job_); 195 DCHECK(job_);
198 net::URLRequestJob* temp = job_; 196 net::URLRequestJob* temp = job_;
199 job_ = NULL; 197 job_ = NULL;
200 return temp; 198 return temp;
201 } 199 }
202 200
203 FileSystemFileUtil* file_util() { 201 FileSystemFileUtil* file_util() {
204 return file_system_context_->path_manager()->sandbox_provider()-> 202 return file_system_context_->sandbox_provider()->GetFileUtil();
205 GetFileUtil();
206 } 203 }
207 204
208 // Put the message loop at the top, so that it's the last thing deleted. 205 // Put the message loop at the top, so that it's the last thing deleted.
209 MessageLoop message_loop_; 206 MessageLoop message_loop_;
210 // Delete all MessageLoopProxy objects before the MessageLoop, to help prevent 207 // Delete all MessageLoopProxy objects before the MessageLoop, to help prevent
211 // leaks caused by tasks posted during shutdown. 208 // leaks caused by tasks posted during shutdown.
212 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_; 209 scoped_refptr<base::MessageLoopProxy> file_thread_proxy_;
213 210
214 ScopedTempDir temp_dir_; 211 ScopedTempDir temp_dir_;
215 FilePath root_path_; 212 FilePath root_path_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 CreateDirectory("foo"); 282 CreateDirectory("foo");
286 TestRequestNoRun(CreateFileSystemURL("foo/")); 283 TestRequestNoRun(CreateFileSystemURL("foo/"));
287 // Run StartAsync() and only StartAsync(). 284 // Run StartAsync() and only StartAsync().
288 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); 285 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release());
289 MessageLoop::current()->RunAllPending(); 286 MessageLoop::current()->RunAllPending();
290 // If we get here, success! we didn't crash! 287 // If we get here, success! we didn't crash!
291 } 288 }
292 289
293 } // namespace (anonymous) 290 } // namespace (anonymous)
294 } // namespace fileapi 291 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_dir_url_request_job.cc ('k') | webkit/fileapi/file_system_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698