Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/safe_browsing_db/database_manager.h" | 5 #include "components/safe_browsing_db/database_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 251 pm->SetDelaySeconds(100); | 251 pm->SetDelaySeconds(100); |
| 252 | 252 |
| 253 EXPECT_FALSE(db_manager_->CheckApiBlacklistUrl(url, &client)); | 253 EXPECT_FALSE(db_manager_->CheckApiBlacklistUrl(url, &client)); |
| 254 EXPECT_TRUE(db_manager_->CancelApiCheck(&client)); | 254 EXPECT_TRUE(db_manager_->CancelApiCheck(&client)); |
| 255 base::RunLoop().RunUntilIdle(); | 255 base::RunLoop().RunUntilIdle(); |
| 256 | 256 |
| 257 const std::set<std::string>& permissions = client.GetBlockedPermissions(); | 257 const std::set<std::string>& permissions = client.GetBlockedPermissions(); |
| 258 EXPECT_EQ(0ul, permissions.size()); | 258 EXPECT_EQ(0ul, permissions.size()); |
| 259 EXPECT_FALSE(client.callback_invoked()); | 259 EXPECT_FALSE(client.callback_invoked()); |
| 260 } | 260 } |
| 261 | 261 /* |
|
Nathan Parker
2016/08/15 19:54:47
What's this for? This should be moved or removed.
| |
| 262 TEST_F(SafeBrowsingDatabaseManagerTest, ResultsAreCached) { | 262 TEST_F(SafeBrowsingDatabaseManagerTest, ResultsAreCached) { |
| 263 TestClient client; | 263 TestClient client; |
| 264 const GURL url("https://www.example.com/more"); | 264 const GURL url("https://www.example.com/more"); |
| 265 TestV4GetHashProtocolManager* pm = static_cast<TestV4GetHashProtocolManager*>( | 265 TestV4GetHashProtocolManager* pm = static_cast<TestV4GetHashProtocolManager*>( |
| 266 db_manager_->v4_get_hash_protocol_manager_); | 266 db_manager_->v4_get_hash_protocol_manager_); |
| 267 base::Time now = base::Time::UnixEpoch(); | 267 base::Time now = base::Time::UnixEpoch(); |
| 268 SBFullHashResult full_hash_result; | 268 SBFullHashResult full_hash_result; |
| 269 full_hash_result.hash = SBFullHashForString("example.com/"); | 269 full_hash_result.hash = SBFullHashForString("example.com/"); |
| 270 full_hash_result.metadata.api_permissions.insert("GEOLOCATION"); | 270 full_hash_result.metadata.api_permissions.insert("GEOLOCATION"); |
| 271 full_hash_result.cache_expire_after = now + base::TimeDelta::FromMinutes(3); | 271 full_hash_result.cache_expire_after = now + base::TimeDelta::FromMinutes(3); |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 EXPECT_EQ(1ul, cache.size()); | 529 EXPECT_EQ(1ul, cache.size()); |
| 530 entry = cache.find(full_hash_result.hash.prefix); | 530 entry = cache.find(full_hash_result.hash.prefix); |
| 531 EXPECT_NE(cache.end(), entry); | 531 EXPECT_NE(cache.end(), entry); |
| 532 EXPECT_EQ(epoch, entry->second.expire_after); | 532 EXPECT_EQ(epoch, entry->second.expire_after); |
| 533 EXPECT_EQ(1ul, entry->second.full_hashes.size()); | 533 EXPECT_EQ(1ul, entry->second.full_hashes.size()); |
| 534 EXPECT_TRUE(SBFullHashEqual(full_hash_result.hash, | 534 EXPECT_TRUE(SBFullHashEqual(full_hash_result.hash, |
| 535 entry->second.full_hashes[0].hash)); | 535 entry->second.full_hashes[0].hash)); |
| 536 EXPECT_EQ(base::Time::Max(), | 536 EXPECT_EQ(base::Time::Max(), |
| 537 entry->second.full_hashes[0].cache_expire_after); | 537 entry->second.full_hashes[0].cache_expire_after); |
| 538 } | 538 } |
| 539 */ | |
| 539 | 540 |
| 540 } // namespace safe_browsing | 541 } // namespace safe_browsing |
| OLD | NEW |