Lines Matching refs:entry
67 disk_cache::Entry *entry1 = NULL, *entry2 = NULL;
87 disk_cache::Entry* entry3 = NULL;
134 disk_cache::Entry *entry1, *entry2;
244 disk_cache::Entry* entry;
245 ASSERT_EQ(net::OK, CreateEntry("key", &entry));
246 ASSERT_EQ(0, WriteData(entry, 0, 20000, buffer1, 0, false));
247 entry->Close();
273 disk_cache::EntryImpl* entry;
275 reinterpret_cast<disk_cache::Entry**>(&entry), &cb);
286 rv = entry->WriteDataImpl(0, i, buffer, kSize, &cb, false);
294 entry->Release();
324 disk_cache::Entry* entry;
325 rv = cache->CreateEntry("some key", &entry, &cb);
332 rv = entry->WriteData(0, 0, buffer, kSize, &cb, false);
335 entry->Close();
373 disk_cache::Entry* entry;
374 ASSERT_EQ(net::OK, CreateEntry(first, &entry));
378 EXPECT_EQ(cache_size / 10, WriteData(entry, 0, 0, buffer, cache_size / 10,
381 EXPECT_EQ(net::ERR_FAILED, WriteData(entry, 1, 0, buffer, cache_size / 5,
386 EXPECT_EQ(cache_size / 5, WriteData(entry, 1, 0, buffer, cache_size / 5,
391 EXPECT_EQ(cache_size * 3 / 4, WriteData(entry, 0, 0, buffer,
393 entry->Close();
400 ASSERT_EQ(net::OK, CreateEntry(second, &entry));
401 EXPECT_EQ(cache_size / 10, WriteData(entry, 0, 0, buffer, cache_size / 10,
404 disk_cache::Entry* entry2;
415 entry->Close();
416 ASSERT_EQ(net::OK, OpenEntry(second, &entry));
417 EXPECT_EQ(cache_size / 10, entry->GetDataSize(0));
418 entry->Close();
440 disk_cache::Entry* entries[100];
450 disk_cache::Entry* temp = entries[source1];
456 disk_cache::Entry* entry;
457 ASSERT_EQ(net::OK, OpenEntry(entries[i]->GetKey(), &entry));
458 EXPECT_TRUE(entry == entries[i]);
459 entry->Close();
502 disk_cache::Entry* entry;
505 ASSERT_EQ(net::OK, CreateEntry(name, &entry));
506 entry->Close();
509 ASSERT_EQ(net::OK, OpenEntry(name, &entry));
510 entry->Close();
517 EXPECT_NE(net::OK, OpenEntry("Key 0", &entry));
519 EXPECT_NE(net::OK, OpenEntry("Key 90", &entry));
522 ASSERT_EQ(net::OK, OpenEntry("Key 1", &entry));
523 entry->Close();
524 ASSERT_EQ(net::OK, OpenEntry("Key 91", &entry));
525 entry->Close();
528 // Before looking for invalid entries, let's check a valid entry.
534 disk_cache::Entry* entry;
535 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
541 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer1, kSize, false));
542 entry->Close();
545 ASSERT_EQ(net::OK, OpenEntry(key, &entry));
549 EXPECT_EQ(kSize, ReadData(entry, 0, 0, buffer2, kSize));
550 entry->Close();
564 // entry to be invalid, simulating a crash in the middle.
572 disk_cache::Entry* entry;
573 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
579 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
582 EXPECT_NE(net::OK, OpenEntry(key, &entry));
608 // Almost the same test, but this time crash the cache after reading an entry.
616 disk_cache::Entry* entry;
617 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
623 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
624 entry->Close();
625 ASSERT_EQ(net::OK, OpenEntry(key, &entry));
626 EXPECT_EQ(kSize, ReadData(entry, 0, 0, buffer, kSize));
631 // Reading an entry and crashing should not make it dirty.
632 ASSERT_EQ(net::OK, OpenEntry(key, &entry));
634 entry->Close();
636 EXPECT_NE(net::OK, OpenEntry(key, &entry));
669 disk_cache::Entry* entries[kNumEntries];
679 disk_cache::Entry* temp = entries[source1];
694 disk_cache::Entry* entry;
695 EXPECT_NE(net::OK, OpenEntry(keys[i], &entry));
699 disk_cache::Entry* entry;
700 EXPECT_EQ(net::OK, OpenEntry(keys[i], &entry));
701 entry->Close();
735 disk_cache::Entry* entry;
736 ASSERT_EQ(net::OK, CreateEntry(first, &entry));
740 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
745 ASSERT_EQ(net::OK, CreateEntry(second, &entry));
746 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
750 entry->Close(); // Trim the cache.
753 // If we evicted the entry in less than 20mS, we have one entry in the cache;
755 // entry too.
765 EXPECT_NE(net::OK, OpenEntry(first, &entry));
783 SetMask(0xf); // 16-entry table.
791 disk_cache::Entry* entry;
796 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
797 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
798 entry->Close();
799 ASSERT_EQ(net::OK, OpenEntry(key, &entry));
806 ASSERT_EQ(net::OK, CreateEntry("Something else", &entry));
807 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false));
818 entry->Close(); // Trim the cache.
846 disk_cache::Entry* entry;
847 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
848 entry->Close();
853 disk_cache::Entry* entry;
858 while (OpenNextEntry(&iter, &entry) == net::OK) {
859 ASSERT_TRUE(NULL != entry);
861 last_modified[count] = entry->GetLastModified();
862 last_used[count] = entry->GetLastUsed();
867 entry->Close();
875 while (OpenNextEntry(&iter, &entry) == net::OK) {
876 ASSERT_TRUE(NULL != entry);
878 EXPECT_TRUE(last_modified[count] == entry->GetLastModified());
879 EXPECT_TRUE(last_used[count] == entry->GetLastUsed());
881 entry->Close();
912 disk_cache::Entry *entry1, *entry2;
935 // Modify the oldest entry and get the newest element.
978 disk_cache::Entry *entry, *entry1, *entry2;
999 while (OpenNextEntry(&iter, &entry) == net::OK) {
1000 ASSERT_TRUE(NULL != entry);
1001 EXPECT_EQ(key2, entry->GetKey());
1002 entry->Close();
1031 disk_cache::Entry* entry;
1032 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
1033 entry->Close();
1037 disk_cache::Entry *entry1, *entry2;
1089 disk_cache::Entry *entry;
1090 ASSERT_EQ(net::OK, CreateEntry("first", &entry));
1091 entry->Close();
1092 entry));
1093 entry->Close();
1098 ASSERT_EQ(net::OK, CreateEntry("third", &entry));
1099 entry->Close();
1100 ASSERT_EQ(net::OK, CreateEntry("fourth", &entry));
1101 entry->Close();
1113 ASSERT_EQ(net::OK, OpenEntry("second", &entry));
1114 entry->Close();
1135 disk_cache::Entry *entry;
1136 ASSERT_EQ(net::OK, CreateEntry("first", &entry));
1137 entry->Close();
1142 ASSERT_EQ(net::OK, CreateEntry("second", &entry));
1143 entry->Close();
1144 ASSERT_EQ(net::OK, CreateEntry("third", &entry));
1145 entry->Close();
1150 ASSERT_EQ(net::OK, CreateEntry("fourth", &entry));
1151 entry->Close();
1152 ASSERT_EQ(net::OK, OpenEntry("fourth", &entry));
1153 entry->Close();
1162 ASSERT_EQ(net::OK, OpenEntry("fourth", &entry));
1163 entry->Close();
1168 ASSERT_EQ(net::OK, OpenEntry("first", &entry));
1169 entry->Close();
1205 disk_cache::Entry* entry1;
1211 // If there is a heavy load, inserting an entry will make another entry
1233 // Tests with one entry on the cache.
1357 disk_cache::Entry *entry1, *entry2;
1377 SetMask(0x1); // 2-entry table.
1382 disk_cache::Entry* entry;
1384 while (OpenNextEntry(&iter, &entry) == net::OK) {
1385 entry->Close();
1401 // Test that we handle a dirty entry on the LRU list, already replaced with
1405 SetMask(0x1); // 2-entry table.
1413 // Test that we handle a dirty entry on the deleted list, already replaced with
1418 SetMask(0x1); // 2-entry table.
1428 SetMask(0x1); // 2-entry table.
1433 // There is a dirty entry (but marked as clean) at the end, pointing to a
1434 // deleted entry through the hash collision list. We should not re-insert the
1435 // deleted entry into the index table.
1445 SetMask(0x1); // 2-entry table.
1450 // The second entry points at itselft, and the first entry is not accessible
1453 disk_cache::Entry* entry;
1454 ASSERT_EQ(net::OK, CreateEntry("The first key", &entry));
1455 entry->Close();
1459 ASSERT_EQ(net::OK, OpenEntry("The first key", &entry));
1460 entry->Close();
1468 SetMask(0x1); // 2-entry table.
1475 disk_cache::Entry* entry;
1476 ASSERT_NE(net::OK, OpenEntry("Not present key", &entry));
1485 // The second entry is dirty, but removing it should not corrupt the list.
1486 disk_cache::Entry* entry;
1487 ASSERT_NE(net::OK, OpenEntry("the second key", &entry));
1488 ASSERT_EQ(net::OK, OpenEntry("the first key", &entry));
1491 entry->Doom();
1493 entry->Close();
1495 ASSERT_EQ(net::OK, OpenEntry("some other key", &entry));
1496 entry->Close();
1505 disk_cache::Entry *entry1, *entry2;
1536 disk_cache::Entry *entry1, *entry2;
1556 disk_cache::Entry* entry;
1558 ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry));
1559 entry->Close();
1562 EXPECT_NE(net::OK, OpenNextEntry(&iter, &entry));
1605 disk_cache::Entry *entry1, *entry2;
1660 disk_cache::Entry* entry;
1663 while (OpenNextEntry(&iter, &entry) == net::OK) {
1664 ASSERT_TRUE(NULL != entry);
1665 entry->Close();
1712 disk_cache::Entry *entry1, *entry2;
1746 disk_cache::Entry *entry1, *entry2, *entry3, *entry4;
1832 disk_cache::Entry *entry1, *entry2;
1848 disk_cache::Entry *entry3, *entry4;
1857 entry3->Doom(); // The entry should be already doomed, but this must work.
1896 disk_cache::Entry* entry;
1897 ASSERT_EQ(net::OK, CreateEntry("Something new", &entry));
1898 entry->Close();
1920 // We should be able to create the same entry on multiple simultaneous instances
1946 disk_cache::Entry* entry;
1948 rv = cache[i]->CreateEntry(key, &entry, &cb);
1950 entry->Close();
2023 disk_cache::Entry* entry;
2024 ASSERT_EQ(net::OK, CreateEntry(key, &entry));
2032 // Allocate 2MB for this entry.
2033 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, true));
2034 EXPECT_EQ(kSize, WriteData(entry, 1, 0, buffer, kSize, true));
2035 EXPECT_EQ(kSize, WriteData(entry, 0, 1024 * 1024, buffer, kSize, false));
2036 EXPECT_EQ(kSize, WriteData(entry, 1, 1024 * 1024, buffer, kSize, false));
2039 EXPECT_EQ(0, WriteData(entry, 0, 0, buffer, 0, true));
2040 EXPECT_EQ(0, WriteData(entry, 1, 10, buffer, 0, true));
2043 entry->Close();
2044 ASSERT_EQ(net::OK, OpenEntry(key, &entry));
2047 entry->Close();