| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 14 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 15 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 19 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" | 19 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" |
| 20 #include "chrome/browser/chromeos/file_system_provider/service.h" | 20 #include "chrome/browser/chromeos/file_system_provider/service.h" |
| 21 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" | 21 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" |
| 22 #include "chrome/test/base/testing_browser_process.h" | 22 #include "chrome/test/base/testing_browser_process.h" |
| 23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
| 24 #include "chrome/test/base/testing_profile_manager.h" | 24 #include "chrome/test/base/testing_profile_manager.h" |
| 25 #include "content/public/test/test_browser_thread_bundle.h" | 25 #include "content/public/test/test_browser_thread_bundle.h" |
| 26 #include "content/public/test/test_file_system_context.h" | 26 #include "content/public/test/test_file_system_context.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 file_url_ = CreateFileSystemURL(mount_point_name, | 89 file_url_ = CreateFileSystemURL(mount_point_name, |
| 90 base::FilePath(kFakeFilePath + 1)); | 90 base::FilePath(kFakeFilePath + 1)); |
| 91 ASSERT_TRUE(file_url_.is_valid()); | 91 ASSERT_TRUE(file_url_.is_valid()); |
| 92 wrong_file_url_ = CreateFileSystemURL( | 92 wrong_file_url_ = CreateFileSystemURL( |
| 93 mount_point_name, base::FilePath(FILE_PATH_LITERAL("im-not-here.txt"))); | 93 mount_point_name, base::FilePath(FILE_PATH_LITERAL("im-not-here.txt"))); |
| 94 ASSERT_TRUE(wrong_file_url_.is_valid()); | 94 ASSERT_TRUE(wrong_file_url_.is_valid()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 content::TestBrowserThreadBundle thread_bundle_; | 97 content::TestBrowserThreadBundle thread_bundle_; |
| 98 base::ScopedTempDir data_dir_; | 98 base::ScopedTempDir data_dir_; |
| 99 scoped_ptr<TestingProfileManager> profile_manager_; | 99 std::unique_ptr<TestingProfileManager> profile_manager_; |
| 100 TestingProfile* profile_; // Owned by TestingProfileManager. | 100 TestingProfile* profile_; // Owned by TestingProfileManager. |
| 101 FakeProvidedFileSystem* provided_file_system_; // Owned by Service. | 101 FakeProvidedFileSystem* provided_file_system_; // Owned by Service. |
| 102 storage::FileSystemURL file_url_; | 102 storage::FileSystemURL file_url_; |
| 103 storage::FileSystemURL wrong_file_url_; | 103 storage::FileSystemURL wrong_file_url_; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 TEST_F(FileSystemProviderFileStreamWriter, Write) { | 106 TEST_F(FileSystemProviderFileStreamWriter, Write) { |
| 107 std::vector<int> write_log; | 107 std::vector<int> write_log; |
| 108 | 108 |
| 109 const int64_t initial_offset = 0; | 109 const int64_t initial_offset = 0; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 ASSERT_EQ(1u, write_log.size()); | 232 ASSERT_EQ(1u, write_log.size()); |
| 233 EXPECT_EQ(sizeof(kTextToWrite) - 1, static_cast<size_t>(write_log[0])); | 233 EXPECT_EQ(sizeof(kTextToWrite) - 1, static_cast<size_t>(write_log[0])); |
| 234 | 234 |
| 235 const std::string expected_contents = original_contents + kTextToWrite; | 235 const std::string expected_contents = original_contents + kTextToWrite; |
| 236 EXPECT_EQ(expected_contents, entry->contents); | 236 EXPECT_EQ(expected_contents, entry->contents); |
| 237 } | 237 } |
| 238 | 238 |
| 239 } // namespace file_system_provider | 239 } // namespace file_system_provider |
| 240 } // namespace chromeos | 240 } // namespace chromeos |
| OLD | NEW |