OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
7 | 7 |
8 #include <inttypes.h> | 8 #include <inttypes.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include <google/protobuf/repeated_field.h> | 12 #include <google/protobuf/repeated_field.h> |
| 13 #include <gtest/gtest_prod.h> // for FRIEND_TEST |
13 | 14 |
14 #include "update_engine/file_writer.h" | 15 #include "update_engine/file_writer.h" |
15 #include "update_engine/omaha_hash_calculator.h" | 16 #include "update_engine/omaha_hash_calculator.h" |
16 #include "update_engine/update_metadata.pb.h" | 17 #include "update_engine/update_metadata.pb.h" |
17 | 18 |
18 namespace chromeos_update_engine { | 19 namespace chromeos_update_engine { |
19 | 20 |
20 class PrefsInterface; | 21 class PrefsInterface; |
21 | 22 |
22 // This class performs the actions in a delta update synchronously. The delta | 23 // This class performs the actions in a delta update synchronously. The delta |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // Returns true if a previous update attempt can be continued based on the | 81 // Returns true if a previous update attempt can be continued based on the |
81 // persistent preferences and the new update check response hash. | 82 // persistent preferences and the new update check response hash. |
82 static bool CanResumeUpdate(PrefsInterface* prefs, | 83 static bool CanResumeUpdate(PrefsInterface* prefs, |
83 std::string update_check_response_hash); | 84 std::string update_check_response_hash); |
84 | 85 |
85 // Resets the persistent update progress state to indicate that an update | 86 // Resets the persistent update progress state to indicate that an update |
86 // can't be resumed. Returns true on success, false otherwise. | 87 // can't be resumed. Returns true on success, false otherwise. |
87 static bool ResetUpdateProgress(PrefsInterface* prefs); | 88 static bool ResetUpdateProgress(PrefsInterface* prefs); |
88 | 89 |
89 private: | 90 private: |
| 91 friend class DeltaPerformerTest; |
| 92 FRIEND_TEST(DeltaPerformerTest, IsIdempotentOperationTest); |
| 93 |
| 94 static bool IsIdempotentOperation( |
| 95 const DeltaArchiveManifest_InstallOperation& op); |
| 96 |
90 // Returns true if enough of the delta file has been passed via Write() | 97 // Returns true if enough of the delta file has been passed via Write() |
91 // to be able to perform a given install operation. | 98 // to be able to perform a given install operation. |
92 bool CanPerformInstallOperation( | 99 bool CanPerformInstallOperation( |
93 const DeltaArchiveManifest_InstallOperation& operation); | 100 const DeltaArchiveManifest_InstallOperation& operation); |
94 | 101 |
95 // Returns true on success. | 102 // Returns true on success. |
96 bool PerformInstallOperation( | 103 bool PerformInstallOperation( |
97 const DeltaArchiveManifest_InstallOperation& operation); | 104 const DeltaArchiveManifest_InstallOperation& operation); |
98 | 105 |
99 // These perform a specific type of operation and return true on success. | 106 // These perform a specific type of operation and return true on success. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 168 |
162 // Signatures message blob extracted directly from the payload. | 169 // Signatures message blob extracted directly from the payload. |
163 std::vector<char> signatures_message_data_; | 170 std::vector<char> signatures_message_data_; |
164 | 171 |
165 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); | 172 DISALLOW_COPY_AND_ASSIGN(DeltaPerformer); |
166 }; | 173 }; |
167 | 174 |
168 } // namespace chromeos_update_engine | 175 } // namespace chromeos_update_engine |
169 | 176 |
170 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ | 177 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DELTA_PERFORMER_H__ |
OLD | NEW |