| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include <sys/mount.h> | 5 #include <sys/mount.h> |
| 6 #include <inttypes.h> | 6 #include <inttypes.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 ASSERT_TRUE(PayloadSigner::HashPayloadForSigning(delta_path, | 231 ASSERT_TRUE(PayloadSigner::HashPayloadForSigning(delta_path, |
| 232 signature_size, | 232 signature_size, |
| 233 &hash)); | 233 &hash)); |
| 234 vector<char> signature; | 234 vector<char> signature; |
| 235 ASSERT_TRUE(PayloadSigner::SignHash(hash, | 235 ASSERT_TRUE(PayloadSigner::SignHash(hash, |
| 236 kUnittestPrivateKeyPath, | 236 kUnittestPrivateKeyPath, |
| 237 &signature)); | 237 &signature)); |
| 238 ASSERT_TRUE(PayloadSigner::AddSignatureToPayload(delta_path, | 238 ASSERT_TRUE(PayloadSigner::AddSignatureToPayload(delta_path, |
| 239 signature, | 239 signature, |
| 240 delta_path)); | 240 delta_path)); |
| 241 EXPECT_TRUE(PayloadSigner::VerifySignedPayload(delta_path, |
| 242 kUnittestPublicKeyPath)); |
| 241 } | 243 } |
| 242 | 244 |
| 243 // Read delta into memory. | 245 // Read delta into memory. |
| 244 vector<char> delta; | 246 vector<char> delta; |
| 245 EXPECT_TRUE(utils::ReadFile(delta_path, &delta)); | 247 EXPECT_TRUE(utils::ReadFile(delta_path, &delta)); |
| 246 | 248 |
| 247 uint64_t manifest_metadata_size; | 249 uint64_t manifest_metadata_size; |
| 248 | 250 |
| 249 // Check the metadata. | 251 // Check the metadata. |
| 250 { | 252 { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 op.clear_src_extents(); | 422 op.clear_src_extents(); |
| 421 *(op.add_src_extents()) = ExtentForRange(5, 3); | 423 *(op.add_src_extents()) = ExtentForRange(5, 3); |
| 422 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); | 424 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
| 423 *(op.add_dst_extents()) = ExtentForRange(20, 6); | 425 *(op.add_dst_extents()) = ExtentForRange(20, 6); |
| 424 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); | 426 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
| 425 *(op.add_src_extents()) = ExtentForRange(19, 2); | 427 *(op.add_src_extents()) = ExtentForRange(19, 2); |
| 426 EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op)); | 428 EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op)); |
| 427 } | 429 } |
| 428 | 430 |
| 429 } // namespace chromeos_update_engine | 431 } // namespace chromeos_update_engine |
| OLD | NEW |