| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/files/file.h" | 8 #include "base/files/file.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 .AppendASCII("data") | 37 .AppendASCII("data") |
| 38 .AppendASCII("update_client") | 38 .AppendASCII("update_client") |
| 39 .AppendASCII(name); | 39 .AppendASCII(name); |
| 40 } | 40 } |
| 41 | 41 |
| 42 base::FilePath InputFilePath(const char* name) { | 42 base::FilePath InputFilePath(const char* name) { |
| 43 base::FilePath path = installed_dir_.GetPath().AppendASCII(name); | 43 base::FilePath path = installed_dir_.GetPath().AppendASCII(name); |
| 44 | 44 |
| 45 base::RunLoop run_loop; | 45 base::RunLoop run_loop; |
| 46 base::PostTaskWithTraitsAndReply( | 46 base::PostTaskWithTraitsAndReply( |
| 47 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 47 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 48 base::TaskPriority::BACKGROUND), | |
| 49 base::Bind(&OutOfProcessPatchTest::CopyFile, TestFile(name), path), | 48 base::Bind(&OutOfProcessPatchTest::CopyFile, TestFile(name), path), |
| 50 run_loop.QuitClosure()); | 49 run_loop.QuitClosure()); |
| 51 | 50 |
| 52 run_loop.Run(); | 51 run_loop.Run(); |
| 53 return path; | 52 return path; |
| 54 } | 53 } |
| 55 | 54 |
| 56 base::FilePath PatchFilePath(const char* name) { | 55 base::FilePath PatchFilePath(const char* name) { |
| 57 base::FilePath path = input_dir_.GetPath().AppendASCII(name); | 56 base::FilePath path = input_dir_.GetPath().AppendASCII(name); |
| 58 | 57 |
| 59 base::RunLoop run_loop; | 58 base::RunLoop run_loop; |
| 60 base::PostTaskWithTraitsAndReply( | 59 base::PostTaskWithTraitsAndReply( |
| 61 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 60 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 62 base::TaskPriority::BACKGROUND), | |
| 63 base::Bind(&OutOfProcessPatchTest::CopyFile, TestFile(name), path), | 61 base::Bind(&OutOfProcessPatchTest::CopyFile, TestFile(name), path), |
| 64 run_loop.QuitClosure()); | 62 run_loop.QuitClosure()); |
| 65 | 63 |
| 66 run_loop.Run(); | 64 run_loop.Run(); |
| 67 return path; | 65 return path; |
| 68 } | 66 } |
| 69 | 67 |
| 70 base::FilePath OutputFilePath(const char* name) { | 68 base::FilePath OutputFilePath(const char* name) { |
| 71 return unpack_dir_.GetPath().AppendASCII(name); | 69 return unpack_dir_.GetPath().AppendASCII(name); |
| 72 } | 70 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 IN_PROC_BROWSER_TEST_F(OutOfProcessPatchTest, InvalidOutputFile) { | 181 IN_PROC_BROWSER_TEST_F(OutOfProcessPatchTest, InvalidOutputFile) { |
| 184 constexpr int kInvalidOutputFile = -1; | 182 constexpr int kInvalidOutputFile = -1; |
| 185 | 183 |
| 186 base::FilePath input_file = InputFilePath("binary_input.bin"); | 184 base::FilePath input_file = InputFilePath("binary_input.bin"); |
| 187 base::FilePath patch_file = PatchFilePath("binary_courgette_patch.bin"); | 185 base::FilePath patch_file = PatchFilePath("binary_courgette_patch.bin"); |
| 188 base::FilePath invalid = InvalidPath("output.bin"); | 186 base::FilePath invalid = InvalidPath("output.bin"); |
| 189 | 187 |
| 190 RunPatchTest(update_client::kCourgette, input_file, patch_file, invalid, | 188 RunPatchTest(update_client::kCourgette, input_file, patch_file, invalid, |
| 191 kInvalidOutputFile); | 189 kInvalidOutputFile); |
| 192 } | 190 } |
| OLD | NEW |