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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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_index.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.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 <algorithm> 5 #include <algorithm>
6 #include <functional> 6 #include <functional>
7 7
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/hash.h" 9 #include "base/hash.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 10 matching lines...) Expand all
21 #include "net/disk_cache/simple/simple_index_file.h" 21 #include "net/disk_cache/simple/simple_index_file.h"
22 #include "net/disk_cache/simple/simple_test_util.h" 22 #include "net/disk_cache/simple/simple_test_util.h"
23 #include "net/disk_cache/simple/simple_util.h" 23 #include "net/disk_cache/simple/simple_util.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 25
26 namespace disk_cache { 26 namespace disk_cache {
27 namespace { 27 namespace {
28 28
29 const base::Time kTestLastUsedTime = 29 const base::Time kTestLastUsedTime =
30 base::Time::UnixEpoch() + base::TimeDelta::FromDays(20); 30 base::Time::UnixEpoch() + base::TimeDelta::FromDays(20);
31 const int kTestEntrySize = 789; 31 const uint64 kTestEntrySize = 789;
32 32
33 } // namespace 33 } // namespace
34 34
35 35
36 class EntryMetadataTest : public testing::Test { 36 class EntryMetadataTest : public testing::Test {
37 public: 37 public:
38 EntryMetadata NewEntryMetadataWithValues() { 38 EntryMetadata NewEntryMetadataWithValues() {
39 return EntryMetadata(kTestLastUsedTime, kTestEntrySize); 39 return EntryMetadata(kTestLastUsedTime, kTestEntrySize);
40 } 40 }
41 41
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 scoped_ptr<SimpleIndex> index_; 164 scoped_ptr<SimpleIndex> index_;
165 base::WeakPtr<MockSimpleIndexFile> index_file_; 165 base::WeakPtr<MockSimpleIndexFile> index_file_;
166 166
167 std::vector<uint64> last_doom_entry_hashes_; 167 std::vector<uint64> last_doom_entry_hashes_;
168 int doom_entries_calls_; 168 int doom_entries_calls_;
169 }; 169 };
170 170
171 TEST_F(EntryMetadataTest, Basics) { 171 TEST_F(EntryMetadataTest, Basics) {
172 EntryMetadata entry_metadata; 172 EntryMetadata entry_metadata;
173 EXPECT_EQ(base::Time(), entry_metadata.GetLastUsedTime()); 173 EXPECT_EQ(base::Time(), entry_metadata.GetLastUsedTime());
174 EXPECT_EQ(0, entry_metadata.GetEntrySize()); 174 EXPECT_EQ(0U, entry_metadata.GetEntrySize());
175 175
176 entry_metadata = NewEntryMetadataWithValues(); 176 entry_metadata = NewEntryMetadataWithValues();
177 CheckEntryMetadataValues(entry_metadata); 177 CheckEntryMetadataValues(entry_metadata);
178 178
179 const base::Time new_time = base::Time::Now(); 179 const base::Time new_time = base::Time::Now();
180 entry_metadata.SetLastUsedTime(new_time); 180 entry_metadata.SetLastUsedTime(new_time);
181 181
182 EXPECT_LT(new_time - base::TimeDelta::FromSeconds(2), 182 EXPECT_LT(new_time - base::TimeDelta::FromSeconds(2),
183 entry_metadata.GetLastUsedTime()); 183 entry_metadata.GetLastUsedTime());
184 EXPECT_GT(new_time + base::TimeDelta::FromSeconds(2), 184 EXPECT_GT(new_time + base::TimeDelta::FromSeconds(2),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 index()->MergeInitializingSet(result.Pass()); 224 index()->MergeInitializingSet(result.Pass());
225 } 225 }
226 EXPECT_EQ(2U + 3U + 4U + 11U, index()->cache_size_); 226 EXPECT_EQ(2U + 3U + 4U + 11U, index()->cache_size_);
227 } 227 }
228 228
229 // State of index changes as expected with an insert and a remove. 229 // State of index changes as expected with an insert and a remove.
230 TEST_F(SimpleIndexTest, BasicInsertRemove) { 230 TEST_F(SimpleIndexTest, BasicInsertRemove) {
231 // Confirm blank state. 231 // Confirm blank state.
232 EntryMetadata metadata; 232 EntryMetadata metadata;
233 EXPECT_EQ(base::Time(), metadata.GetLastUsedTime()); 233 EXPECT_EQ(base::Time(), metadata.GetLastUsedTime());
234 EXPECT_EQ(0, metadata.GetEntrySize()); 234 EXPECT_EQ(0U, metadata.GetEntrySize());
235 235
236 // Confirm state after insert. 236 // Confirm state after insert.
237 index()->Insert(hashes_.at<1>()); 237 index()->Insert(hashes_.at<1>());
238 ASSERT_TRUE(GetEntryForTesting(hashes_.at<1>(), &metadata)); 238 ASSERT_TRUE(GetEntryForTesting(hashes_.at<1>(), &metadata));
239 base::Time now(base::Time::Now()); 239 base::Time now(base::Time::Now());
240 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 240 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
241 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 241 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
242 EXPECT_EQ(0, metadata.GetEntrySize()); 242 EXPECT_EQ(0U, metadata.GetEntrySize());
243 243
244 // Confirm state after remove. 244 // Confirm state after remove.
245 metadata = EntryMetadata(); 245 metadata = EntryMetadata();
246 index()->Remove(hashes_.at<1>()); 246 index()->Remove(hashes_.at<1>());
247 EXPECT_FALSE(GetEntryForTesting(hashes_.at<1>(), &metadata)); 247 EXPECT_FALSE(GetEntryForTesting(hashes_.at<1>(), &metadata));
248 EXPECT_EQ(base::Time(), metadata.GetLastUsedTime()); 248 EXPECT_EQ(base::Time(), metadata.GetLastUsedTime());
249 EXPECT_EQ(0, metadata.GetEntrySize()); 249 EXPECT_EQ(0U, metadata.GetEntrySize());
250 } 250 }
251 251
252 TEST_F(SimpleIndexTest, Has) { 252 TEST_F(SimpleIndexTest, Has) {
253 // Confirm the base index has dispatched the request for index entries. 253 // Confirm the base index has dispatched the request for index entries.
254 EXPECT_TRUE(index_file_.get()); 254 EXPECT_TRUE(index_file_.get());
255 EXPECT_EQ(1, index_file_->load_index_entries_calls()); 255 EXPECT_EQ(1, index_file_->load_index_entries_calls());
256 256
257 // Confirm "Has()" always returns true before the callback is called. 257 // Confirm "Has()" always returns true before the callback is called.
258 const uint64 kHash1 = hashes_.at<1>(); 258 const uint64 kHash1 = hashes_.at<1>();
259 EXPECT_TRUE(index()->Has(kHash1)); 259 EXPECT_TRUE(index()->Has(kHash1));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 ReturnIndexFile(); 323 ReturnIndexFile();
324 324
325 EntryMetadata metadata; 325 EntryMetadata metadata;
326 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata)); 326 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata));
327 EXPECT_LT( 327 EXPECT_LT(
328 now - base::TimeDelta::FromDays(2) - base::TimeDelta::FromSeconds(1), 328 now - base::TimeDelta::FromDays(2) - base::TimeDelta::FromSeconds(1),
329 metadata.GetLastUsedTime()); 329 metadata.GetLastUsedTime());
330 EXPECT_GT( 330 EXPECT_GT(
331 now - base::TimeDelta::FromDays(2) + base::TimeDelta::FromSeconds(1), 331 now - base::TimeDelta::FromDays(2) + base::TimeDelta::FromSeconds(1),
332 metadata.GetLastUsedTime()); 332 metadata.GetLastUsedTime());
333 EXPECT_EQ(475, metadata.GetEntrySize()); 333 EXPECT_EQ(475U, metadata.GetEntrySize());
334 334
335 index()->UpdateEntrySize(kHash1, 600u); 335 index()->UpdateEntrySize(kHash1, 600u);
336 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata)); 336 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata));
337 EXPECT_EQ(600, metadata.GetEntrySize()); 337 EXPECT_EQ(600U, metadata.GetEntrySize());
338 EXPECT_EQ(1, index()->GetEntryCount()); 338 EXPECT_EQ(1, index()->GetEntryCount());
339 } 339 }
340 340
341 TEST_F(SimpleIndexTest, GetEntryCount) { 341 TEST_F(SimpleIndexTest, GetEntryCount) {
342 EXPECT_EQ(0, index()->GetEntryCount()); 342 EXPECT_EQ(0, index()->GetEntryCount());
343 index()->Insert(hashes_.at<1>()); 343 index()->Insert(hashes_.at<1>());
344 EXPECT_EQ(1, index()->GetEntryCount()); 344 EXPECT_EQ(1, index()->GetEntryCount());
345 index()->Insert(hashes_.at<2>()); 345 index()->Insert(hashes_.at<2>());
346 EXPECT_EQ(2, index()->GetEntryCount()); 346 EXPECT_EQ(2, index()->GetEntryCount());
347 index()->Insert(hashes_.at<3>()); 347 index()->Insert(hashes_.at<3>());
(...skipping 28 matching lines...) Expand all
376 ReturnIndexFile(); 376 ReturnIndexFile();
377 377
378 EntryMetadata metadata; 378 EntryMetadata metadata;
379 EXPECT_TRUE(GetEntryForTesting(hashes_.at<1>(), &metadata)); 379 EXPECT_TRUE(GetEntryForTesting(hashes_.at<1>(), &metadata));
380 EXPECT_LT( 380 EXPECT_LT(
381 now - base::TimeDelta::FromDays(2) - base::TimeDelta::FromSeconds(1), 381 now - base::TimeDelta::FromDays(2) - base::TimeDelta::FromSeconds(1),
382 metadata.GetLastUsedTime()); 382 metadata.GetLastUsedTime());
383 EXPECT_GT( 383 EXPECT_GT(
384 now - base::TimeDelta::FromDays(2) + base::TimeDelta::FromSeconds(1), 384 now - base::TimeDelta::FromDays(2) + base::TimeDelta::FromSeconds(1),
385 metadata.GetLastUsedTime()); 385 metadata.GetLastUsedTime());
386 EXPECT_EQ(10, metadata.GetEntrySize()); 386 EXPECT_EQ(10U, metadata.GetEntrySize());
387 EXPECT_TRUE(GetEntryForTesting(hashes_.at<2>(), &metadata)); 387 EXPECT_TRUE(GetEntryForTesting(hashes_.at<2>(), &metadata));
388 EXPECT_LT( 388 EXPECT_LT(
389 now - base::TimeDelta::FromDays(3) - base::TimeDelta::FromSeconds(1), 389 now - base::TimeDelta::FromDays(3) - base::TimeDelta::FromSeconds(1),
390 metadata.GetLastUsedTime()); 390 metadata.GetLastUsedTime());
391 EXPECT_GT( 391 EXPECT_GT(
392 now - base::TimeDelta::FromDays(3) + base::TimeDelta::FromSeconds(1), 392 now - base::TimeDelta::FromDays(3) + base::TimeDelta::FromSeconds(1),
393 metadata.GetLastUsedTime()); 393 metadata.GetLastUsedTime());
394 EXPECT_EQ(100, metadata.GetEntrySize()); 394 EXPECT_EQ(100U, metadata.GetEntrySize());
395 } 395 }
396 396
397 // Remove something that's going to come in from the loaded index. 397 // Remove something that's going to come in from the loaded index.
398 TEST_F(SimpleIndexTest, RemoveBeforeInit) { 398 TEST_F(SimpleIndexTest, RemoveBeforeInit) {
399 const uint64 kHash1 = hashes_.at<1>(); 399 const uint64 kHash1 = hashes_.at<1>();
400 index()->Remove(kHash1); 400 index()->Remove(kHash1);
401 401
402 InsertIntoIndexFileReturn(kHash1, 402 InsertIntoIndexFileReturn(kHash1,
403 base::Time::Now() - base::TimeDelta::FromDays(2), 403 base::Time::Now() - base::TimeDelta::FromDays(2),
404 10u); 404 10u);
(...skipping 11 matching lines...) Expand all
416 InsertIntoIndexFileReturn(kHash1, 416 InsertIntoIndexFileReturn(kHash1,
417 base::Time::Now() - base::TimeDelta::FromDays(2), 417 base::Time::Now() - base::TimeDelta::FromDays(2),
418 10u); 418 10u);
419 ReturnIndexFile(); 419 ReturnIndexFile();
420 420
421 EntryMetadata metadata; 421 EntryMetadata metadata;
422 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata)); 422 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata));
423 base::Time now(base::Time::Now()); 423 base::Time now(base::Time::Now());
424 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 424 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
425 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 425 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
426 EXPECT_EQ(0, metadata.GetEntrySize()); 426 EXPECT_EQ(0U, metadata.GetEntrySize());
427 } 427 }
428 428
429 // Insert and Remove something that's going to come in from the loaded index. 429 // Insert and Remove something that's going to come in from the loaded index.
430 TEST_F(SimpleIndexTest, InsertRemoveBeforeInit) { 430 TEST_F(SimpleIndexTest, InsertRemoveBeforeInit) {
431 const uint64 kHash1 = hashes_.at<1>(); 431 const uint64 kHash1 = hashes_.at<1>();
432 index()->Insert(kHash1); 432 index()->Insert(kHash1);
433 index()->Remove(kHash1); 433 index()->Remove(kHash1);
434 434
435 InsertIntoIndexFileReturn(kHash1, 435 InsertIntoIndexFileReturn(kHash1,
436 base::Time::Now() - base::TimeDelta::FromDays(2), 436 base::Time::Now() - base::TimeDelta::FromDays(2),
(...skipping 12 matching lines...) Expand all
449 InsertIntoIndexFileReturn(kHash1, 449 InsertIntoIndexFileReturn(kHash1,
450 base::Time::Now() - base::TimeDelta::FromDays(2), 450 base::Time::Now() - base::TimeDelta::FromDays(2),
451 10u); 451 10u);
452 ReturnIndexFile(); 452 ReturnIndexFile();
453 453
454 EntryMetadata metadata; 454 EntryMetadata metadata;
455 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata)); 455 EXPECT_TRUE(GetEntryForTesting(kHash1, &metadata));
456 base::Time now(base::Time::Now()); 456 base::Time now(base::Time::Now());
457 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 457 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
458 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 458 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
459 EXPECT_EQ(0, metadata.GetEntrySize()); 459 EXPECT_EQ(0U, metadata.GetEntrySize());
460 } 460 }
461 461
462 // Do all above tests at once + a non-conflict to test for cross-key 462 // Do all above tests at once + a non-conflict to test for cross-key
463 // interactions. 463 // interactions.
464 TEST_F(SimpleIndexTest, AllInitConflicts) { 464 TEST_F(SimpleIndexTest, AllInitConflicts) {
465 base::Time now(base::Time::Now()); 465 base::Time now(base::Time::Now());
466 466
467 index()->Remove(hashes_.at<1>()); 467 index()->Remove(hashes_.at<1>());
468 InsertIntoIndexFileReturn(hashes_.at<1>(), 468 InsertIntoIndexFileReturn(hashes_.at<1>(),
469 now - base::TimeDelta::FromDays(2), 469 now - base::TimeDelta::FromDays(2),
(...skipping 17 matching lines...) Expand all
487 100000u); 487 100000u);
488 488
489 ReturnIndexFile(); 489 ReturnIndexFile();
490 490
491 EXPECT_FALSE(index()->Has(hashes_.at<1>())); 491 EXPECT_FALSE(index()->Has(hashes_.at<1>()));
492 492
493 EntryMetadata metadata; 493 EntryMetadata metadata;
494 EXPECT_TRUE(GetEntryForTesting(hashes_.at<2>(), &metadata)); 494 EXPECT_TRUE(GetEntryForTesting(hashes_.at<2>(), &metadata));
495 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 495 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
496 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 496 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
497 EXPECT_EQ(0, metadata.GetEntrySize()); 497 EXPECT_EQ(0U, metadata.GetEntrySize());
498 498
499 EXPECT_FALSE(index()->Has(hashes_.at<3>())); 499 EXPECT_FALSE(index()->Has(hashes_.at<3>()));
500 500
501 EXPECT_TRUE(GetEntryForTesting(hashes_.at<4>(), &metadata)); 501 EXPECT_TRUE(GetEntryForTesting(hashes_.at<4>(), &metadata));
502 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 502 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
503 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime()); 503 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), metadata.GetLastUsedTime());
504 EXPECT_EQ(0, metadata.GetEntrySize()); 504 EXPECT_EQ(0U, metadata.GetEntrySize());
505 505
506 EXPECT_TRUE(GetEntryForTesting(hashes_.at<5>(), &metadata)); 506 EXPECT_TRUE(GetEntryForTesting(hashes_.at<5>(), &metadata));
507 507
508 EXPECT_GT( 508 EXPECT_GT(
509 now - base::TimeDelta::FromDays(6) + base::TimeDelta::FromSeconds(1), 509 now - base::TimeDelta::FromDays(6) + base::TimeDelta::FromSeconds(1),
510 metadata.GetLastUsedTime()); 510 metadata.GetLastUsedTime());
511 EXPECT_LT( 511 EXPECT_LT(
512 now - base::TimeDelta::FromDays(6) - base::TimeDelta::FromSeconds(1), 512 now - base::TimeDelta::FromDays(6) - base::TimeDelta::FromSeconds(1),
513 metadata.GetLastUsedTime()); 513 metadata.GetLastUsedTime());
514 514
515 EXPECT_EQ(100000, metadata.GetEntrySize()); 515 EXPECT_EQ(100000U, metadata.GetEntrySize());
516 } 516 }
517 517
518 TEST_F(SimpleIndexTest, BasicEviction) { 518 TEST_F(SimpleIndexTest, BasicEviction) {
519 base::Time now(base::Time::Now()); 519 base::Time now(base::Time::Now());
520 index()->SetMaxSize(1000); 520 index()->SetMaxSize(1000);
521 InsertIntoIndexFileReturn(hashes_.at<1>(), 521 InsertIntoIndexFileReturn(hashes_.at<1>(),
522 now - base::TimeDelta::FromDays(2), 522 now - base::TimeDelta::FromDays(2),
523 475u); 523 475u);
524 index()->Insert(hashes_.at<2>()); 524 index()->Insert(hashes_.at<2>());
525 index()->UpdateEntrySize(hashes_.at<2>(), 475); 525 index()->UpdateEntrySize(hashes_.at<2>(), 475);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 SimpleIndex::EntrySet entry_set; 594 SimpleIndex::EntrySet entry_set;
595 index_file_->GetAndResetDiskWriteEntrySet(&entry_set); 595 index_file_->GetAndResetDiskWriteEntrySet(&entry_set);
596 596
597 uint64 hash_key = kHash1; 597 uint64 hash_key = kHash1;
598 base::Time now(base::Time::Now()); 598 base::Time now(base::Time::Now());
599 ASSERT_EQ(1u, entry_set.size()); 599 ASSERT_EQ(1u, entry_set.size());
600 EXPECT_EQ(hash_key, entry_set.begin()->first); 600 EXPECT_EQ(hash_key, entry_set.begin()->first);
601 const EntryMetadata& entry1(entry_set.begin()->second); 601 const EntryMetadata& entry1(entry_set.begin()->second);
602 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), entry1.GetLastUsedTime()); 602 EXPECT_LT(now - base::TimeDelta::FromMinutes(1), entry1.GetLastUsedTime());
603 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), entry1.GetLastUsedTime()); 603 EXPECT_GT(now + base::TimeDelta::FromMinutes(1), entry1.GetLastUsedTime());
604 EXPECT_EQ(20, entry1.GetEntrySize()); 604 EXPECT_EQ(20U, entry1.GetEntrySize());
605 } 605 }
606 606
607 TEST_F(SimpleIndexTest, DiskWritePostponed) { 607 TEST_F(SimpleIndexTest, DiskWritePostponed) {
608 index()->SetMaxSize(1000); 608 index()->SetMaxSize(1000);
609 ReturnIndexFile(); 609 ReturnIndexFile();
610 610
611 EXPECT_FALSE(index()->write_to_disk_timer_.IsRunning()); 611 EXPECT_FALSE(index()->write_to_disk_timer_.IsRunning());
612 612
613 index()->Insert(hashes_.at<1>()); 613 index()->Insert(hashes_.at<1>());
614 index()->UpdateEntrySize(hashes_.at<1>(), 20); 614 index()->UpdateEntrySize(hashes_.at<1>(), 20);
615 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning()); 615 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning());
616 base::TimeTicks expected_trigger( 616 base::TimeTicks expected_trigger(
617 index()->write_to_disk_timer_.desired_run_time()); 617 index()->write_to_disk_timer_.desired_run_time());
618 618
619 WaitForTimeChange(); 619 WaitForTimeChange();
620 EXPECT_EQ(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); 620 EXPECT_EQ(expected_trigger, index()->write_to_disk_timer_.desired_run_time());
621 index()->Insert(hashes_.at<2>()); 621 index()->Insert(hashes_.at<2>());
622 index()->UpdateEntrySize(hashes_.at<2>(), 40); 622 index()->UpdateEntrySize(hashes_.at<2>(), 40);
623 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning()); 623 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning());
624 EXPECT_LT(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); 624 EXPECT_LT(expected_trigger, index()->write_to_disk_timer_.desired_run_time());
625 index()->write_to_disk_timer_.Stop(); 625 index()->write_to_disk_timer_.Stop();
626 } 626 }
627 627
628 } // namespace disk_cache 628 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_index.cc ('k') | net/disk_cache/simple/simple_synchronous_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698