| 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/v4_get_hash_protocol_manager.h" | 5 #include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // Adds an entry with an ignored ThreatEntryType. | 254 // Adds an entry with an ignored ThreatEntryType. |
| 255 TEST_F(SafeBrowsingV4GetHashProtocolManagerTest, | 255 TEST_F(SafeBrowsingV4GetHashProtocolManagerTest, |
| 256 TestParseHashResponseWrongThreatEntryType) { | 256 TestParseHashResponseWrongThreatEntryType) { |
| 257 std::unique_ptr<V4GetHashProtocolManager> pm(CreateProtocolManager()); | 257 std::unique_ptr<V4GetHashProtocolManager> pm(CreateProtocolManager()); |
| 258 | 258 |
| 259 base::Time now = base::Time::UnixEpoch(); | 259 base::Time now = base::Time::UnixEpoch(); |
| 260 SetTestClock(now, pm.get()); | 260 SetTestClock(now, pm.get()); |
| 261 | 261 |
| 262 FindFullHashesResponse res; | 262 FindFullHashesResponse res; |
| 263 res.mutable_negative_cache_duration()->set_seconds(600); | 263 res.mutable_negative_cache_duration()->set_seconds(600); |
| 264 res.add_matches()->set_threat_entry_type(BINARY_DIGEST); | 264 res.add_matches()->set_threat_entry_type(EXECUTABLE); |
| 265 | 265 |
| 266 // Serialize. | 266 // Serialize. |
| 267 std::string res_data; | 267 std::string res_data; |
| 268 res.SerializeToString(&res_data); | 268 res.SerializeToString(&res_data); |
| 269 | 269 |
| 270 std::vector<SBFullHashResult> full_hashes; | 270 std::vector<SBFullHashResult> full_hashes; |
| 271 base::Time cache_expire; | 271 base::Time cache_expire; |
| 272 EXPECT_FALSE(pm->ParseHashResponse(res_data, &full_hashes, &cache_expire)); | 272 EXPECT_FALSE(pm->ParseHashResponse(res_data, &full_hashes, &cache_expire)); |
| 273 | 273 |
| 274 EXPECT_EQ(now + base::TimeDelta::FromSeconds(600), cache_expire); | 274 EXPECT_EQ(now + base::TimeDelta::FromSeconds(600), cache_expire); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 // Serialize. | 410 // Serialize. |
| 411 std::string res_data; | 411 std::string res_data; |
| 412 res.SerializeToString(&res_data); | 412 res.SerializeToString(&res_data); |
| 413 | 413 |
| 414 std::vector<SBFullHashResult> full_hashes; | 414 std::vector<SBFullHashResult> full_hashes; |
| 415 base::Time cache_expire; | 415 base::Time cache_expire; |
| 416 EXPECT_FALSE(pm->ParseHashResponse(res_data, &full_hashes, &cache_expire)); | 416 EXPECT_FALSE(pm->ParseHashResponse(res_data, &full_hashes, &cache_expire)); |
| 417 } | 417 } |
| 418 | 418 |
| 419 } // namespace safe_browsing | 419 } // namespace safe_browsing |
| OLD | NEW |