| OLD | NEW |
| 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 // Unit tests for the SafeBrowsing storage system. | 5 // Unit tests for the SafeBrowsing storage system. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/safe_browsing_database.h" | 7 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
| 8 | 8 |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 class SafeBrowsingDatabaseTest : public PlatformTest { | 248 class SafeBrowsingDatabaseTest : public PlatformTest { |
| 249 public: | 249 public: |
| 250 SafeBrowsingDatabaseTest() : task_runner_(new base::TestSimpleTaskRunner) {} | 250 SafeBrowsingDatabaseTest() : task_runner_(new base::TestSimpleTaskRunner) {} |
| 251 | 251 |
| 252 void SetUp() override { | 252 void SetUp() override { |
| 253 PlatformTest::SetUp(); | 253 PlatformTest::SetUp(); |
| 254 | 254 |
| 255 // Setup a database in a temporary directory. | 255 // Setup a database in a temporary directory. |
| 256 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 256 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 257 database_filename_ = | 257 database_filename_ = |
| 258 temp_dir_.path().AppendASCII("SafeBrowsingTestDatabase"); | 258 temp_dir_.GetPath().AppendASCII("SafeBrowsingTestDatabase"); |
| 259 | 259 |
| 260 ResetAndReloadFullDatabase(); | 260 ResetAndReloadFullDatabase(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void TearDown() override { | 263 void TearDown() override { |
| 264 database_.reset(); | 264 database_.reset(); |
| 265 | 265 |
| 266 PlatformTest::TearDown(); | 266 PlatformTest::TearDown(); |
| 267 } | 267 } |
| 268 | 268 |
| (...skipping 2099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 ASSERT_EQ(1U, prefix_hits.size()); | 2368 ASSERT_EQ(1U, prefix_hits.size()); |
| 2369 EXPECT_EQ(SBPrefixForString(kExampleCollision), prefix_hits[0]); | 2369 EXPECT_EQ(SBPrefixForString(kExampleCollision), prefix_hits[0]); |
| 2370 EXPECT_TRUE(cache_hits.empty()); | 2370 EXPECT_TRUE(cache_hits.empty()); |
| 2371 | 2371 |
| 2372 // This prefix collides, but no full hash match. | 2372 // This prefix collides, but no full hash match. |
| 2373 EXPECT_FALSE(database_->ContainsBrowseUrl( | 2373 EXPECT_FALSE(database_->ContainsBrowseUrl( |
| 2374 GURL(std::string("http://") + kExampleFine), &prefix_hits, &cache_hits)); | 2374 GURL(std::string("http://") + kExampleFine), &prefix_hits, &cache_hits)); |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 } // namespace safe_browsing | 2377 } // namespace safe_browsing |
| OLD | NEW |