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

Unified Diff: src/platform/update_engine/gzip_unittest.cc

Issue 855002: AU: Bzip2 utility functions that mirror Gzip utility functions. (Closed)
Patch Set: revert utils.* Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: src/platform/update_engine/gzip_unittest.cc
diff --git a/src/platform/update_engine/gzip_unittest.cc b/src/platform/update_engine/gzip_unittest.cc
deleted file mode 100644
index 298ca9d4f360522082ffdd08c51c2f90fc5805d9..0000000000000000000000000000000000000000
--- a/src/platform/update_engine/gzip_unittest.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (c) 2009 The Chromium OS 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.h>
-#include <unistd.h>
-#include <string>
-#include <vector>
-#include <gtest/gtest.h>
-#include "update_engine/gzip.h"
-#include "update_engine/test_utils.h"
-#include "update_engine/utils.h"
-
-using std::string;
-using std::vector;
-
-namespace chromeos_update_engine {
-
-class GzipTest : public ::testing::Test { };
-
-TEST(GzipTest, SimpleTest) {
- string in("this should compress well xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
- vector<char> out;
- EXPECT_TRUE(GzipCompressString(in, &out));
- EXPECT_LT(out.size(), in.size());
- EXPECT_GT(out.size(), 0);
- vector<char> decompressed;
- EXPECT_TRUE(GzipDecompress(out, &decompressed));
- EXPECT_EQ(in.size(), decompressed.size());
- EXPECT_TRUE(!memcmp(in.data(), &decompressed[0], in.size()));
-}
-
-TEST(GzipTest, PoorCompressionTest) {
- string in(reinterpret_cast<const char*>(kRandomString),
- sizeof(kRandomString));
- vector<char> out;
- EXPECT_TRUE(GzipCompressString(in, &out));
- EXPECT_GT(out.size(), in.size());
- string out_string(&out[0], out.size());
- vector<char> decompressed;
- EXPECT_TRUE(GzipDecompressString(out_string, &decompressed));
- EXPECT_EQ(in.size(), decompressed.size());
- EXPECT_TRUE(!memcmp(in.data(), &decompressed[0], in.size()));
-}
-
-TEST(GzipTest, MalformedGzipTest) {
- string in(reinterpret_cast<const char*>(kRandomString),
- sizeof(kRandomString));
- vector<char> out;
- EXPECT_FALSE(GzipDecompressString(in, &out));
-}
-
-TEST(GzipTest, EmptyInputsTest) {
- string in;
- vector<char> out;
- EXPECT_TRUE(GzipDecompressString(in, &out));
- EXPECT_EQ(0, out.size());
-
- EXPECT_TRUE(GzipCompressString(in, &out));
- EXPECT_EQ(0, out.size());
-}
-
-} // namespace chromeos_update_engine

Powered by Google App Engine
This is Rietveld 408576698