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

Side by Side Diff: net/disk_cache/simple/simple_util_unittest.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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 | « net/disk_cache/simple/simple_util.cc ('k') | net/disk_cache/simple/simple_version_upgrade.h » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/disk_cache/simple/simple_util.h" 8 #include "net/disk_cache/simple/simple_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 29 matching lines...) Expand all
40 40
41 EXPECT_EQ("0d4b6b5eeea339da", GetEntryHashKeyAsHexString("")); 41 EXPECT_EQ("0d4b6b5eeea339da", GetEntryHashKeyAsHexString(""));
42 EXPECT_EQ(UINT64_C(0x0d4b6b5eeea339da), GetEntryHashKey("")); 42 EXPECT_EQ(UINT64_C(0x0d4b6b5eeea339da), GetEntryHashKey(""));
43 43
44 EXPECT_EQ("a68ac2ecc87dfd04", GetEntryHashKeyAsHexString("http://www.domain.co m/uoQ76Kb2QL5hzaVOSAKWeX0W9LfDLqphmRXpsfHN8tgF5lCsfTxlOVWY8vFwzhsRzoNYKhUIOTc5Tn UlT0vpdQflPyk2nh7vurXOj60cDnkG3nsrXMhFCsPjhcZAic2jKpF9F9TYRYQwJo81IMi6gY01RK3ZcN l8WGfqcvoZ702UIdetvR7kiaqo1czwSJCMjRFdG6EgMzgXrwE8DYMz4fWqoa1F1c1qwTCBk3yOcmGTbx sPSJK5QRyNea9IFLrBTjfE7ZlN2vZiI7adcDYJef.htm")); 44 EXPECT_EQ("a68ac2ecc87dfd04", GetEntryHashKeyAsHexString("http://www.domain.co m/uoQ76Kb2QL5hzaVOSAKWeX0W9LfDLqphmRXpsfHN8tgF5lCsfTxlOVWY8vFwzhsRzoNYKhUIOTc5Tn UlT0vpdQflPyk2nh7vurXOj60cDnkG3nsrXMhFCsPjhcZAic2jKpF9F9TYRYQwJo81IMi6gY01RK3ZcN l8WGfqcvoZ702UIdetvR7kiaqo1czwSJCMjRFdG6EgMzgXrwE8DYMz4fWqoa1F1c1qwTCBk3yOcmGTbx sPSJK5QRyNea9IFLrBTjfE7ZlN2vZiI7adcDYJef.htm"));
45 45
46 EXPECT_EQ(UINT64_C(0xa68ac2ecc87dfd04), GetEntryHashKey("http://www.domain.com /uoQ76Kb2QL5hzaVOSAKWeX0W9LfDLqphmRXpsfHN8tgF5lCsfTxlOVWY8vFwzhsRzoNYKhUIOTc5TnU lT0vpdQflPyk2nh7vurXOj60cDnkG3nsrXMhFCsPjhcZAic2jKpF9F9TYRYQwJo81IMi6gY01RK3ZcNl 8WGfqcvoZ702UIdetvR7kiaqo1czwSJCMjRFdG6EgMzgXrwE8DYMz4fWqoa1F1c1qwTCBk3yOcmGTbxs PSJK5QRyNea9IFLrBTjfE7ZlN2vZiI7adcDYJef.htm")); 46 EXPECT_EQ(UINT64_C(0xa68ac2ecc87dfd04), GetEntryHashKey("http://www.domain.com /uoQ76Kb2QL5hzaVOSAKWeX0W9LfDLqphmRXpsfHN8tgF5lCsfTxlOVWY8vFwzhsRzoNYKhUIOTc5TnU lT0vpdQflPyk2nh7vurXOj60cDnkG3nsrXMhFCsPjhcZAic2jKpF9F9TYRYQwJo81IMi6gY01RK3ZcNl 8WGfqcvoZ702UIdetvR7kiaqo1czwSJCMjRFdG6EgMzgXrwE8DYMz4fWqoa1F1c1qwTCBk3yOcmGTbxs PSJK5QRyNea9IFLrBTjfE7ZlN2vZiI7adcDYJef.htm"));
47 } 47 }
48 48
49 TEST_F(SimpleUtilTest, GetEntryHashKeyFromHexString) { 49 TEST_F(SimpleUtilTest, GetEntryHashKeyFromHexString) {
50 uint64 hash_key = 0; 50 uint64_t hash_key = 0;
51 EXPECT_TRUE(GetEntryHashKeyFromHexString("0000000005f5e0ff", &hash_key)); 51 EXPECT_TRUE(GetEntryHashKeyFromHexString("0000000005f5e0ff", &hash_key));
52 EXPECT_EQ(UINT64_C(99999999), hash_key); 52 EXPECT_EQ(UINT64_C(99999999), hash_key);
53 53
54 EXPECT_TRUE(GetEntryHashKeyFromHexString("7ffffffffffffffF", &hash_key)); 54 EXPECT_TRUE(GetEntryHashKeyFromHexString("7ffffffffffffffF", &hash_key));
55 EXPECT_EQ(UINT64_C(9223372036854775807), hash_key); 55 EXPECT_EQ(UINT64_C(9223372036854775807), hash_key);
56 56
57 EXPECT_TRUE(GetEntryHashKeyFromHexString("8000000000000000", &hash_key)); 57 EXPECT_TRUE(GetEntryHashKeyFromHexString("8000000000000000", &hash_key));
58 EXPECT_EQ(UINT64_C(9223372036854775808), hash_key); 58 EXPECT_EQ(UINT64_C(9223372036854775808), hash_key);
59 59
60 EXPECT_TRUE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFFF", &hash_key)); 60 EXPECT_TRUE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFFF", &hash_key));
61 EXPECT_EQ(UINT64_C(18446744073709551615), hash_key); 61 EXPECT_EQ(UINT64_C(18446744073709551615), hash_key);
62 62
63 // Wrong hash string size. 63 // Wrong hash string size.
64 EXPECT_FALSE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFF", &hash_key)); 64 EXPECT_FALSE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFF", &hash_key));
65 65
66 // Wrong hash string size. 66 // Wrong hash string size.
67 EXPECT_FALSE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFFFF", &hash_key)); 67 EXPECT_FALSE(GetEntryHashKeyFromHexString("FFFFFFFFFFFFFFFFF", &hash_key));
68 68
69 EXPECT_FALSE(GetEntryHashKeyFromHexString("iwr8wglhg8*(&1231((", &hash_key)); 69 EXPECT_FALSE(GetEntryHashKeyFromHexString("iwr8wglhg8*(&1231((", &hash_key));
70 } 70 }
71 71
72 TEST_F(SimpleUtilTest, SizesAndOffsets) { 72 TEST_F(SimpleUtilTest, SizesAndOffsets) {
73 const char key[] = "This is an example key"; 73 const char key[] = "This is an example key";
74 const int data_size = 1000; 74 const int data_size = 1000;
75 const int file_size = GetFileSizeFromKeyAndDataSize(key, data_size); 75 const int file_size = GetFileSizeFromKeyAndDataSize(key, data_size);
76 EXPECT_EQ(data_size, GetDataSizeFromKeyAndFileSize(key, file_size)); 76 EXPECT_EQ(data_size, GetDataSizeFromKeyAndFileSize(key, file_size));
77 } 77 }
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_util.cc ('k') | net/disk_cache/simple/simple_version_upgrade.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698