Index: content/browser/fileapi/file_system_url_request_job_unittest.cc |
diff --git a/content/browser/fileapi/file_system_url_request_job_unittest.cc b/content/browser/fileapi/file_system_url_request_job_unittest.cc |
index df444facd2f6a2dfac0c6b940bba3505f7c08a34..2ddaef62fc6c9be68fb8aefc972171b86a44b5a1 100644 |
--- a/content/browser/fileapi/file_system_url_request_job_unittest.cc |
+++ b/content/browser/fileapi/file_system_url_request_job_unittest.cc |
@@ -11,7 +11,6 @@ |
#include "base/files/file_path.h" |
#include "base/files/scoped_temp_dir.h" |
#include "base/format_macros.h" |
-#include "base/memory/scoped_vector.h" |
#include "base/memory/weak_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/message_loop/message_loop_proxy.h" |
@@ -22,7 +21,6 @@ |
#include "base/strings/stringprintf.h" |
#include "base/strings/utf_string_conversions.h" |
#include "content/public/test/async_file_test_helper.h" |
-#include "content/public/test/test_file_system_backend.h" |
#include "content/public/test/test_file_system_context.h" |
#include "net/base/load_flags.h" |
#include "net/base/mime_util.h" |
@@ -55,32 +53,6 @@ |
base::RandBytes(buffer, len); |
} |
-const char kValidExternalMountPoint[] = "mnt_name"; |
- |
-// An auto mounter that will try to mount anything for |storage_domain| = |
-// "automount", but will only succeed for the mount point "mnt_name". |
-bool TestAutoMountForURLRequest( |
- const net::URLRequest* /*url_request*/, |
- const fileapi::FileSystemURL& filesystem_url, |
- const std::string& storage_domain, |
- const base::Callback<void(base::File::Error result)>& callback) { |
- if (storage_domain != "automount") |
- return false; |
- std::vector<base::FilePath::StringType> components; |
- filesystem_url.path().GetComponents(&components); |
- std::string mount_point = base::FilePath(components[0]).AsUTF8Unsafe(); |
- |
- if (mount_point == kValidExternalMountPoint) { |
- fileapi::ExternalMountPoints::GetSystemInstance()->RegisterFileSystem( |
- kValidExternalMountPoint, fileapi::kFileSystemTypeTest, |
- fileapi::FileSystemMountOption(), base::FilePath()); |
- callback.Run(base::File::FILE_OK); |
- } else { |
- callback.Run(base::File::FILE_ERROR_NOT_FOUND); |
- } |
- return true; |
-} |
- |
} // namespace |
class FileSystemURLRequestJobTest : public testing::Test { |
@@ -116,25 +88,6 @@ |
} |
// FileReader posts a task to close the file in destructor. |
base::RunLoop().RunUntilIdle(); |
- } |
- |
- void SetUpAutoMountContext() { |
- base::FilePath mnt_point = temp_dir_.path().AppendASCII("auto_mount_dir"); |
- ASSERT_TRUE(base::CreateDirectory(mnt_point)); |
- |
- ScopedVector<fileapi::FileSystemBackend> additional_providers; |
- additional_providers.push_back(new TestFileSystemBackend( |
- base::MessageLoopProxy::current().get(), mnt_point)); |
- |
- std::vector<fileapi::URLRequestAutoMountHandler> handlers; |
- handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); |
- |
- file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( |
- NULL, additional_providers.Pass(), handlers, temp_dir_.path()); |
- |
- ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, |
- base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, |
- sizeof(kTestFileData) - 1)); |
} |
void OnOpenFileSystem(const GURL& root_url, |
@@ -157,7 +110,7 @@ |
request_->SetExtraRequestHeaders(*headers); |
ASSERT_TRUE(!job_); |
job_ = new FileSystemURLRequestJob( |
- request_.get(), NULL, url.GetOrigin().host(), file_system_context); |
+ request_.get(), NULL, file_system_context); |
pending_job_ = job_; |
request_->Start(); |
@@ -307,6 +260,7 @@ |
EXPECT_TRUE(partial_buffer_string == delegate_->data_received()); |
} |
+ |
TEST_F(FileSystemURLRequestJobTest, FileTestMultipleRangesNotSupported) { |
WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); |
net::HttpRequestHeaders headers; |
@@ -415,49 +369,5 @@ |
EXPECT_EQ(200, request_->GetResponseCode()); |
} |
-TEST_F(FileSystemURLRequestJobTest, AutoMountFileTest) { |
- SetUpAutoMountContext(); |
- TestRequest(GURL("filesystem:http://automount/external/mnt_name/foo")); |
- |
- ASSERT_FALSE(request_->is_pending()); |
- EXPECT_EQ(1, delegate_->response_started_count()); |
- EXPECT_FALSE(delegate_->received_data_before_response()); |
- EXPECT_EQ(kTestFileData, delegate_->data_received()); |
- EXPECT_EQ(200, request_->GetResponseCode()); |
- std::string cache_control; |
- request_->GetResponseHeaderByName("cache-control", &cache_control); |
- EXPECT_EQ("no-cache", cache_control); |
- |
- ASSERT_TRUE( |
- fileapi::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
- kValidExternalMountPoint)); |
-} |
- |
-TEST_F(FileSystemURLRequestJobTest, AutoMountInvalidRoot) { |
- SetUpAutoMountContext(); |
- TestRequest(GURL("filesystem:http://automount/external/invalid/foo")); |
- |
- ASSERT_FALSE(request_->is_pending()); |
- EXPECT_TRUE(delegate_->request_failed()); |
- EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
- |
- ASSERT_FALSE( |
- fileapi::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
- "invalid")); |
-} |
- |
-TEST_F(FileSystemURLRequestJobTest, AutoMountNoHandler) { |
- SetUpAutoMountContext(); |
- TestRequest(GURL("filesystem:http://noauto/external/mnt_name/foo")); |
- |
- ASSERT_FALSE(request_->is_pending()); |
- EXPECT_TRUE(delegate_->request_failed()); |
- EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error()); |
- |
- ASSERT_FALSE( |
- fileapi::ExternalMountPoints::GetSystemInstance()->RevokeFileSystem( |
- kValidExternalMountPoint)); |
-} |
- |
} // namespace |
} // namespace content |