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

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

Issue 3028040: Report malware redirectors as well. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "base/logging.h" 6 #include "base/logging.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "chrome/browser/safe_browsing/protocol_manager.h" 9 #include "chrome/browser/safe_browsing/protocol_manager.h"
10 10
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL, 197 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL,
198 kInfoUrlPrefix, kMacKeyUrlPrefix, false); 198 kInfoUrlPrefix, kMacKeyUrlPrefix, false);
199 pm.version_ = kAppVer; 199 pm.version_ = kAppVer;
200 200
201 GURL malware_url("http://malware.url.com"); 201 GURL malware_url("http://malware.url.com");
202 GURL page_url("http://page.url.com"); 202 GURL page_url("http://page.url.com");
203 GURL referrer_url("http://referrer.url.com"); 203 GURL referrer_url("http://referrer.url.com");
204 EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&" 204 EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&"
205 "pver=2.2&evts=malblhit&evtd=http%3A%2F%2Fmalware.url.com%2F&" 205 "pver=2.2&evts=malblhit&evtd=http%3A%2F%2Fmalware.url.com%2F&"
206 "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer." 206 "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer."
207 "url.com%2F", 207 "url.com%2F&evtb=1",
208 pm.MalwareReportUrl(malware_url, page_url, referrer_url).spec()); 208 pm.MalwareReportUrl(malware_url, page_url, referrer_url,
209 true).spec());
209 210
210 pm.set_additional_query("&additional_query"); 211 pm.set_additional_query("&additional_query");
211 EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&" 212 EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&"
212 "pver=2.2&additional_query&evts=malblhit&" 213 "pver=2.2&additional_query&evts=malblhit&"
213 "evtd=http%3A%2F%2Fmalware.url.com%2F&" 214 "evtd=http%3A%2F%2Fmalware.url.com%2F&"
214 "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer." 215 "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer."
215 "url.com%2F", 216 "url.com%2F&evtb=0",
216 pm.MalwareReportUrl(malware_url, page_url, referrer_url).spec()); 217 pm.MalwareReportUrl(malware_url, page_url, referrer_url,
218 false).spec());
217 } 219 }
218 220
219 TEST_F(SafeBrowsingProtocolManagerTest, TestMacKeyUrl) { 221 TEST_F(SafeBrowsingProtocolManagerTest, TestMacKeyUrl) {
220 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL, 222 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL,
221 kInfoUrlPrefix, kMacKeyUrlPrefix, false); 223 kInfoUrlPrefix, kMacKeyUrlPrefix, false);
222 pm.version_ = kAppVer; 224 pm.version_ = kAppVer;
223 225
224 EXPECT_EQ("https://key.prefix.com/bar/newkey?client=unittest&appver=1.0&" 226 EXPECT_EQ("https://key.prefix.com/bar/newkey?client=unittest&appver=1.0&"
225 "pver=2.2", pm.MacKeyUrl().spec()); 227 "pver=2.2", pm.MacKeyUrl().spec());
226 228
(...skipping 19 matching lines...) Expand all
246 pm.NextChunkUrl(url_https_full).spec()); 248 pm.NextChunkUrl(url_https_full).spec());
247 249
248 pm.set_additional_query("&additional_query"); 250 pm.set_additional_query("&additional_query");
249 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query", 251 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query",
250 pm.NextChunkUrl(url_partial).spec()); 252 pm.NextChunkUrl(url_partial).spec());
251 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query", 253 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query",
252 pm.NextChunkUrl(url_http_full).spec()); 254 pm.NextChunkUrl(url_http_full).spec());
253 EXPECT_EQ("https://localhost:1234/foo/bar?foo&additional_query", 255 EXPECT_EQ("https://localhost:1234/foo/bar?foo&additional_query",
254 pm.NextChunkUrl(url_https_full).spec()); 256 pm.NextChunkUrl(url_https_full).spec());
255 } 257 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/protocol_manager.cc ('k') | chrome/browser/safe_browsing/safe_browsing_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698