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

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

Issue 4822002: Send malware reports when a user opts-in from the safe browsing interstitial ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&" 213 EXPECT_EQ("http://info.prefix.com/foo/report?client=unittest&appver=1.0&"
214 "pver=2.2&additional_query&evts=phishblhit&" 214 "pver=2.2&additional_query&evts=phishblhit&"
215 "evtd=http%3A%2F%2Fmalicious.url.com%2F&" 215 "evtd=http%3A%2F%2Fmalicious.url.com%2F&"
216 "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer." 216 "evtr=http%3A%2F%2Fpage.url.com%2F&evhr=http%3A%2F%2Freferrer."
217 "url.com%2F&evtb=0", 217 "url.com%2F&evtb=0",
218 pm.SafeBrowsingReportUrl( 218 pm.SafeBrowsingReportUrl(
219 malicious_url, page_url, referrer_url, 219 malicious_url, page_url, referrer_url,
220 false, SafeBrowsingService::URL_PHISHING).spec()); 220 false, SafeBrowsingService::URL_PHISHING).spec());
221 } 221 }
222 222
223 TEST_F(SafeBrowsingProtocolManagerTest, TestMalwareClientUrl) {
224 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL,
225 kInfoUrlPrefix, kMacKeyUrlPrefix, false);
226
227 pm.version_ = kAppVer;
228 pm.set_additional_query(kAdditionalQuery); // AdditionalQuery is not used.
229 EXPECT_EQ("https://key.prefix.com/bar/clientreport/malware?"
230 "client=unittest&appver=1.0&pver=1.0",
231 pm.MalwareClientReportUrl().spec());
232 }
233
223 TEST_F(SafeBrowsingProtocolManagerTest, TestMacKeyUrl) { 234 TEST_F(SafeBrowsingProtocolManagerTest, TestMacKeyUrl) {
224 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL, 235 SafeBrowsingProtocolManager pm(NULL, kClient, kClientKey, kWrappedKey, NULL,
225 kInfoUrlPrefix, kMacKeyUrlPrefix, false); 236 kInfoUrlPrefix, kMacKeyUrlPrefix, false);
226 pm.version_ = kAppVer; 237 pm.version_ = kAppVer;
227 238
228 EXPECT_EQ("https://key.prefix.com/bar/newkey?client=unittest&appver=1.0&" 239 EXPECT_EQ("https://key.prefix.com/bar/newkey?client=unittest&appver=1.0&"
229 "pver=2.2", pm.MacKeyUrl().spec()); 240 "pver=2.2", pm.MacKeyUrl().spec());
230 241
231 pm.set_additional_query(kAdditionalQuery); 242 pm.set_additional_query(kAdditionalQuery);
232 EXPECT_EQ("https://key.prefix.com/bar/newkey?client=unittest&appver=1.0&" 243 EXPECT_EQ("https://key.prefix.com/bar/newkey?client=unittest&appver=1.0&"
(...skipping 22 matching lines...) Expand all
255 pm.set_additional_query(kAdditionalQuery); 266 pm.set_additional_query(kAdditionalQuery);
256 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query", 267 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query",
257 pm.NextChunkUrl(url_partial).spec()); 268 pm.NextChunkUrl(url_partial).spec());
258 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query", 269 EXPECT_EQ("http://localhost:1234/foo/bar?foo&additional_query",
259 pm.NextChunkUrl(url_http_full).spec()); 270 pm.NextChunkUrl(url_http_full).spec());
260 EXPECT_EQ("https://localhost:1234/foo/bar?foo&additional_query", 271 EXPECT_EQ("https://localhost:1234/foo/bar?foo&additional_query",
261 pm.NextChunkUrl(url_https_full).spec()); 272 pm.NextChunkUrl(url_https_full).spec());
262 EXPECT_EQ("https://localhost:1234/foo/bar?additional_query", 273 EXPECT_EQ("https://localhost:1234/foo/bar?additional_query",
263 pm.NextChunkUrl(url_https_no_query).spec()); 274 pm.NextChunkUrl(url_https_no_query).spec());
264 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698