summaryrefslogtreecommitdiffstats
path: root/courgette
diff options
context:
space:
mode:
authorrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-17 01:21:44 +0000
committerrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-17 01:21:44 +0000
commit8019b5b3ed124863f1bde454e675fe740c327c37 (patch)
treebfe693f0fdfefb5aa78a3d82c884e954f17cdcd5 /courgette
parentd5425ad01f484d44d111ef05f6f6d9900c8c4b08 (diff)
downloadchromium_src-8019b5b3ed124863f1bde454e675fe740c327c37.zip
chromium_src-8019b5b3ed124863f1bde454e675fe740c327c37.tar.gz
chromium_src-8019b5b3ed124863f1bde454e675fe740c327c37.tar.bz2
Revert 101606 - Add a basic backwards compatibility unittest.
This verifies we can still apply old patches, but does not verify that old clients can apply new patches. That seems important, but I'm not sure how to do it without storing old client binaries in version control. BUG=None TEST=New Unittest Review URL: http://codereview.chromium.org/7915007 TBR=dgarrett@chromium.org Review URL: http://codereview.chromium.org/7930003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette')
-rw-r--r--courgette/courgette.gyp3
-rw-r--r--courgette/testdata/setup1-setup2.v1.patch0
-rw-r--r--courgette/versioning_unittest.cc83
3 files changed, 1 insertions, 85 deletions
diff --git a/courgette/courgette.gyp b/courgette/courgette.gyp
index 5a183e8..e9fa170 100644
--- a/courgette/courgette.gyp
+++ b/courgette/courgette.gyp
@@ -1,4 +1,4 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
@@ -92,7 +92,6 @@
'image_info_unittest.cc',
'run_all_unittests.cc',
'streams_unittest.cc',
- 'versioning_unittest.cc',
'third_party/paged_array_unittest.cc'
],
'dependencies': [
diff --git a/courgette/testdata/setup1-setup2.v1.patch b/courgette/testdata/setup1-setup2.v1.patch
deleted file mode 100644
index e69de29..0000000
--- a/courgette/testdata/setup1-setup2.v1.patch
+++ /dev/null
diff --git a/courgette/versioning_unittest.cc b/courgette/versioning_unittest.cc
deleted file mode 100644
index 34a6ca1..0000000
--- a/courgette/versioning_unittest.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <string>
-
-#include "base/path_service.h"
-#include "base/file_util.h"
-#include "base/string_util.h"
-
-#include "courgette/courgette.h"
-#include "courgette/streams.h"
-
-#include "testing/gtest/include/gtest/gtest.h"
-
-class VersioningTest : public testing::Test {
- public:
- void TestApplyingOldPatch(const char* src_file,
- const char* patch_file,
- const char* expected_file) const;
-
- private:
- void SetUp() {
- PathService::Get(base::DIR_SOURCE_ROOT, &testdata_dir_);
- testdata_dir_ = testdata_dir_.AppendASCII("courgette");
- testdata_dir_ = testdata_dir_.AppendASCII("testdata");
- }
-
- void TearDown() { }
-
- // Returns contents of |file_name| as uninterprested bytes stored in a string.
- std::string FileContents(const char* file_name) const;
-
- FilePath testdata_dir_; // Full path name of testdata directory
-};
-
-// Reads a test file into a string.
-std::string VersioningTest::FileContents(const char* file_name) const {
- FilePath file_path = testdata_dir_;
- file_path = file_path.AppendASCII(file_name);
- std::string file_contents;
- EXPECT_TRUE(file_util::ReadFileToString(file_path, &file_contents));
- return file_contents;
-}
-
-void VersioningTest::TestApplyingOldPatch(const char* src_file,
- const char* patch_file,
- const char* expected_file) const {
-
- std::string old_buffer = FileContents(src_file);
- std::string new_buffer = FileContents(patch_file);
- std::string expected_buffer = FileContents(expected_file);
-
- courgette::SourceStream old_stream;
- courgette::SourceStream patch_stream;
- old_stream.Init(old_buffer);
- patch_stream.Init(new_buffer);
-
- courgette::SinkStream generated_stream;
-
- courgette::Status status =
- courgette::ApplyEnsemblePatch(&old_stream,
- &patch_stream,
- &generated_stream);
-
- EXPECT_EQ(status, courgette::C_OK);
-
- size_t expected_length = expected_buffer.size();
- size_t generated_length = generated_stream.Length();
-
- EXPECT_EQ(generated_length, expected_length);
- EXPECT_EQ(0, memcmp(generated_stream.Buffer(),
- expected_buffer.c_str(),
- expected_length));
-}
-
-
-TEST_F(VersioningTest, All) {
- TestApplyingOldPatch("setup1.exe", "setup1-setup2.v1.patch", "setup2.exe");
-
- // We also need a way to test that newly generated patches are appropriately
- // applicable by older clients... not sure of the best way to do that.
-}