Lines Matching full:chunk
41 void InsertAddChunkHostPrefixValue(SBChunk* chunk,
45 chunk->chunk_number = chunk_number;
46 chunk->is_add = true;
50 host.entry->set_chunk_id(chunk->chunk_number);
52 chunk->hosts.push_back(host);
55 // A helper function that appends one AddChunkHost to chunk with
57 void InsertAddChunkHostPrefixUrl(SBChunk* chunk,
61 InsertAddChunkHostPrefixValue(chunk, chunk_number,
67 void InsertAddChunkHostFullHashes(SBChunk* chunk,
71 chunk->chunk_number = chunk_number;
72 chunk->is_add = true;
76 host.entry->set_chunk_id(chunk->chunk_number);
78 chunk->hosts.push_back(host);
82 void InsertAddChunkHost2PrefixUrls(SBChunk* chunk,
87 chunk->chunk_number = chunk_number;
88 chunk->is_add = true;
92 host.entry->set_chunk_id(chunk->chunk_number);
95 chunk->hosts.push_back(host);
99 void InsertAddChunkHost2FullHashes(SBChunk* chunk,
104 chunk->chunk_number = chunk_number;
105 chunk->is_add = true;
109 host.entry->set_chunk_id(chunk->chunk_number);
112 chunk->hosts.push_back(host);
117 void InsertSubChunkHostPrefixValue(SBChunk* chunk,
122 chunk->chunk_number = chunk_number;
123 chunk->is_add = false;
127 host.entry->set_chunk_id(chunk->chunk_number);
130 chunk->hosts.push_back(host);
133 // A helper function that adds one SubChunkHost to chunk with
135 void InsertSubChunkHostPrefixUrl(SBChunk* chunk,
140 InsertSubChunkHostPrefixValue(chunk, chunk_number,
147 void InsertSubChunkHost2PrefixUrls(SBChunk* chunk,
153 chunk->chunk_number = chunk_number;
154 chunk->is_add = false;
158 host.entry->set_chunk_id(chunk->chunk_number);
163 chunk->hosts.push_back(host);
167 void InsertSubChunkHost2FullHashes(SBChunk* chunk,
173 chunk->chunk_number = chunk_number;
174 chunk->is_add = false;
178 host.entry->set_chunk_id(chunk->chunk_number);
183 chunk->hosts.push_back(host);
187 void InsertSubChunkHostFullHash(SBChunk* chunk,
192 chunk->chunk_number = chunk_number;
193 chunk->is_add = false;
197 host.entry->set_chunk_id(chunk->chunk_number);
200 chunk->hosts.push_back(host);
295 SBChunk chunk;
297 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
300 chunks.push_back(chunk);
305 chunk.hosts.clear();
306 InsertAddChunkHostPrefixUrl(&chunk, 2, "www.foo.com/",
309 chunks.push_back(chunk);
312 chunk.hosts.clear();
313 InsertAddChunkHostPrefixUrl(&chunk, 3, "www.whatever.com/",
316 chunks.push_back(chunk);
325 // Insert a malware sub chunk.
326 chunk.hosts.clear();
327 InsertSubChunkHostPrefixUrl(&chunk, 7, 19, "www.subbed.com/",
330 chunks.push_back(chunk);
349 // Add a phishing add chunk.
350 chunk.hosts.clear();
351 InsertAddChunkHostPrefixUrl(&chunk, 47, "www.evil.com/",
354 chunks.push_back(chunk);
359 chunk.hosts.clear();
360 InsertSubChunkHostPrefixUrl(&chunk, 200, 1999, "www.phishy.com/",
363 chunks.push_back(chunk);
366 chunk.hosts.clear();
367 InsertSubChunkHostPrefixUrl(&chunk, 201, 1999, "www.phishy2.com/",
370 chunks.push_back(chunk);
395 SBChunk chunk;
398 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
400 chunks.push_back(chunk);
405 chunk.hosts.clear();
406 InsertAddChunkHostPrefixUrl(&chunk, 2, "www.foo.com/",
409 chunks.push_back(chunk);
412 chunk.hosts.clear();
413 InsertAddChunkHostPrefixUrl(&chunk, 3, "www.whatever.com/",
416 chunks.push_back(chunk);
419 chunk.hosts.clear();
420 InsertAddChunkHostPrefixUrl(&chunk, 4, "www.forhash.com/",
423 chunks.push_back(chunk);
426 chunk.hosts.clear();
427 InsertAddChunkHostFullHashes(&chunk, 5, "www.forwhitelist.com/",
430 chunks.push_back(chunk);
458 SBChunk chunk;
460 // Add a simple chunk with one hostkey.
461 InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.evil.com/",
464 chunks.push_back(chunk);
469 chunk.hosts.clear();
470 InsertAddChunkHost2PrefixUrls(&chunk, 2, "www.evil.com/",
473 InsertAddChunkHost2PrefixUrls(&chunk, 2, "www.good.com/",
477 chunks.push_back(chunk);
480 // and a chunk with an IP-based host
481 chunk.hosts.clear();
482 InsertAddChunkHostPrefixUrl(&chunk, 3, "192.168.0.1/",
485 chunks.push_back(chunk);
547 // Attempt to re-add the first chunk (should be a no-op).
549 chunk.hosts.clear();
550 InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.evil.com/",
554 chunks.push_back(chunk);
564 // Test removing a single prefix from the add chunk.
565 chunk.hosts.clear();
566 InsertSubChunkHostPrefixUrl(&chunk, 4, 2, "www.evil.com/",
569 chunks.push_back(chunk);
607 // Test the same sub chunk again. This should be a no-op.
609 chunk.hosts.clear();
610 InsertSubChunkHostPrefixUrl(&chunk, 4, 2, "www.evil.com/",
613 chunks.push_back(chunk);
623 // Test removing all the prefixes from an add chunk.
651 chunk.hosts.clear();
652 InsertAddChunkHostPrefixUrl(&chunk, 44, "www.redherring.com/",
655 chunks.push_back(chunk);
673 chunk.hosts.clear();
674 InsertSubChunkHost2PrefixUrls(&chunk, 5, 10,
679 chunks.push_back(chunk);
688 // Now insert the tardy add chunk and we don't expect them to appear
689 // in database because of the previous sub chunk.
690 chunk.hosts.clear();
691 InsertAddChunkHost2PrefixUrls(&chunk, 10, "www.notevilanymore.com/",
695 chunks.push_back(chunk);
713 SBChunk chunk;
716 InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.test.com/",
720 chunks.push_back(chunk);
722 chunk.hosts.clear();
723 InsertAddChunkHost2PrefixUrls(&chunk, 10, "www.random.com/",
726 chunks.push_back(chunk);
733 // Add an empty ADD and SUB chunk.
755 // Add an empty chunk along with a couple that contain data. This should
756 // result in the chunk range being reduced in size.
815 SBChunk chunk;
816 // Add a simple chunk with one hostkey and cache it.
817 InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.evil.com/",
820 chunks.push_back(chunk);
874 // Test removing a prefix via a sub chunk.
875 SBChunk chunk;
877 InsertSubChunkHostPrefixUrl(&chunk, 2, 1, "www.evil.com/",
879 chunks.push_back(chunk);
905 // Test that an AddDel for the original chunk removes the last cached entry.
990 // Test receiving a full add chunk.
991 chunk.hosts.clear();
992 InsertAddChunkHost2FullHashes(&chunk, 20, "www.fullevil.com/",
996 chunks.push_back(chunk);
1021 // Test receiving a full sub chunk, which will remove one of the full adds.
1022 chunk.hosts.clear();
1023 InsertSubChunkHostFullHash(&chunk, 200, 20,
1027 chunks.push_back(chunk);
1083 // Create a sub chunk to insert.
1085 SBChunk chunk;
1092 chunk.chunk_number = 7;
1093 chunk.is_add = false;
1094 chunk.hosts.clear();
1095 chunk.hosts.push_back(host);
1097 chunks.push_back(chunk);
1155 SBChunk chunk;
1156 // Add a simple chunk with one hostkey for download url list.
1157 InsertAddChunkHost2PrefixUrls(&chunk, 1, kEvil1Host,
1159 chunks.push_back(chunk);
1268 SBChunk chunk;
1270 InsertAddChunkHost2FullHashes(&chunk, 1, kGood1Host,
1272 chunks.push_back(chunk);
1274 chunk.hosts.clear();
1275 InsertAddChunkHostFullHashes(&chunk, 2, kGood2Host, kGood2Url1);
1276 chunks.push_back(chunk);
1353 // Test to make sure we could insert chunk list that
1356 SBChunk chunk;
1358 // Add a malware add chunk with two entries of the same host.
1359 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
1361 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
1364 chunks.push_back(chunk);
1377 // Add a phishing add chunk with two entries of the same host.
1378 chunk.hosts.clear();
1379 InsertAddChunkHostPrefixUrl(&chunk, 47, "www.evil.com/",
1381 InsertAddChunkHostPrefixUrl(&chunk, 47, "www.evil.com/",
1384 chunks.push_back(chunk);
1416 // Test removing a single prefix from the add chunk.
1418 chunk.hosts.clear();
1419 InsertSubChunkHostPrefixUrl(&chunk, 4, 1, "www.evil.com/",
1422 chunks.push_back(chunk);
1428 chunk.hosts.clear();
1429 InsertSubChunkHostPrefixUrl(&chunk, 5, 47, "www.evil.com/",
1432 chunks.push_back(chunk);
1466 SBChunk chunk;
1468 InsertAddChunkHostPrefixValue(&chunk, 1, 0, kPrefix1);
1470 InsertAddChunkHostPrefixValue(&chunk, 1, 0, kPrefix2);
1471 chunks.push_back(chunk);
1496 SBChunk chunk;
1504 InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
1507 chunks.push_back(chunk);
1518 // Inserting another chunk updates the database file. The sleep is
1524 chunk.hosts.clear();
1525 InsertAddChunkHostPrefixUrl(&chunk, 2, "www.foo.com/",
1528 chunks.push_back(chunk);
1534 // Deleting a chunk updates the database file.
1538 AddDelChunk(safe_browsing_util::kMalwareList, chunk.chunk_number);