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 <stdint.h> | 5 #include <stdint.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 const int64_t kTestFileSize = 1 << 15; // 32 kB | 28 const int64_t kTestFileSize = 1 << 15; // 32 kB |
29 const int kTestPattern = 0x55555555; | 29 const int kTestPattern = 0x55555555; |
30 | 30 |
31 class ImageWriterUtilityTest : public testing::Test { | 31 class ImageWriterUtilityTest : public testing::Test { |
32 protected: | 32 protected: |
33 void SetUp() override { | 33 void SetUp() override { |
34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
35 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir_.path(), &image_path_)); | |
36 ASSERT_TRUE( | 35 ASSERT_TRUE( |
37 base::CreateTemporaryFileInDir(temp_dir_.path(), &device_path_)); | 36 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &image_path_)); |
| 37 ASSERT_TRUE( |
| 38 base::CreateTemporaryFileInDir(temp_dir_.GetPath(), &device_path_)); |
38 } | 39 } |
39 | 40 |
40 void TearDown() override {} | 41 void TearDown() override {} |
41 | 42 |
42 void FillFile(const base::FilePath& path, int pattern) { | 43 void FillFile(const base::FilePath& path, int pattern) { |
43 std::unique_ptr<char[]> buffer(new char[kTestFileSize]); | 44 std::unique_ptr<char[]> buffer(new char[kTestFileSize]); |
44 memset(buffer.get(), pattern, kTestFileSize); | 45 memset(buffer.get(), pattern, kTestFileSize); |
45 | 46 |
46 ASSERT_TRUE(base::WriteFile(path, buffer.get(), kTestFileSize)); | 47 ASSERT_TRUE(base::WriteFile(path, buffer.get(), kTestFileSize)); |
47 } | 48 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0); | 225 EXPECT_CALL(mock_handler, SendFailed(_)).Times(0); |
225 | 226 |
226 FillDefault(image_path_); | 227 FillDefault(image_path_); |
227 | 228 |
228 image_writer.Write(); | 229 image_writer.Write(); |
229 | 230 |
230 base::RunLoop().RunUntilIdle(); | 231 base::RunLoop().RunUntilIdle(); |
231 } | 232 } |
232 | 233 |
233 } // namespace image_writer | 234 } // namespace image_writer |
OLD | NEW |