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 base::File::Error result = service->MountFileSystem( |
100 kExtensionId, MountOptions(kFileSystemId, "Testing File System")); | 100 kExtensionId, MountOptions(kFileSystemId, "Testing File System")); |
101 ASSERT_TRUE(result); | 101 ASSERT_EQ(base::File::FILE_OK, result); |
102 FakeProvidedFileSystem* provided_file_system = | 102 FakeProvidedFileSystem* provided_file_system = |
103 static_cast<FakeProvidedFileSystem*>( | 103 static_cast<FakeProvidedFileSystem*>( |
104 service->GetProvidedFileSystem(kExtensionId, kFileSystemId)); | 104 service->GetProvidedFileSystem(kExtensionId, kFileSystemId)); |
105 ASSERT_TRUE(provided_file_system); | 105 ASSERT_TRUE(provided_file_system); |
106 fake_file_ = provided_file_system->GetEntry( | 106 fake_file_ = provided_file_system->GetEntry( |
107 base::FilePath::FromUTF8Unsafe(kFakeFilePath)); | 107 base::FilePath::FromUTF8Unsafe(kFakeFilePath)); |
108 ASSERT_TRUE(fake_file_); | 108 ASSERT_TRUE(fake_file_); |
109 const ProvidedFileSystemInfo& file_system_info = | 109 const ProvidedFileSystemInfo& file_system_info = |
110 service->GetProvidedFileSystem(kExtensionId, kFileSystemId) | 110 service->GetProvidedFileSystem(kExtensionId, kFileSystemId) |
111 ->GetFileSystemInfo(); | 111 ->GetFileSystemInfo(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 EXPECT_EQ(net::ERR_IO_PENDING, result); | 362 EXPECT_EQ(net::ERR_IO_PENDING, result); |
363 base::RunLoop().RunUntilIdle(); | 363 base::RunLoop().RunUntilIdle(); |
364 | 364 |
365 ASSERT_EQ(1u, logger.results().size()); | 365 ASSERT_EQ(1u, logger.results().size()); |
366 EXPECT_LT(0, logger.results()[0]); | 366 EXPECT_LT(0, logger.results()[0]); |
367 EXPECT_EQ(fake_file_->metadata->size, logger.results()[0]); | 367 EXPECT_EQ(fake_file_->metadata->size, logger.results()[0]); |
368 } | 368 } |
369 | 369 |
370 } // namespace file_system_provider | 370 } // namespace file_system_provider |
371 } // namespace chromeos | 371 } // namespace chromeos |
OLD | NEW |