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 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 // notification. | 1680 // notification. |
1681 } | 1681 } |
1682 | 1682 |
1683 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); | 1683 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); |
1684 EXPECT_FALSE(HasClientDownloadRequest()); | 1684 EXPECT_FALSE(HasClientDownloadRequest()); |
1685 } | 1685 } |
1686 | 1686 |
1687 TEST_F(DownloadProtectionServiceTest, | 1687 TEST_F(DownloadProtectionServiceTest, |
1688 TestDownloadItemDestroyedDuringWhitelistCheck) { | 1688 TestDownloadItemDestroyedDuringWhitelistCheck) { |
1689 net::TestURLFetcherFactory factory; | 1689 net::TestURLFetcherFactory factory; |
1690 scoped_ptr<content::MockDownloadItem> item(new content::MockDownloadItem); | 1690 std::unique_ptr<content::MockDownloadItem> item( |
| 1691 new content::MockDownloadItem); |
1691 PrepareBasicDownloadItem( | 1692 PrepareBasicDownloadItem( |
1692 item.get(), | 1693 item.get(), |
1693 {"http://www.evil.com/bla.exe"}, // url_chain | 1694 {"http://www.evil.com/bla.exe"}, // url_chain |
1694 "http://www.google.com/", // referrer | 1695 "http://www.google.com/", // referrer |
1695 FILE_PATH_LITERAL("a.tmp"), // tmp_path | 1696 FILE_PATH_LITERAL("a.tmp"), // tmp_path |
1696 FILE_PATH_LITERAL("a.exe")); // final_path | 1697 FILE_PATH_LITERAL("a.exe")); // final_path |
1697 GURL tab_url("http://www.google.com/tab"); | 1698 GURL tab_url("http://www.google.com/tab"); |
1698 EXPECT_CALL(*item, GetTabUrl()).WillRepeatedly(ReturnRef(tab_url)); | 1699 EXPECT_CALL(*item, GetTabUrl()).WillRepeatedly(ReturnRef(tab_url)); |
1699 | 1700 |
1700 EXPECT_CALL(*sb_service_->mock_database_manager(), | 1701 EXPECT_CALL(*sb_service_->mock_database_manager(), |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1913 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 1914 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
1914 base::Unretained(this))); | 1915 base::Unretained(this))); |
1915 MessageLoop::current()->Run(); | 1916 MessageLoop::current()->Run(); |
1916 | 1917 |
1917 EXPECT_FALSE(HasClientDownloadRequest()); | 1918 EXPECT_FALSE(HasClientDownloadRequest()); |
1918 // Overriden by flag: | 1919 // Overriden by flag: |
1919 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); | 1920 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); |
1920 } | 1921 } |
1921 | 1922 |
1922 } // namespace safe_browsing | 1923 } // namespace safe_browsing |
OLD | NEW |