| 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/component_updater/component_patcher.h" | 11 #include "chrome/browser/component_updater/component_patcher.h" |
| 12 #include "chrome/browser/component_updater/component_patcher_operation.h" | 12 #include "chrome/browser/component_updater/component_patcher_operation.h" |
| 13 #include "chrome/browser/component_updater/component_updater_service.h" | 13 #include "chrome/browser/component_updater/component_updater_service.h" |
| 14 #include "chrome/browser/component_updater/test/component_patcher_mock.h" | 14 #include "chrome/browser/component_updater/test/component_patcher_mock.h" |
| 15 #include "chrome/browser/component_updater/test/component_patcher_unittest.h" | 15 #include "chrome/browser/component_updater/test/component_patcher_unittest.h" |
| 16 #include "chrome/browser/component_updater/test/test_installer.h" | 16 #include "chrome/browser/component_updater/test/test_installer.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "courgette/courgette.h" | 18 #include "courgette/courgette.h" |
| 19 #include "courgette/third_party/bsdiff.h" | 19 #include "courgette/third_party/bsdiff.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 namespace component_updater { |
| 23 |
| 22 base::FilePath test_file(const char* file) { | 24 base::FilePath test_file(const char* file) { |
| 23 base::FilePath path; | 25 base::FilePath path; |
| 24 PathService::Get(chrome::DIR_TEST_DATA, &path); | 26 PathService::Get(chrome::DIR_TEST_DATA, &path); |
| 25 return path.AppendASCII("components").AppendASCII(file); | 27 return path.AppendASCII("components").AppendASCII(file); |
| 26 } | 28 } |
| 27 | 29 |
| 28 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { | 30 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { |
| 29 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); | 31 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); |
| 30 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); | 32 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); |
| 31 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); | 33 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 unpack_dir_.path(), | 174 unpack_dir_.path(), |
| 173 patcher_.get(), | 175 patcher_.get(), |
| 174 installer_.get(), | 176 installer_.get(), |
| 175 &error); | 177 &error); |
| 176 EXPECT_EQ(ComponentUnpacker::kNone, result); | 178 EXPECT_EQ(ComponentUnpacker::kNone, result); |
| 177 EXPECT_EQ(0, error); | 179 EXPECT_EQ(0, error); |
| 178 EXPECT_TRUE(base::ContentsEqual( | 180 EXPECT_TRUE(base::ContentsEqual( |
| 179 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), | 181 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), |
| 180 test_file("binary_output.bin"))); | 182 test_file("binary_output.bin"))); |
| 181 } | 183 } |
| 184 |
| 185 } // namespace component_updater |
| OLD | NEW |