| 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/file_stream_reade
r.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_reade
r.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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 profile_manager_.reset( | 89 profile_manager_.reset( |
| 90 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 90 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 91 ASSERT_TRUE(profile_manager_->SetUp()); | 91 ASSERT_TRUE(profile_manager_->SetUp()); |
| 92 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); | 92 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); |
| 93 | 93 |
| 94 ServiceFactory::GetInstance()->SetTestingFactory(profile_, &CreateService); | 94 ServiceFactory::GetInstance()->SetTestingFactory(profile_, &CreateService); |
| 95 Service* service = Service::Get(profile_); // Owned by its factory. | 95 Service* service = Service::Get(profile_); // Owned by its factory. |
| 96 service->SetFileSystemFactoryForTesting( | 96 service->SetFileSystemFactoryForTesting( |
| 97 base::Bind(&FakeProvidedFileSystem::Create)); | 97 base::Bind(&FakeProvidedFileSystem::Create)); |
| 98 | 98 |
| 99 const bool result = service->MountFileSystem( | 99 const bool result = service->MountFileSystem(kExtensionId, |
| 100 kExtensionId, kFileSystemId, "Testing File System"); | 100 kFileSystemId, |
| 101 "Testing File System", |
| 102 false /* writable */); |
| 101 ASSERT_TRUE(result); | 103 ASSERT_TRUE(result); |
| 102 const ProvidedFileSystemInfo& file_system_info = | 104 const ProvidedFileSystemInfo& file_system_info = |
| 103 service->GetProvidedFileSystem(kExtensionId, kFileSystemId) | 105 service->GetProvidedFileSystem(kExtensionId, kFileSystemId) |
| 104 ->GetFileSystemInfo(); | 106 ->GetFileSystemInfo(); |
| 105 const std::string mount_point_name = | 107 const std::string mount_point_name = |
| 106 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); | 108 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); |
| 107 | 109 |
| 108 file_url_ = CreateFileSystemURL( | 110 file_url_ = CreateFileSystemURL( |
| 109 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); | 111 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); |
| 110 ASSERT_TRUE(file_url_.is_valid()); | 112 ASSERT_TRUE(file_url_.is_valid()); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 EXPECT_EQ(net::ERR_IO_PENDING, result); | 351 EXPECT_EQ(net::ERR_IO_PENDING, result); |
| 350 base::RunLoop().RunUntilIdle(); | 352 base::RunLoop().RunUntilIdle(); |
| 351 | 353 |
| 352 ASSERT_EQ(1u, logger.results().size()); | 354 ASSERT_EQ(1u, logger.results().size()); |
| 353 EXPECT_LT(0, logger.results()[0]); | 355 EXPECT_LT(0, logger.results()[0]); |
| 354 EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0])); | 356 EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0])); |
| 355 } | 357 } |
| 356 | 358 |
| 357 } // namespace file_system_provider | 359 } // namespace file_system_provider |
| 358 } // namespace chromeos | 360 } // namespace chromeos |
| OLD | NEW |