diff options
author | felipeg@chromium.org <felipeg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-16 18:06:12 +0000 |
---|---|---|
committer | felipeg@chromium.org <felipeg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-16 18:06:12 +0000 |
commit | e55bb2e9371f0068d937cfde128339cc0d597b5a (patch) | |
tree | aff1517598b67b8a653ddd82ee62d55c6ea284f4 /net | |
parent | ef0c3ac054dfbcb49ce21e83dff57e751484be66 (diff) | |
download | chromium_src-e55bb2e9371f0068d937cfde128339cc0d597b5a.zip chromium_src-e55bb2e9371f0068d937cfde128339cc0d597b5a.tar.gz chromium_src-e55bb2e9371f0068d937cfde128339cc0d597b5a.tar.bz2 |
Revert 194387 "Refactor our SimpleIndex file format and serializ..."
> Refactor our SimpleIndex file format and serialization to use Pickle instead of the previously buggy way of writing uninitialized structs and ints into the file.
>
> BUG=230772
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=194347
>
> Review URL: https://codereview.chromium.org/14263005
TBR=felipeg@chromium.org
Review URL: https://codereview.chromium.org/14300002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194393 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/simple/simple_util_unittest.cc | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/net/disk_cache/simple/simple_util_unittest.cc b/net/disk_cache/simple/simple_util_unittest.cc deleted file mode 100644 index 4e219fd..0000000 --- a/net/disk_cache/simple/simple_util_unittest.cc +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) 2013 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 "base/logging.h" -#include "base/port.h" -#include "net/disk_cache/simple/simple_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -using disk_cache::simple_util::ConvertEntryHashKeyToHexString; -using disk_cache::simple_util::GetEntryHashKeyAsHexString; -using disk_cache::simple_util::GetEntryHashKeyFromHexString; -using disk_cache::simple_util::GetEntryHashKey; - -class SimpleUtilTest : public testing::Test {}; - -TEST_F(SimpleUtilTest, ConvertEntryHashKeyToHexString) { - EXPECT_EQ("0000000005f5e0ff", - ConvertEntryHashKeyToHexString(GG_UINT64_C(99999999))); - EXPECT_EQ("7fffffffffffffff", - ConvertEntryHashKeyToHexString(GG_UINT64_C(9223372036854775807))); - EXPECT_EQ("8000000000000000", - ConvertEntryHashKeyToHexString(GG_UINT64_C(9223372036854775808))); - EXPECT_EQ("ffffffffffffffff", - ConvertEntryHashKeyToHexString(GG_UINT64_C(18446744073709551615))); -} - -TEST_F(SimpleUtilTest, GetEntryHashKey) { - EXPECT_EQ("7ac408c1dff9c84b", - GetEntryHashKeyAsHexString("http://www.amazon.com/")); - EXPECT_EQ(GG_UINT64_C(0x7ac408c1dff9c84b), GetEntryHashKey("http://www.amazon.com/")); - - EXPECT_EQ("9fe947998c2ccf47", - GetEntryHashKeyAsHexString("www.amazon.com")); - EXPECT_EQ(GG_UINT64_C(0x9fe947998c2ccf47), GetEntryHashKey("www.amazon.com")); - - EXPECT_EQ("0d4b6b5eeea339da", GetEntryHashKeyAsHexString("")); - EXPECT_EQ(GG_UINT64_C(0x0d4b6b5eeea339da), GetEntryHashKey("")); - - EXPECT_EQ("a68ac2ecc87dfd04", GetEntryHashKeyAsHexString("http://www.domain.com/uoQ76Kb2QL5hzaVOSAKWeX0W9LfDLqphmRXpsfHN8tgF5lCsfTxlOVWY8vFwzhsRzoNYKhUIOTc5TnUlT0vpdQflPyk2nh7vurXOj60cDnkG3nsrXMhFCsPjhcZAic2jKpF9F9TYRYQwJo81IMi6gY01RK3ZcNl8WGfqcvoZ702UIdetvR7kiaqo1czwSJCMjRFdG6EgMzgXrwE8DYMz4fWqoa1F1c1qwTCBk3yOcmGTbxsPSJK5QRyNea9IFLrBTjfE7ZlN2vZiI7adcDYJef.htm")); - - EXPECT_EQ(GG_UINT64_C(0xa68ac2ecc87dfd04), GetEntryHashKey("http://www.domain.com/uoQ76Kb2QL5hzaVOSAKWeX0W9LfDLqphmRXpsfHN8tgF5lCsfTxlOVWY8vFwzhsRzoNYKhUIOTc5TnUlT0vpdQflPyk2nh7vurXOj60cDnkG3nsrXMhFCsPjhcZAic2jKpF9F9TYRYQwJo81IMi6gY01RK3ZcNl8WGfqcvoZ702UIdetvR7kiaqo1czwSJCMjRFdG6EgMzgXrwE8DYMz4fWqoa1F1c1qwTCBk3yOcmGTbxsPSJK5QRyNea9IFLrBTjfE7ZlN2vZiI7adcDYJef.htm")); -} - -TEST_F(SimpleUtilTest, GetEntryHashKeyFromHexString) { - uint64 hash_key = 0; - EXPECT_TRUE(GetEntryHashKeyFromHexString("0000000005f5e0ff", &hash_key)); - EXPECT_EQ(GG_UINT64_C(99999999), hash_key); - - EXPECT_TRUE(GetEntryHashKeyFromHexString("7ffffffffffffffF", &hash_key)); - EXPECT_EQ(GG_UINT64_C(9223372036854775807), hash_key); - - EXPECT_TRUE(GetEntryHashKeyFromHexString("8000000000000000", &hash_key)); - EXPECT_EQ(GG_UINT64_C(9223372036854775808), hash_key); - - EXPECT_TRUE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFFF", &hash_key)); - EXPECT_EQ(GG_UINT64_C(18446744073709551615), hash_key); - - // Wrong hash string size. - EXPECT_FALSE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFF", &hash_key)); - - // Wrong hash string size. - EXPECT_FALSE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFFFF", &hash_key)); - - EXPECT_FALSE(GetEntryHashKeyFromHexString("iwr8wglhg8*(&1231((", &hash_key)); -} |