| 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 | 5 |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 | 446 |
| 447 std::vector<SBFullHashResult> full_hashes; | 447 std::vector<SBFullHashResult> full_hashes; |
| 448 base::TimeDelta cache_lifetime; | 448 base::TimeDelta cache_lifetime; |
| 449 pm->ParseV4HashResponse(res_data, &full_hashes, &cache_lifetime); | 449 pm->ParseV4HashResponse(res_data, &full_hashes, &cache_lifetime); |
| 450 | 450 |
| 451 EXPECT_EQ(base::TimeDelta::FromSeconds(600), cache_lifetime); | 451 EXPECT_EQ(base::TimeDelta::FromSeconds(600), cache_lifetime); |
| 452 // THere should be no hash results. | 452 // THere should be no hash results. |
| 453 EXPECT_EQ(0ul, full_hashes.size()); | 453 EXPECT_EQ(0ul, full_hashes.size()); |
| 454 } | 454 } |
| 455 | 455 |
| 456 // Adds an entry with an SOCIAL_ENGINEERING threat type. | 456 // Adds an entry with a SOCIAL_ENGINEERING threat type. |
| 457 TEST_F(SafeBrowsingProtocolManagerTest, | 457 TEST_F(SafeBrowsingProtocolManagerTest, |
| 458 TestParseV4HashResponseSocialEngineeringThreatType) { | 458 TestParseV4HashResponseSocialEngineeringThreatType) { |
| 459 scoped_ptr<SafeBrowsingProtocolManager> pm(CreateProtocolManager(NULL)); | 459 scoped_ptr<SafeBrowsingProtocolManager> pm(CreateProtocolManager(NULL)); |
| 460 | 460 |
| 461 FindFullHashesResponse res; | 461 FindFullHashesResponse res; |
| 462 res.mutable_negative_cache_duration()->set_seconds(600); | 462 res.mutable_negative_cache_duration()->set_seconds(600); |
| 463 ThreatMatch* m = res.add_matches(); | 463 ThreatMatch* m = res.add_matches(); |
| 464 m->set_threat_type(SOCIAL_ENGINEERING); | 464 m->set_threat_type(SOCIAL_ENGINEERING); |
| 465 m->set_platform_type(CHROME_PLATFORM); | 465 m->set_platform_type(CHROME_PLATFORM); |
| 466 m->set_threat_entry_type(URL_EXPRESSION); | 466 m->set_threat_entry_type(URL_EXPRESSION); |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 | 1377 |
| 1378 EXPECT_FALSE(pm->IsUpdateScheduled()); | 1378 EXPECT_FALSE(pm->IsUpdateScheduled()); |
| 1379 | 1379 |
| 1380 // Invoke the AddChunksCallback to finish the update. | 1380 // Invoke the AddChunksCallback to finish the update. |
| 1381 runner->RunPendingTasks(); | 1381 runner->RunPendingTasks(); |
| 1382 | 1382 |
| 1383 EXPECT_TRUE(pm->IsUpdateScheduled()); | 1383 EXPECT_TRUE(pm->IsUpdateScheduled()); |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 } // namespace safe_browsing | 1386 } // namespace safe_browsing |
| OLD | NEW |