summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database.cc10
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database_unittest.cc55
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_util.cc6
3 files changed, 20 insertions, 51 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 6721f10..d880472 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1069,6 +1069,14 @@ bool SafeBrowsingDatabaseNew::UpdateStarted(
download_listnames.push_back(safe_browsing_util::kBinUrlList);
download_listnames.push_back(safe_browsing_util::kBinHashList);
UpdateChunkRanges(download_store_.get(), download_listnames, lists);
+ DCHECK_EQ(lists->back().name,
+ std::string(safe_browsing_util::kBinHashList));
+ // Remove kBinHashList entry so that we do not request updates for it from
+ // the server. The existing data will still be retained by
+ // SafeBrowsingStoreFile::DoUpdate.
+ // TODO(mattm): write some code to remove the kBinHashList data from the
+ // file?
+ lists->pop_back();
}
if (csd_whitelist_store_.get()) {
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 7409f7b..ef35453b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -424,7 +424,7 @@ TEST_F(SafeBrowsingDatabaseTest, ListNameForBrowseAndDownload) {
database_->UpdateFinished(true);
GetListsInfo(&lists);
- EXPECT_EQ(6U, lists.size());
+ ASSERT_EQ(5U, lists.size());
EXPECT_TRUE(lists[0].name == safe_browsing_util::kMalwareList);
EXPECT_EQ(lists[0].adds, "1");
EXPECT_TRUE(lists[0].subs.empty());
@@ -434,15 +434,13 @@ TEST_F(SafeBrowsingDatabaseTest, ListNameForBrowseAndDownload) {
EXPECT_TRUE(lists[2].name == safe_browsing_util::kBinUrlList);
EXPECT_EQ(lists[2].adds, "3");
EXPECT_TRUE(lists[2].subs.empty());
- EXPECT_TRUE(lists[3].name == safe_browsing_util::kBinHashList);
- EXPECT_EQ(lists[3].adds, "4");
+ // kBinHashList is ignored. (http://crbug.com/108130)
+ EXPECT_TRUE(lists[3].name == safe_browsing_util::kCsdWhiteList);
+ EXPECT_EQ(lists[3].adds, "5");
EXPECT_TRUE(lists[3].subs.empty());
- EXPECT_TRUE(lists[4].name == safe_browsing_util::kCsdWhiteList);
- EXPECT_EQ(lists[4].adds, "5");
+ EXPECT_TRUE(lists[4].name == safe_browsing_util::kDownloadWhiteList);
+ EXPECT_EQ(lists[4].adds, "6");
EXPECT_TRUE(lists[4].subs.empty());
- EXPECT_TRUE(lists[5].name == safe_browsing_util::kDownloadWhiteList);
- EXPECT_EQ(lists[5].adds, "6");
- EXPECT_TRUE(lists[5].subs.empty());
database_.reset();
}
@@ -1526,45 +1524,6 @@ TEST_F(SafeBrowsingDatabaseTest, SameHostEntriesOkay) {
&listname, &prefixes, &full_hashes, now));
}
-TEST_F(SafeBrowsingDatabaseTest, BinHashInsertLookup) {
- const SBPrefix kPrefix1 = 0x31313131;
- const SBPrefix kPrefix2 = 0x32323232;
- const SBPrefix kPrefix3 = 0x33333333;
- database_.reset();
- MessageLoop loop(MessageLoop::TYPE_DEFAULT);
- SafeBrowsingStoreFile* browse_store = new SafeBrowsingStoreFile();
- SafeBrowsingStoreFile* download_store = new SafeBrowsingStoreFile();
- database_.reset(new SafeBrowsingDatabaseNew(browse_store,
- download_store,
- NULL, NULL));
- database_->Init(database_filename_);
-
- SBChunkList chunks;
- SBChunk chunk;
- // Insert one host.
- InsertAddChunkHostPrefixValue(&chunk, 1, 0, kPrefix1);
- // Insert a second host, which has the same host prefix as the first one.
- InsertAddChunkHostPrefixValue(&chunk, 1, 0, kPrefix2);
- chunks.push_back(chunk);
-
- // Insert the testing chunks into database.
- std::vector<SBListChunkRanges> lists;
- EXPECT_TRUE(database_->UpdateStarted(&lists));
- database_->InsertChunks(safe_browsing_util::kBinHashList, chunks);
- database_->UpdateFinished(true);
-
- GetListsInfo(&lists);
- ASSERT_EQ(4U, lists.size());
- EXPECT_EQ(std::string(safe_browsing_util::kBinHashList), lists[3].name);
- EXPECT_EQ("1", lists[3].adds);
- EXPECT_TRUE(lists[3].subs.empty());
-
- EXPECT_TRUE(database_->ContainsDownloadHashPrefix(kPrefix1));
- EXPECT_TRUE(database_->ContainsDownloadHashPrefix(kPrefix2));
- EXPECT_FALSE(database_->ContainsDownloadHashPrefix(kPrefix3));
- database_.reset();
-}
-
// Test that an empty update doesn't actually update the database.
// This isn't a functionality requirement, but it is a useful
// optimization.
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc
index efeb84e..4f10429 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -168,7 +168,9 @@ namespace safe_browsing_util {
const char kMalwareList[] = "goog-malware-shavar";
const char kPhishingList[] = "goog-phish-shavar";
const char kBinUrlList[] = "goog-badbinurl-shavar";
-const char kBinHashList[] = "goog-badbin-digestvar";
+// We don't use the bad binary digest list anymore. Use a fake listname to be
+// sure we don't request it accidentally.
+const char kBinHashList[] = "goog-badbin-digestvar-disabled";
const char kCsdWhiteList[] = "goog-csdwhite-sha256";
const char kDownloadWhiteList[] = "goog-downloadwhite-digest256";