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

Unified Diff: net/disk_cache/simple/simple_index_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 side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/simple/simple_index_unittest.cc
diff --git a/net/disk_cache/simple/simple_index_unittest.cc b/net/disk_cache/simple/simple_index_unittest.cc
index 281d402b7f010a5caf46781050a8d4a134dd8890..ee0ddbe7e2fff7fccba13d9666db7fb6f2215bbc 100644
--- a/net/disk_cache/simple/simple_index_unittest.cc
+++ b/net/disk_cache/simple/simple_index_unittest.cc
@@ -28,7 +28,7 @@ namespace {
const base::Time kTestLastUsedTime =
base::Time::UnixEpoch() + base::TimeDelta::FromDays(20);
-const uint64 kTestEntrySize = 789;
+const uint64_t kTestEntrySize = 789;
} // namespace
@@ -66,7 +66,7 @@ class MockSimpleIndexFile : public SimpleIndexFile,
}
void WriteToDisk(const SimpleIndex::EntrySet& entry_set,
- uint64 cache_size,
+ uint64_t cache_size,
const base::TimeTicks& start,
bool app_on_background,
const base::Closure& callback) override {
@@ -97,7 +97,7 @@ class SimpleIndexTest : public testing::Test, public SimpleIndexDelegate {
: hashes_(base::Bind(&HashesInitializer)),
doom_entries_calls_(0) {}
- static uint64 HashesInitializer(size_t hash_index) {
+ static uint64_t HashesInitializer(size_t hash_index) {
return disk_cache::simple_util::GetEntryHashKey(
base::StringPrintf("key%d", static_cast<int>(hash_index)));
}
@@ -120,16 +120,16 @@ class SimpleIndexTest : public testing::Test, public SimpleIndexDelegate {
}
// From SimpleIndexDelegate:
- void DoomEntries(std::vector<uint64>* entry_hashes,
+ void DoomEntries(std::vector<uint64_t>* entry_hashes,
const net::CompletionCallback& callback) override {
- for (const uint64& entry_hash : *entry_hashes)
+ for (const uint64_t& entry_hash : *entry_hashes)
index_->Remove(entry_hash);
last_doom_entry_hashes_ = *entry_hashes;
++doom_entries_calls_;
}
// Redirect to allow single "friend" declaration in base class.
- bool GetEntryForTesting(uint64 key, EntryMetadata* metadata) {
+ bool GetEntryForTesting(uint64_t key, EntryMetadata* metadata) {
SimpleIndex::EntrySet::iterator it = index_->entries_set_.find(key);
if (index_->entries_set_.end() == it)
return false;
@@ -137,7 +137,7 @@ class SimpleIndexTest : public testing::Test, public SimpleIndexDelegate {
return true;
}
- void InsertIntoIndexFileReturn(uint64 hash_key,
+ void InsertIntoIndexFileReturn(uint64_t hash_key,
base::Time last_used_time,
int entry_size) {
index_file_->load_result()->entries.insert(std::make_pair(
@@ -153,17 +153,16 @@ class SimpleIndexTest : public testing::Test, public SimpleIndexDelegate {
SimpleIndex* index() { return index_.get(); }
const MockSimpleIndexFile* index_file() const { return index_file_.get(); }
- const std::vector<uint64>& last_doom_entry_hashes() const {
+ const std::vector<uint64_t>& last_doom_entry_hashes() const {
return last_doom_entry_hashes_;
}
int doom_entries_calls() const { return doom_entries_calls_; }
-
- const simple_util::ImmutableArray<uint64, 16> hashes_;
+ const simple_util::ImmutableArray<uint64_t, 16> hashes_;
scoped_ptr<SimpleIndex> index_;
base::WeakPtr<MockSimpleIndexFile> index_file_;
- std::vector<uint64> last_doom_entry_hashes_;
+ std::vector<uint64_t> last_doom_entry_hashes_;
int doom_entries_calls_;
};
@@ -214,10 +213,10 @@ TEST_F(SimpleIndexTest, IndexSizeCorrectOnMerge) {
{
scoped_ptr<SimpleIndexLoadResult> result(new SimpleIndexLoadResult());
result->did_load = true;
- const uint64 new_hash_key = hashes_.at<11>();
+ const uint64_t new_hash_key = hashes_.at<11>();
result->entries.insert(
std::make_pair(new_hash_key, EntryMetadata(base::Time::Now(), 11)));
- const uint64 redundant_hash_key = hashes_.at<4>();
+ const uint64_t redundant_hash_key = hashes_.at<4>();
result->entries.insert(std::make_pair(redundant_hash_key,
EntryMetadata(base::Time::Now(), 4)));
index()->MergeInitializingSet(result.Pass());
@@ -254,7 +253,7 @@ TEST_F(SimpleIndexTest, Has) {
EXPECT_EQ(1, index_file_->load_index_entries_calls());
// Confirm "Has()" always returns true before the callback is called.
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
EXPECT_TRUE(index()->Has(kHash1));
index()->Insert(kHash1);
EXPECT_TRUE(index()->Has(kHash1));
@@ -278,7 +277,7 @@ TEST_F(SimpleIndexTest, UseIfExists) {
// Confirm "UseIfExists()" always returns true before the callback is called
// and updates mod time if the entry was really there.
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
EntryMetadata metadata1, metadata2;
EXPECT_TRUE(index()->UseIfExists(kHash1));
EXPECT_FALSE(GetEntryForTesting(kHash1, &metadata1));
@@ -317,7 +316,7 @@ TEST_F(SimpleIndexTest, UpdateEntrySize) {
index()->SetMaxSize(1000);
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
InsertIntoIndexFileReturn(kHash1, now - base::TimeDelta::FromDays(2), 475);
ReturnIndexFile();
@@ -395,7 +394,7 @@ TEST_F(SimpleIndexTest, BasicInit) {
// Remove something that's going to come in from the loaded index.
TEST_F(SimpleIndexTest, RemoveBeforeInit) {
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
index()->Remove(kHash1);
InsertIntoIndexFileReturn(kHash1,
@@ -409,7 +408,7 @@ TEST_F(SimpleIndexTest, RemoveBeforeInit) {
// Insert something that's going to come in from the loaded index; correct
// result?
TEST_F(SimpleIndexTest, InsertBeforeInit) {
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
index()->Insert(kHash1);
InsertIntoIndexFileReturn(kHash1,
@@ -427,7 +426,7 @@ TEST_F(SimpleIndexTest, InsertBeforeInit) {
// Insert and Remove something that's going to come in from the loaded index.
TEST_F(SimpleIndexTest, InsertRemoveBeforeInit) {
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
index()->Insert(kHash1);
index()->Remove(kHash1);
@@ -441,7 +440,7 @@ TEST_F(SimpleIndexTest, InsertRemoveBeforeInit) {
// Insert and Remove something that's going to come in from the loaded index.
TEST_F(SimpleIndexTest, RemoveInsertBeforeInit) {
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
index()->Remove(kHash1);
index()->Insert(kHash1);
@@ -555,7 +554,7 @@ TEST_F(SimpleIndexTest, DiskWriteQueued) {
EXPECT_FALSE(index()->write_to_disk_timer_.IsRunning());
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
index()->Insert(kHash1);
EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning());
index()->write_to_disk_timer_.Stop();
@@ -580,7 +579,7 @@ TEST_F(SimpleIndexTest, DiskWriteExecuted) {
EXPECT_FALSE(index()->write_to_disk_timer_.IsRunning());
- const uint64 kHash1 = hashes_.at<1>();
+ const uint64_t kHash1 = hashes_.at<1>();
index()->Insert(kHash1);
index()->UpdateEntrySize(kHash1, 20);
EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning());
@@ -593,7 +592,7 @@ TEST_F(SimpleIndexTest, DiskWriteExecuted) {
SimpleIndex::EntrySet entry_set;
index_file_->GetAndResetDiskWriteEntrySet(&entry_set);
- uint64 hash_key = kHash1;
+ uint64_t hash_key = kHash1;
base::Time now(base::Time::Now());
ASSERT_EQ(1u, entry_set.size());
EXPECT_EQ(hash_key, entry_set.begin()->first);
« no previous file with comments | « net/disk_cache/simple/simple_index_file_unittest.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698