Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/safe_browsing/database_manager_unittest.cc

Issue 586793003: Safebrowsing: Honor the metadata from malware fullhash results in SB API 3.0. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes for sky Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/database_manager.cc ('k') | chrome/browser/safe_browsing/metadata.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698