OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This test creates a safebrowsing service using test safebrowsing database | 5 // This test creates a safebrowsing service using test safebrowsing database |
6 // and a test protocol manager. It is used to test logics in safebrowsing | 6 // and a test protocol manager. It is used to test logics in safebrowsing |
7 // service. | 7 // service. |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1303 void ForceUpdate() { | 1303 void ForceUpdate() { |
1304 sb_service_->protocol_manager()->ForceScheduleNextUpdate( | 1304 sb_service_->protocol_manager()->ForceScheduleNextUpdate( |
1305 base::TimeDelta::FromSeconds(0)); | 1305 base::TimeDelta::FromSeconds(0)); |
1306 } | 1306 } |
1307 | 1307 |
1308 scoped_refptr<SafeBrowsingService> sb_service_; | 1308 scoped_refptr<SafeBrowsingService> sb_service_; |
1309 | 1309 |
1310 private: | 1310 private: |
1311 static scoped_ptr<net::test_server::HttpResponse> HandleRequest( | 1311 static scoped_ptr<net::test_server::HttpResponse> HandleRequest( |
1312 const net::test_server::HttpRequest& request) { | 1312 const net::test_server::HttpRequest& request) { |
1313 if (!base::StartsWithASCII(request.relative_url, "/testpath/", true)) { | 1313 if (!base::StartsWith(request.relative_url, "/testpath/", |
| 1314 base::CompareCase::SENSITIVE)) { |
1314 ADD_FAILURE() << "bad path"; | 1315 ADD_FAILURE() << "bad path"; |
1315 return nullptr; | 1316 return nullptr; |
1316 } | 1317 } |
1317 | 1318 |
1318 auto cookie_it = request.headers.find("Cookie"); | 1319 auto cookie_it = request.headers.find("Cookie"); |
1319 if (cookie_it == request.headers.end()) { | 1320 if (cookie_it == request.headers.end()) { |
1320 ADD_FAILURE() << "no cookie header"; | 1321 ADD_FAILURE() << "no cookie header"; |
1321 return nullptr; | 1322 return nullptr; |
1322 } | 1323 } |
1323 | 1324 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 content::WindowedNotificationObserver observer( | 1357 content::WindowedNotificationObserver observer( |
1357 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 1358 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
1358 content::Source<SafeBrowsingDatabaseManager>( | 1359 content::Source<SafeBrowsingDatabaseManager>( |
1359 sb_service_->database_manager().get())); | 1360 sb_service_->database_manager().get())); |
1360 BrowserThread::PostTask( | 1361 BrowserThread::PostTask( |
1361 BrowserThread::IO, | 1362 BrowserThread::IO, |
1362 FROM_HERE, | 1363 FROM_HERE, |
1363 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); | 1364 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); |
1364 observer.Wait(); | 1365 observer.Wait(); |
1365 } | 1366 } |
OLD | NEW |