From bf0ece42c1ea7b3c3d572106dab09e92b0800cff Mon Sep 17 00:00:00 2001 From: "dgarrett@chromium.org" Date: Tue, 18 Oct 2011 01:08:35 +0000 Subject: 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. Also refactors a number of unit tests to allow code sharing for reading files into memory. This is done via a new base class. Uses test binaries submitted seperatly because of build tools problems. BUG=None TEST=New Unittest Review URL: http://codereview.chromium.org/8252011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105982 0039d316-1c4b-4281-b951-d872f2087c98 --- courgette/encode_decode_unittest.cc | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'courgette/encode_decode_unittest.cc') diff --git a/courgette/encode_decode_unittest.cc b/courgette/encode_decode_unittest.cc index c14dc9f..4155c56 100644 --- a/courgette/encode_decode_unittest.cc +++ b/courgette/encode_decode_unittest.cc @@ -2,47 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include - -#include "base/path_service.h" -#include "base/file_util.h" -#include "base/string_util.h" - +#include "courgette/base_test_unittest.h" #include "courgette/courgette.h" #include "courgette/streams.h" -#include "testing/gtest/include/gtest/gtest.h" - -class EncodeDecodeTest : public testing::Test { +class EncodeDecodeTest : public BaseTest { public: void TestExe(const char *) 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 EncodeDecodeTest::FileContents(const char* file_name) const { - FilePath file_path = testdata_dir_; - file_path = file_path.AppendASCII(file_name); - std::string file_contents; - if (!file_util::ReadFileToString(file_path, &file_contents)) { - EXPECT_TRUE(!"Could not read test data"); - } - return file_contents; -} - void EncodeDecodeTest::TestExe(const char* file_name) const { // Test top-level Courgette API for converting an a file to a binary // assembly representation and back. -- cgit v1.1