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 |
| 24 namespace { |
| 25 |
22 base::FilePath test_file(const char* file) { | 26 base::FilePath test_file(const char* file) { |
23 base::FilePath path; | 27 base::FilePath path; |
24 PathService::Get(chrome::DIR_TEST_DATA, &path); | 28 PathService::Get(chrome::DIR_TEST_DATA, &path); |
25 return path.AppendASCII("components").AppendASCII(file); | 29 return path.AppendASCII("components").AppendASCII(file); |
26 } | 30 } |
27 | 31 |
| 32 } // namespace |
| 33 |
28 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { | 34 ComponentPatcherOperationTest::ComponentPatcherOperationTest() { |
29 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); | 35 EXPECT_TRUE(unpack_dir_.CreateUniqueTempDir()); |
30 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); | 36 EXPECT_TRUE(input_dir_.CreateUniqueTempDir()); |
31 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); | 37 EXPECT_TRUE(installed_dir_.CreateUniqueTempDir()); |
32 patcher_.reset(new MockComponentPatcher()); | 38 patcher_.reset(new MockComponentPatcher()); |
33 installer_.reset(new ReadOnlyTestInstaller(installed_dir_.path())); | 39 installer_.reset(new ReadOnlyTestInstaller(installed_dir_.path())); |
34 } | 40 } |
35 | 41 |
36 ComponentPatcherOperationTest::~ComponentPatcherOperationTest() { | 42 ComponentPatcherOperationTest::~ComponentPatcherOperationTest() { |
37 } | 43 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 unpack_dir_.path(), | 178 unpack_dir_.path(), |
173 patcher_.get(), | 179 patcher_.get(), |
174 installer_.get(), | 180 installer_.get(), |
175 &error); | 181 &error); |
176 EXPECT_EQ(ComponentUnpacker::kNone, result); | 182 EXPECT_EQ(ComponentUnpacker::kNone, result); |
177 EXPECT_EQ(0, error); | 183 EXPECT_EQ(0, error); |
178 EXPECT_TRUE(base::ContentsEqual( | 184 EXPECT_TRUE(base::ContentsEqual( |
179 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), | 185 unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), |
180 test_file("binary_output.bin"))); | 186 test_file("binary_output.bin"))); |
181 } | 187 } |
| 188 |
| 189 } // namespace component_updater |
| 190 |
OLD | NEW |