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

Unified Diff: chrome/browser/safe_browsing/prefix_set_unittest.cc

Issue 6765035: More PrefixSet diagnostics. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/safe_browsing/prefix_set.cc ('k') | chrome/browser/safe_browsing/safe_browsing_database.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/prefix_set_unittest.cc
diff --git a/chrome/browser/safe_browsing/prefix_set_unittest.cc b/chrome/browser/safe_browsing/prefix_set_unittest.cc
index 7224e8543cd6f0a2809f1f524867026342368129..f0002b7fadb627b8b351616f281fb8589a2c5a8b 100644
--- a/chrome/browser/safe_browsing/prefix_set_unittest.cc
+++ b/chrome/browser/safe_browsing/prefix_set_unittest.cc
@@ -432,4 +432,25 @@ TEST_F(PrefixSetTest, CorruptionExcess) {
ASSERT_FALSE(prefix_set.get());
}
+// TODO(shess): Remove once the problem is debugged. But, until then,
+// make sure the accessors work!
+TEST_F(PrefixSetTest, DebuggingAccessors) {
+ std::vector<SBPrefix> prefixes;
+ std::unique_copy(shared_prefixes_.begin(), shared_prefixes_.end(),
+ std::back_inserter(prefixes));
+ safe_browsing::PrefixSet prefix_set(prefixes);
+
+ EXPECT_EQ(prefixes.size(), prefix_set.GetSize());
+ EXPECT_FALSE(prefix_set.IsDeltaAt(0));
+ for (size_t i = 1; i < prefixes.size(); ++i) {
+ const int delta = prefixes[i] - prefixes[i - 1];
+ if (delta > 0xFFFF) {
+ EXPECT_FALSE(prefix_set.IsDeltaAt(i));
+ } else {
+ ASSERT_TRUE(prefix_set.IsDeltaAt(i));
+ EXPECT_EQ(delta, prefix_set.DeltaAt(i));
+ }
+ }
+}
+
} // namespace
« no previous file with comments | « chrome/browser/safe_browsing/prefix_set.cc ('k') | chrome/browser/safe_browsing/safe_browsing_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698