| 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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 TestSafeBrowsingDatabase* db = db_factory_.GetDb(); | 366 TestSafeBrowsingDatabase* db = db_factory_.GetDb(); |
| 367 SBFullHash full_hash; | 367 SBFullHash full_hash; |
| 368 safe_browsing_util::StringToSBFullHash(digest, &full_hash); | 368 safe_browsing_util::StringToSBFullHash(digest, &full_hash); |
| 369 db->AddDownloadPrefix(full_hash.prefix); | 369 db->AddDownloadPrefix(full_hash.prefix); |
| 370 | 370 |
| 371 TestProtocolManager* pm = pm_factory_.GetProtocolManager(); | 371 TestProtocolManager* pm = pm_factory_.GetProtocolManager(); |
| 372 pm->SetGetFullHashResponse(hash_result); | 372 pm->SetGetFullHashResponse(hash_result); |
| 373 } | 373 } |
| 374 | 374 |
| 375 bool ShowingInterstitialPage() { | 375 bool ShowingInterstitialPage() { |
| 376 WebContents* contents = browser()->GetSelectedWebContents(); | 376 WebContents* contents = browser()->GetActiveWebContents(); |
| 377 InterstitialPage* interstitial_page = contents->GetInterstitialPage(); | 377 InterstitialPage* interstitial_page = contents->GetInterstitialPage(); |
| 378 return interstitial_page != NULL; | 378 return interstitial_page != NULL; |
| 379 } | 379 } |
| 380 | 380 |
| 381 void IntroduceGetHashDelay(int64 ms) { | 381 void IntroduceGetHashDelay(int64 ms) { |
| 382 pm_factory_.GetProtocolManager()->IntroduceDelay(ms); | 382 pm_factory_.GetProtocolManager()->IntroduceDelay(ms); |
| 383 } | 383 } |
| 384 | 384 |
| 385 int64 DownloadUrlCheckTimeout(SafeBrowsingService* sb_service) { | 385 int64 DownloadUrlCheckTimeout(SafeBrowsingService* sb_service) { |
| 386 return sb_service->download_urlcheck_timeout_ms_; | 386 return sb_service->download_urlcheck_timeout_ms_; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 | 759 |
| 760 // Delete the Profile. SBS stops again. | 760 // Delete the Profile. SBS stops again. |
| 761 pref_service2 = NULL; | 761 pref_service2 = NULL; |
| 762 profile2.reset(); | 762 profile2.reset(); |
| 763 WaitForIOThread(); | 763 WaitForIOThread(); |
| 764 EXPECT_FALSE(sb_service->enabled()); | 764 EXPECT_FALSE(sb_service->enabled()); |
| 765 EXPECT_FALSE(csd_service->enabled()); | 765 EXPECT_FALSE(csd_service->enabled()); |
| 766 } | 766 } |
| 767 | 767 |
| 768 } // namespace | 768 } // namespace |
| OLD | NEW |