| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 extensions::ExtensionRegistry::Get(context)); | 61 extensions::ExtensionRegistry::Get(context)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 class FileSystemProviderFileStreamWriter : public testing::Test { | 66 class FileSystemProviderFileStreamWriter : public testing::Test { |
| 67 protected: | 67 protected: |
| 68 FileSystemProviderFileStreamWriter() {} | 68 FileSystemProviderFileStreamWriter() {} |
| 69 virtual ~FileSystemProviderFileStreamWriter() {} | 69 virtual ~FileSystemProviderFileStreamWriter() {} |
| 70 | 70 |
| 71 virtual void SetUp() OVERRIDE { | 71 virtual void SetUp() override { |
| 72 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 72 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 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)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); | 94 file_system_info.mount_path().BaseName().AsUTF8Unsafe(); |
| 95 | 95 |
| 96 file_url_ = CreateFileSystemURL( | 96 file_url_ = CreateFileSystemURL( |
| 97 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); | 97 mount_point_name, base::FilePath::FromUTF8Unsafe(kFakeFilePath + 1)); |
| 98 ASSERT_TRUE(file_url_.is_valid()); | 98 ASSERT_TRUE(file_url_.is_valid()); |
| 99 wrong_file_url_ = CreateFileSystemURL( | 99 wrong_file_url_ = CreateFileSystemURL( |
| 100 mount_point_name, base::FilePath::FromUTF8Unsafe("im-not-here.txt")); | 100 mount_point_name, base::FilePath::FromUTF8Unsafe("im-not-here.txt")); |
| 101 ASSERT_TRUE(wrong_file_url_.is_valid()); | 101 ASSERT_TRUE(wrong_file_url_.is_valid()); |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void TearDown() OVERRIDE { | 104 virtual void TearDown() override { |
| 105 // Setting the testing factory to NULL will destroy the created service | 105 // Setting the testing factory to NULL will destroy the created service |
| 106 // associated with the testing profile. | 106 // associated with the testing profile. |
| 107 ServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); | 107 ServiceFactory::GetInstance()->SetTestingFactory(profile_, NULL); |
| 108 } | 108 } |
| 109 | 109 |
| 110 content::TestBrowserThreadBundle thread_bundle_; | 110 content::TestBrowserThreadBundle thread_bundle_; |
| 111 base::ScopedTempDir data_dir_; | 111 base::ScopedTempDir data_dir_; |
| 112 scoped_ptr<TestingProfileManager> profile_manager_; | 112 scoped_ptr<TestingProfileManager> profile_manager_; |
| 113 TestingProfile* profile_; // Owned by TestingProfileManager. | 113 TestingProfile* profile_; // Owned by TestingProfileManager. |
| 114 FakeProvidedFileSystem* provided_file_system_; // Owned by Service. | 114 FakeProvidedFileSystem* provided_file_system_; // Owned by Service. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 | 228 |
| 229 ASSERT_EQ(1u, write_log.size()); | 229 ASSERT_EQ(1u, write_log.size()); |
| 230 EXPECT_EQ(sizeof(kTextToWrite) - 1, static_cast<size_t>(write_log[0])); | 230 EXPECT_EQ(sizeof(kTextToWrite) - 1, static_cast<size_t>(write_log[0])); |
| 231 | 231 |
| 232 const std::string expected_contents = original_contents + kTextToWrite; | 232 const std::string expected_contents = original_contents + kTextToWrite; |
| 233 EXPECT_EQ(expected_contents, entry->contents); | 233 EXPECT_EQ(expected_contents, entry->contents); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace file_system_provider | 236 } // namespace file_system_provider |
| 237 } // namespace chromeos | 237 } // namespace chromeos |
| OLD | NEW |