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

Side by Side Diff: courgette/versioning_unittest.cc

Issue 2031193002: [Courgette] Refactor BSDiff namespaces and bsdiff::search() interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync. Created 4 years, 4 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
« no previous file with comments | « courgette/third_party/bsdiff/qsufsort_unittest.cc ('k') | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "courgette/base_test_unittest.h" 5 #include "courgette/base_test_unittest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 16 matching lines...) Expand all
27 std::string new_buffer = FileContents(patch_file); 27 std::string new_buffer = FileContents(patch_file);
28 std::string expected_buffer = FileContents(expected_file); 28 std::string expected_buffer = FileContents(expected_file);
29 29
30 courgette::SourceStream old_stream; 30 courgette::SourceStream old_stream;
31 courgette::SourceStream patch_stream; 31 courgette::SourceStream patch_stream;
32 old_stream.Init(old_buffer); 32 old_stream.Init(old_buffer);
33 patch_stream.Init(new_buffer); 33 patch_stream.Init(new_buffer);
34 34
35 courgette::SinkStream generated_stream; 35 courgette::SinkStream generated_stream;
36 36
37 courgette::BSDiffStatus status = courgette::ApplyBinaryPatch( 37 bsdiff::BSDiffStatus status = bsdiff::ApplyBinaryPatch(
38 &old_stream, &patch_stream, &generated_stream); 38 &old_stream, &patch_stream, &generated_stream);
39 39
40 EXPECT_EQ(status, courgette::OK); 40 EXPECT_EQ(status, bsdiff::OK);
41 41
42 size_t expected_length = expected_buffer.size(); 42 size_t expected_length = expected_buffer.size();
43 size_t generated_length = generated_stream.Length(); 43 size_t generated_length = generated_stream.Length();
44 44
45 EXPECT_EQ(generated_length, expected_length); 45 EXPECT_EQ(generated_length, expected_length);
46 EXPECT_EQ(0, memcmp(generated_stream.Buffer(), 46 EXPECT_EQ(0, memcmp(generated_stream.Buffer(),
47 expected_buffer.c_str(), 47 expected_buffer.c_str(),
48 expected_length)); 48 expected_length));
49 } 49 }
50 50
51 TEST_F(VersioningTest, BsDiff) { 51 TEST_F(VersioningTest, BsDiff) {
52 TestApplyingOldBsDiffPatch("setup1.exe", "setup1-setup2.v1.bsdiff", 52 TestApplyingOldBsDiffPatch("setup1.exe", "setup1-setup2.v1.bsdiff",
53 "setup2.exe"); 53 "setup2.exe");
54 TestApplyingOldBsDiffPatch("chrome64_1.exe", "chrome64-1-2.v1.bsdiff", 54 TestApplyingOldBsDiffPatch("chrome64_1.exe", "chrome64-1-2.v1.bsdiff",
55 "chrome64_2.exe"); 55 "chrome64_2.exe");
56 56
57 // We also need a way to test that newly generated patches are appropriately 57 // We also need a way to test that newly generated patches are appropriately
58 // applicable by older clients... not sure of the best way to do that. 58 // applicable by older clients... not sure of the best way to do that.
59 } 59 }
OLDNEW
« no previous file with comments | « courgette/third_party/bsdiff/qsufsort_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698