| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "components/update_client/component_patcher.h" | 16 #include "components/update_client/component_patcher.h" |
| 16 #include "components/update_client/component_patcher_operation.h" | 17 #include "components/update_client/component_patcher_operation.h" |
| 17 #include "components/update_client/component_patcher_unittest.h" | 18 #include "components/update_client/component_patcher_unittest.h" |
| 18 #include "components/update_client/test_installer.h" | 19 #include "components/update_client/test_installer.h" |
| 19 #include "courgette/courgette.h" | 20 #include "courgette/courgette.h" |
| 20 #include "courgette/third_party/bsdiff/bsdiff.h" | 21 #include "courgette/third_party/bsdiff/bsdiff.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 .AppendASCII(file); | 63 .AppendASCII(file); |
| 63 } | 64 } |
| 64 | 65 |
| 65 } // namespace | 66 } // namespace |
| 66 | 67 |
| 67 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { | 68 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { |
| 68 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); | 69 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); |
| 69 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); | 70 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); |
| 70 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); | 71 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); |
| 71 installer_ = new ReadOnlyTestInstaller(installed_dir_.GetPath()); | 72 installer_ = new ReadOnlyTestInstaller(installed_dir_.GetPath()); |
| 72 task_runner_ = base::MessageLoop::current()->task_runner(); | 73 task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
| 73 } | 74 } |
| 74 | 75 |
| 75 ComponentPatcherOperationTest::~ComponentPatcherOperationTest() { | 76 ComponentPatcherOperationTest::~ComponentPatcherOperationTest() { |
| 76 } | 77 } |
| 77 | 78 |
| 78 // Verify that a 'create' delta update operation works correctly. | 79 // Verify that a 'create' delta update operation works correctly. |
| 79 TEST_F(ComponentPatcherOperationTest, CheckCreateOperation) { | 80 TEST_F(ComponentPatcherOperationTest, CheckCreateOperation) { |
| 80 EXPECT_TRUE(base::CopyFile( | 81 EXPECT_TRUE(base::CopyFile( |
| 81 test_file("binary_output.bin"), | 82 test_file("binary_output.bin"), |
| 82 input_dir_.GetPath().Append(FILE_PATH_LITERAL("binary_output.bin")))); | 83 input_dir_.GetPath().Append(FILE_PATH_LITERAL("binary_output.bin")))); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 195 |
| 195 EXPECT_EQ(true, callback.called_); | 196 EXPECT_EQ(true, callback.called_); |
| 196 EXPECT_EQ(ComponentUnpacker::kNone, callback.error_); | 197 EXPECT_EQ(ComponentUnpacker::kNone, callback.error_); |
| 197 EXPECT_EQ(0, callback.extra_code_); | 198 EXPECT_EQ(0, callback.extra_code_); |
| 198 EXPECT_TRUE(base::ContentsEqual( | 199 EXPECT_TRUE(base::ContentsEqual( |
| 199 unpack_dir_.GetPath().Append(FILE_PATH_LITERAL("output.bin")), | 200 unpack_dir_.GetPath().Append(FILE_PATH_LITERAL("output.bin")), |
| 200 test_file("binary_output.bin"))); | 201 test_file("binary_output.bin"))); |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace update_client | 204 } // namespace update_client |
| OLD | NEW |