| 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 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 void ForceUpdate() { | 1296 void ForceUpdate() { |
| 1297 sb_service_->protocol_manager()->ForceScheduleNextUpdate( | 1297 sb_service_->protocol_manager()->ForceScheduleNextUpdate( |
| 1298 base::TimeDelta::FromSeconds(0)); | 1298 base::TimeDelta::FromSeconds(0)); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 scoped_refptr<SafeBrowsingService> sb_service_; | 1301 scoped_refptr<SafeBrowsingService> sb_service_; |
| 1302 | 1302 |
| 1303 private: | 1303 private: |
| 1304 static scoped_ptr<net::test_server::HttpResponse> HandleRequest( | 1304 static scoped_ptr<net::test_server::HttpResponse> HandleRequest( |
| 1305 const net::test_server::HttpRequest& request) { | 1305 const net::test_server::HttpRequest& request) { |
| 1306 if (!StartsWithASCII(request.relative_url, "/testpath/", true)) { | 1306 if (!base::StartsWithASCII(request.relative_url, "/testpath/", true)) { |
| 1307 ADD_FAILURE() << "bad path"; | 1307 ADD_FAILURE() << "bad path"; |
| 1308 return nullptr; | 1308 return nullptr; |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 auto cookie_it = request.headers.find("Cookie"); | 1311 auto cookie_it = request.headers.find("Cookie"); |
| 1312 if (cookie_it == request.headers.end()) { | 1312 if (cookie_it == request.headers.end()) { |
| 1313 ADD_FAILURE() << "no cookie header"; | 1313 ADD_FAILURE() << "no cookie header"; |
| 1314 return nullptr; | 1314 return nullptr; |
| 1315 } | 1315 } |
| 1316 | 1316 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 content::WindowedNotificationObserver observer( | 1349 content::WindowedNotificationObserver observer( |
| 1350 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, | 1350 chrome::NOTIFICATION_SAFE_BROWSING_UPDATE_COMPLETE, |
| 1351 content::Source<SafeBrowsingDatabaseManager>( | 1351 content::Source<SafeBrowsingDatabaseManager>( |
| 1352 sb_service_->database_manager().get())); | 1352 sb_service_->database_manager().get())); |
| 1353 BrowserThread::PostTask( | 1353 BrowserThread::PostTask( |
| 1354 BrowserThread::IO, | 1354 BrowserThread::IO, |
| 1355 FROM_HERE, | 1355 FROM_HERE, |
| 1356 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); | 1356 base::Bind(&SafeBrowsingDatabaseManagerCookieTest::ForceUpdate, this)); |
| 1357 observer.Wait(); | 1357 observer.Wait(); |
| 1358 } | 1358 } |
| OLD | NEW |