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_write
r.h" | 5 #include "chrome/browser/chromeos/file_system_provider/fileapi/file_stream_write
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 profile_manager_.reset( | 73 profile_manager_.reset( |
74 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 74 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
75 ASSERT_TRUE(profile_manager_->SetUp()); | 75 ASSERT_TRUE(profile_manager_->SetUp()); |
76 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); | 76 profile_ = profile_manager_->CreateTestingProfile("testing-profile"); |
77 | 77 |
78 ServiceFactory::GetInstance()->SetTestingFactory(profile_, &CreateService); | 78 ServiceFactory::GetInstance()->SetTestingFactory(profile_, &CreateService); |
79 Service* service = Service::Get(profile_); // Owned by its factory. | 79 Service* service = Service::Get(profile_); // Owned by its factory. |
80 service->SetFileSystemFactoryForTesting( | 80 service->SetFileSystemFactoryForTesting( |
81 base::Bind(&FakeProvidedFileSystem::Create)); | 81 base::Bind(&FakeProvidedFileSystem::Create)); |
82 | 82 |
83 const bool result = service->MountFileSystem( | 83 const base::File::Error result = service->MountFileSystem( |
84 kExtensionId, MountOptions(kFileSystemId, "Testing File System")); | 84 kExtensionId, MountOptions(kFileSystemId, "Testing File System")); |
85 ASSERT_TRUE(result); | 85 ASSERT_EQ(base::File::FILE_OK, result); |
86 provided_file_system_ = static_cast<FakeProvidedFileSystem*>( | 86 provided_file_system_ = static_cast<FakeProvidedFileSystem*>( |
87 service->GetProvidedFileSystem(kExtensionId, kFileSystemId)); | 87 service->GetProvidedFileSystem(kExtensionId, kFileSystemId)); |
88 ASSERT_TRUE(provided_file_system_); | 88 ASSERT_TRUE(provided_file_system_); |
89 const ProvidedFileSystemInfo& file_system_info = | 89 const ProvidedFileSystemInfo& file_system_info = |
90 provided_file_system_->GetFileSystemInfo(); | 90 provided_file_system_->GetFileSystemInfo(); |
91 const std::string mount_point_name = | 91 const std::string mount_point_name = |
92 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); | 92 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); |
93 | 93 |
94 file_url_ = CreateFileSystemURL( | 94 file_url_ = CreateFileSystemURL( |
95 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); | 95 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 ASSERT_EQ(1u, write_log.size()); | 227 ASSERT_EQ(1u, write_log.size()); |
228 EXPECT_EQ(sizeof(kTextToWrite) - 1, static_cast<size_t>(write_log[0])); | 228 EXPECT_EQ(sizeof(kTextToWrite) - 1, static_cast<size_t>(write_log[0])); |
229 | 229 |
230 const std::string expected_contents = original_contents + kTextToWrite; | 230 const std::string expected_contents = original_contents + kTextToWrite; |
231 EXPECT_EQ(expected_contents, entry->contents); | 231 EXPECT_EQ(expected_contents, entry->contents); |
232 } | 232 } |
233 | 233 |
234 } // namespace file_system_provider | 234 } // namespace file_system_provider |
235 } // namespace chromeos | 235 } // namespace chromeos |
OLD | NEW |