OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/safe_browsing/database_manager.h" | 10 #include "chrome/browser/safe_browsing/database_manager.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 kMalwareHostHash, full_hashes)); | 109 kMalwareHostHash, full_hashes)); |
110 | 110 |
111 EXPECT_EQ(SB_THREAT_TYPE_URL_PHISHING, | 111 EXPECT_EQ(SB_THREAT_TYPE_URL_PHISHING, |
112 SafeBrowsingDatabaseManager::GetHashThreatType( | 112 SafeBrowsingDatabaseManager::GetHashThreatType( |
113 kPhishingHostHash, full_hashes)); | 113 kPhishingHostHash, full_hashes)); |
114 | 114 |
115 EXPECT_EQ(SB_THREAT_TYPE_SAFE, | 115 EXPECT_EQ(SB_THREAT_TYPE_SAFE, |
116 SafeBrowsingDatabaseManager::GetHashThreatType( | 116 SafeBrowsingDatabaseManager::GetHashThreatType( |
117 kSafeHostHash, full_hashes)); | 117 kSafeHostHash, full_hashes)); |
118 | 118 |
| 119 size_t index = 100; |
119 EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE, | 120 EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE, |
120 SafeBrowsingDatabaseManager::GetUrlThreatType( | 121 SafeBrowsingDatabaseManager::GetUrlThreatType( |
121 kMalwareUrl, full_hashes)); | 122 kMalwareUrl, full_hashes, &index)); |
| 123 EXPECT_EQ(0U, index); |
122 | 124 |
123 EXPECT_EQ(SB_THREAT_TYPE_URL_PHISHING, | 125 EXPECT_EQ(SB_THREAT_TYPE_URL_PHISHING, |
124 SafeBrowsingDatabaseManager::GetUrlThreatType( | 126 SafeBrowsingDatabaseManager::GetUrlThreatType( |
125 kPhishingUrl, full_hashes)); | 127 kPhishingUrl, full_hashes, &index)); |
| 128 EXPECT_EQ(1U, index); |
126 | 129 |
| 130 index = 100; |
127 EXPECT_EQ(SB_THREAT_TYPE_SAFE, | 131 EXPECT_EQ(SB_THREAT_TYPE_SAFE, |
128 SafeBrowsingDatabaseManager::GetUrlThreatType( | 132 SafeBrowsingDatabaseManager::GetUrlThreatType( |
129 kSafeUrl, full_hashes)); | 133 kSafeUrl, full_hashes, &index)); |
| 134 EXPECT_EQ(100U, index); |
130 } | 135 } |
OLD | NEW |