OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/fileapi/file_system_dir_url_request_job.h" | 5 #include "webkit/fileapi/file_system_dir_url_request_job.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 new FileSystemContext( | 55 new FileSystemContext( |
56 FileSystemTaskRunners::CreateMockTaskRunners(), | 56 FileSystemTaskRunners::CreateMockTaskRunners(), |
57 special_storage_policy_, NULL, | 57 special_storage_policy_, NULL, |
58 temp_dir_.path(), | 58 temp_dir_.path(), |
59 CreateAllowFileAccessOptions()); | 59 CreateAllowFileAccessOptions()); |
60 | 60 |
61 file_system_context_->sandbox_provider()->ValidateFileSystemRoot( | 61 file_system_context_->sandbox_provider()->ValidateFileSystemRoot( |
62 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create | 62 GURL("http://remote/"), kFileSystemTypeTemporary, true, // create |
63 base::Bind(&FileSystemDirURLRequestJobTest::OnValidateFileSystem, | 63 base::Bind(&FileSystemDirURLRequestJobTest::OnValidateFileSystem, |
64 weak_factory_.GetWeakPtr())); | 64 weak_factory_.GetWeakPtr())); |
65 MessageLoop::current()->RunAllPending(); | 65 MessageLoop::current()->RunUntilIdle(); |
66 | 66 |
67 net::URLRequest::Deprecated::RegisterProtocolFactory( | 67 net::URLRequest::Deprecated::RegisterProtocolFactory( |
68 "filesystem", &FileSystemDirURLRequestJobFactory); | 68 "filesystem", &FileSystemDirURLRequestJobFactory); |
69 } | 69 } |
70 | 70 |
71 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() OVERRIDE { |
72 // NOTE: order matters, request must die before delegate | 72 // NOTE: order matters, request must die before delegate |
73 request_.reset(NULL); | 73 request_.reset(NULL); |
74 delegate_.reset(NULL); | 74 delegate_.reset(NULL); |
75 | 75 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 ASSERT_FALSE(request_->is_pending()); | 280 ASSERT_FALSE(request_->is_pending()); |
281 ASSERT_FALSE(request_->status().is_success()); | 281 ASSERT_FALSE(request_->status().is_success()); |
282 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); | 282 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
283 } | 283 } |
284 | 284 |
285 TEST_F(FileSystemDirURLRequestJobTest, Cancel) { | 285 TEST_F(FileSystemDirURLRequestJobTest, Cancel) { |
286 CreateDirectory("foo"); | 286 CreateDirectory("foo"); |
287 TestRequestNoRun(CreateFileSystemURL("foo/")); | 287 TestRequestNoRun(CreateFileSystemURL("foo/")); |
288 // Run StartAsync() and only StartAsync(). | 288 // Run StartAsync() and only StartAsync(). |
289 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); | 289 MessageLoop::current()->DeleteSoon(FROM_HERE, request_.release()); |
290 MessageLoop::current()->RunAllPending(); | 290 MessageLoop::current()->RunUntilIdle(); |
291 // If we get here, success! we didn't crash! | 291 // If we get here, success! we didn't crash! |
292 } | 292 } |
293 | 293 |
294 } // namespace (anonymous) | 294 } // namespace (anonymous) |
295 } // namespace fileapi | 295 } // namespace fileapi |
OLD | NEW |