diff options
author | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-08 02:14:08 +0000 |
---|---|---|
committer | paulg@google.com <paulg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-08 02:14:08 +0000 |
commit | 4f24e87d4c051571744bab377cc356bdef093701 (patch) | |
tree | 7da8e990e10f95aabf6cf73670971bc654e3c214 /chrome/browser/safe_browsing/chunk_range_unittest.cc | |
parent | 6bf766924e2e8dc08ccd248bc128bd6fe29297cd (diff) | |
download | chromium_src-4f24e87d4c051571744bab377cc356bdef093701.zip chromium_src-4f24e87d4c051571744bab377cc356bdef093701.tar.gz chromium_src-4f24e87d4c051571744bab377cc356bdef093701.tar.bz2 |
Make chunk ranges searchable.
Review URL: http://codereview.chromium.org/5645
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing/chunk_range_unittest.cc')
-rw-r--r-- | chrome/browser/safe_browsing/chunk_range_unittest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/safe_browsing/chunk_range_unittest.cc b/chrome/browser/safe_browsing/chunk_range_unittest.cc index e467dfd..91e44db 100644 --- a/chrome/browser/safe_browsing/chunk_range_unittest.cc +++ b/chrome/browser/safe_browsing/chunk_range_unittest.cc @@ -175,3 +175,22 @@ TEST(SafeBrowsingChunkRangeTest, TestRangesToChunks) { EXPECT_EQ(chunks[3], 4); EXPECT_EQ(chunks[4], 17); } + + +TEST(SafeBrowsingChunkRangeTest, TestSearchChunkRanges) { + std::string range_str("1-10,15-17,21-410,555,991-1000"); + std::vector<ChunkRange> ranges; + StringToRanges(range_str, &ranges); + + EXPECT_TRUE(IsChunkInRange(7, ranges)); + EXPECT_TRUE(IsChunkInRange(300, ranges)); + EXPECT_TRUE(IsChunkInRange(555, ranges)); + EXPECT_TRUE(IsChunkInRange(1, ranges)); + EXPECT_TRUE(IsChunkInRange(1000, ranges)); + + EXPECT_FALSE(IsChunkInRange(11, ranges)); + EXPECT_FALSE(IsChunkInRange(990, ranges)); + EXPECT_FALSE(IsChunkInRange(2000, ranges)); +} + + |