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

Side by Side Diff: chrome/browser/safe_browsing/prefix_set_unittest.cc

Issue 10892016: Strip out safe-browsing prefix-set checksumming code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Oops, remove unit test for deleted code. Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/safe_browsing/prefix_set.h" 5 #include "chrome/browser/safe_browsing/prefix_set.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // Add some junk to the trunk. 427 // Add some junk to the trunk.
428 file_util::ScopedFILE file(file_util::OpenFile(filename, "ab")); 428 file_util::ScopedFILE file(file_util::OpenFile(filename, "ab"));
429 const char buf[] = "im in ur base, killing ur d00dz."; 429 const char buf[] = "im in ur base, killing ur d00dz.";
430 ASSERT_EQ(strlen(buf), fwrite(buf, 1, strlen(buf), file.get())); 430 ASSERT_EQ(strlen(buf), fwrite(buf, 1, strlen(buf), file.get()));
431 file.reset(); 431 file.reset();
432 scoped_ptr<safe_browsing::PrefixSet> 432 scoped_ptr<safe_browsing::PrefixSet>
433 prefix_set(safe_browsing::PrefixSet::LoadFile(filename)); 433 prefix_set(safe_browsing::PrefixSet::LoadFile(filename));
434 ASSERT_FALSE(prefix_set.get()); 434 ASSERT_FALSE(prefix_set.get());
435 } 435 }
436 436
437 // TODO(shess): Remove once the problem is debugged. But, until then,
438 // make sure the accessors work!
439 TEST_F(PrefixSetTest, DebuggingAccessors) {
440 std::vector<SBPrefix> prefixes;
441 std::unique_copy(shared_prefixes_.begin(), shared_prefixes_.end(),
442 std::back_inserter(prefixes));
443 safe_browsing::PrefixSet prefix_set(prefixes);
444
445 EXPECT_EQ(prefixes.size(), prefix_set.GetSize());
446 EXPECT_FALSE(prefix_set.IsDeltaAt(0));
447 for (size_t i = 1; i < prefixes.size(); ++i) {
448 const int delta = prefixes[i] - prefixes[i - 1];
449 if (delta > 0xFFFF) {
450 EXPECT_FALSE(prefix_set.IsDeltaAt(i));
451 } else {
452 ASSERT_TRUE(prefix_set.IsDeltaAt(i));
453 EXPECT_EQ(delta, prefix_set.DeltaAt(i));
454 }
455 }
456 }
457
458 } // namespace 437 } // namespace
OLDNEW
« 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