Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: delta_performer_unittest.cc

Issue 3592008: AU: Verify delta payload signature and signed hash. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: move /tmp files to /var/run Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « delta_performer.cc ('k') | download_action.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 #include "update_engine/update_metadata.pb.h" 22 #include "update_engine/update_metadata.pb.h"
23 #include "update_engine/utils.h" 23 #include "update_engine/utils.h"
24 24
25 namespace chromeos_update_engine { 25 namespace chromeos_update_engine {
26 26
27 using std::min; 27 using std::min;
28 using std::string; 28 using std::string;
29 using std::vector; 29 using std::vector;
30 30
31 extern const char* kUnittestPrivateKeyPath; 31 extern const char* kUnittestPrivateKeyPath;
32 extern const char* kUnittestPublicKeyPath;
32 33
33 class DeltaPerformerTest : public ::testing::Test { }; 34 class DeltaPerformerTest : public ::testing::Test { };
34 35
35 TEST(DeltaPerformerTest, ExtentsToByteStringTest) { 36 TEST(DeltaPerformerTest, ExtentsToByteStringTest) {
36 uint64_t test[] = {1, 1, 4, 2, kSparseHole, 1, 0, 1}; 37 uint64_t test[] = {1, 1, 4, 2, kSparseHole, 1, 0, 1};
37 COMPILE_ASSERT(arraysize(test) % 2 == 0, array_size_uneven); 38 COMPILE_ASSERT(arraysize(test) % 2 == 0, array_size_uneven);
38 const uint64_t block_size = 4096; 39 const uint64_t block_size = 4096;
39 const uint64_t file_length = 5 * block_size - 13; 40 const uint64_t file_length = 5 * block_size - 13;
40 41
41 google::protobuf::RepeatedPtrField<Extent> extents; 42 google::protobuf::RepeatedPtrField<Extent> extents;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 249
249 // Wrapper around close. Returns 0 on success or -errno on error. 250 // Wrapper around close. Returns 0 on success or -errno on error.
250 EXPECT_EQ(0, performer.Close()); 251 EXPECT_EQ(0, performer.Close());
251 252
252 CompareFilesByBlock(old_kernel, new_kernel); 253 CompareFilesByBlock(old_kernel, new_kernel);
253 254
254 vector<char> updated_kernel_partition; 255 vector<char> updated_kernel_partition;
255 EXPECT_TRUE(utils::ReadFile(old_kernel, &updated_kernel_partition)); 256 EXPECT_TRUE(utils::ReadFile(old_kernel, &updated_kernel_partition));
256 EXPECT_EQ(0, strncmp(&updated_kernel_partition[0], new_data_string, 257 EXPECT_EQ(0, strncmp(&updated_kernel_partition[0], new_data_string,
257 strlen(new_data_string))); 258 strlen(new_data_string)));
259
260 EXPECT_TRUE(utils::FileExists(kUnittestPublicKeyPath));
261 EXPECT_TRUE(performer.VerifyPayload(kUnittestPublicKeyPath));
258 } 262 }
259 263
260 } // namespace chromeos_update_engine 264 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « delta_performer.cc ('k') | download_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698