| 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 #include "chrome/browser/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 if (!has_result_) | 511 if (!has_result_) |
| 512 return testing::AssertionFailure() << "No result"; | 512 return testing::AssertionFailure() << "No result"; |
| 513 has_result_ = false; | 513 has_result_ = false; |
| 514 return result_ == expected ? | 514 return result_ == expected ? |
| 515 testing::AssertionSuccess() : | 515 testing::AssertionSuccess() : |
| 516 testing::AssertionFailure() << "Expected " << expected << | 516 testing::AssertionFailure() << "Expected " << expected << |
| 517 ", got " << result_; | 517 ", got " << result_; |
| 518 } | 518 } |
| 519 | 519 |
| 520 void SetExtendedReportingPreference(bool is_extended_reporting) { | 520 void SetExtendedReportingPreference(bool is_extended_reporting) { |
| 521 profile_->GetPrefs()->SetBoolean(GetExtendedReportingPrefName(), | 521 SetExtendedReportingPref(profile_->GetPrefs(), is_extended_reporting); |
| 522 is_extended_reporting); | |
| 523 } | 522 } |
| 524 | 523 |
| 525 // Check scenarios where we should/shouldn't send a report for | 524 // Check scenarios where we should/shouldn't send a report for |
| 526 // a corrupted zip. | 525 // a corrupted zip. |
| 527 void CheckClientDownloadReportCorruptArchive(ArchiveType type, | 526 void CheckClientDownloadReportCorruptArchive(ArchiveType type, |
| 528 bool is_extended_reporting, | 527 bool is_extended_reporting, |
| 529 bool is_incognito); | 528 bool is_incognito); |
| 530 | 529 |
| 531 protected: | 530 protected: |
| 532 // This will effectivly mask the global Singleton while this is in scope. | 531 // This will effectivly mask the global Singleton while this is in scope. |
| (...skipping 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2363 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 2362 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
| 2364 base::Unretained(this), run_loop.QuitClosure())); | 2363 base::Unretained(this), run_loop.QuitClosure())); |
| 2365 run_loop.Run(); | 2364 run_loop.Run(); |
| 2366 | 2365 |
| 2367 EXPECT_FALSE(HasClientDownloadRequest()); | 2366 EXPECT_FALSE(HasClientDownloadRequest()); |
| 2368 // Overriden by flag: | 2367 // Overriden by flag: |
| 2369 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); | 2368 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); |
| 2370 } | 2369 } |
| 2371 | 2370 |
| 2372 } // namespace safe_browsing | 2371 } // namespace safe_browsing |
| OLD | NEW |