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 <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/macros.h" | 17 #include "base/macros.h" |
17 #include "base/memory/scoped_ptr.h" | |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/numerics/safe_math.h" | 19 #include "base/numerics/safe_math.h" |
20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
21 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" | 21 #include "chrome/browser/chromeos/file_system_provider/fake_provided_file_system
.h" |
22 #include "chrome/browser/chromeos/file_system_provider/service.h" | 22 #include "chrome/browser/chromeos/file_system_provider/service.h" |
23 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" | 23 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" |
24 #include "chrome/test/base/testing_browser_process.h" | 24 #include "chrome/test/base/testing_browser_process.h" |
25 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
26 #include "chrome/test/base/testing_profile_manager.h" | 26 #include "chrome/test/base/testing_profile_manager.h" |
27 #include "content/public/test/test_browser_thread_bundle.h" | 27 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 file_url_ = CreateFileSystemURL(mount_point_name, | 111 file_url_ = CreateFileSystemURL(mount_point_name, |
112 base::FilePath(kFakeFilePath + 1)); | 112 base::FilePath(kFakeFilePath + 1)); |
113 ASSERT_TRUE(file_url_.is_valid()); | 113 ASSERT_TRUE(file_url_.is_valid()); |
114 wrong_file_url_ = CreateFileSystemURL( | 114 wrong_file_url_ = CreateFileSystemURL( |
115 mount_point_name, base::FilePath(FILE_PATH_LITERAL("im-not-here.txt"))); | 115 mount_point_name, base::FilePath(FILE_PATH_LITERAL("im-not-here.txt"))); |
116 ASSERT_TRUE(wrong_file_url_.is_valid()); | 116 ASSERT_TRUE(wrong_file_url_.is_valid()); |
117 } | 117 } |
118 | 118 |
119 content::TestBrowserThreadBundle thread_bundle_; | 119 content::TestBrowserThreadBundle thread_bundle_; |
120 base::ScopedTempDir data_dir_; | 120 base::ScopedTempDir data_dir_; |
121 scoped_ptr<TestingProfileManager> profile_manager_; | 121 std::unique_ptr<TestingProfileManager> profile_manager_; |
122 TestingProfile* profile_; // Owned by TestingProfileManager. | 122 TestingProfile* profile_; // Owned by TestingProfileManager. |
123 const FakeEntry* fake_file_; // Owned by FakePRovidedFileSystem. | 123 const FakeEntry* fake_file_; // Owned by FakePRovidedFileSystem. |
124 storage::FileSystemURL file_url_; | 124 storage::FileSystemURL file_url_; |
125 storage::FileSystemURL wrong_file_url_; | 125 storage::FileSystemURL wrong_file_url_; |
126 }; | 126 }; |
127 | 127 |
128 TEST_F(FileSystemProviderFileStreamReader, Read_AllAtOnce) { | 128 TEST_F(FileSystemProviderFileStreamReader, Read_AllAtOnce) { |
129 EventLogger logger; | 129 EventLogger logger; |
130 | 130 |
131 const int64_t initial_offset = 0; | 131 const int64_t initial_offset = 0; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 EXPECT_EQ(net::ERR_IO_PENDING, result); | 344 EXPECT_EQ(net::ERR_IO_PENDING, result); |
345 base::RunLoop().RunUntilIdle(); | 345 base::RunLoop().RunUntilIdle(); |
346 | 346 |
347 ASSERT_EQ(1u, logger.results().size()); | 347 ASSERT_EQ(1u, logger.results().size()); |
348 EXPECT_LT(0, logger.results()[0]); | 348 EXPECT_LT(0, logger.results()[0]); |
349 EXPECT_EQ(*fake_file_->metadata->size, logger.results()[0]); | 349 EXPECT_EQ(*fake_file_->metadata->size, logger.results()[0]); |
350 } | 350 } |
351 | 351 |
352 } // namespace file_system_provider | 352 } // namespace file_system_provider |
353 } // namespace chromeos | 353 } // namespace chromeos |
OLD | NEW |