| 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 <map> | 7 #include <map> | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" | 
| 11 #include "base/bind.h" | 11 #include "base/bind.h" | 
| 12 #include "base/callback.h" | 12 #include "base/callback.h" | 
| 13 #include "base/file_util.h" | 13 #include "base/file_util.h" | 
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" | 
| 15 #include "base/files/scoped_temp_dir.h" | 15 #include "base/files/scoped_temp_dir.h" | 
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" | 
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" | 
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" | 
| 19 #include "base/path_service.h" | 19 #include "base/path_service.h" | 
| 20 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" | 
| 21 #include "base/threading/sequenced_worker_pool.h" | 21 #include "base/threading/sequenced_worker_pool.h" | 
| 22 #include "chrome/browser/safe_browsing/database_manager.h" | 22 #include "chrome/browser/safe_browsing/database_manager.h" | 
| 23 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 23 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 
| 24 #include "chrome/browser/safe_browsing/signature_util.h" | 24 #include "chrome/browser/safe_browsing/signature_util.h" | 
| 25 #include "chrome/common/safe_browsing/csd.pb.h" | 25 #include "chrome/common/safe_browsing/csd.pb.h" | 
| 26 #include "components/zip/zip.h" |  | 
| 27 #include "content/public/test/mock_download_item.h" | 26 #include "content/public/test/mock_download_item.h" | 
| 28 #include "content/public/test/test_browser_thread.h" | 27 #include "content/public/test/test_browser_thread.h" | 
| 29 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" | 
| 30 #include "net/cert/x509_certificate.h" | 29 #include "net/cert/x509_certificate.h" | 
| 31 #include "net/url_request/test_url_fetcher_factory.h" | 30 #include "net/url_request/test_url_fetcher_factory.h" | 
| 32 #include "net/url_request/url_fetcher_delegate.h" | 31 #include "net/url_request/url_fetcher_delegate.h" | 
| 33 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" | 
| 34 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" | 
|  | 34 #include "third_party/zlib/google/zip.h" | 
| 35 | 35 | 
| 36 using ::testing::ContainerEq; | 36 using ::testing::ContainerEq; | 
| 37 using ::testing::DoAll; | 37 using ::testing::DoAll; | 
| 38 using ::testing::ElementsAre; | 38 using ::testing::ElementsAre; | 
| 39 using ::testing::Mock; | 39 using ::testing::Mock; | 
| 40 using ::testing::NotNull; | 40 using ::testing::NotNull; | 
| 41 using ::testing::Return; | 41 using ::testing::Return; | 
| 42 using ::testing::ReturnRef; | 42 using ::testing::ReturnRef; | 
| 43 using ::testing::SaveArg; | 43 using ::testing::SaveArg; | 
| 44 using ::testing::StrictMock; | 44 using ::testing::StrictMock; | 
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1074   GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); | 1074   GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); | 
| 1075   EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); | 1075   EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); | 
| 1076 | 1076 | 
| 1077   cert = ReadTestCertificate("test_c.pem"); | 1077   cert = ReadTestCertificate("test_c.pem"); | 
| 1078   ASSERT_TRUE(cert.get()); | 1078   ASSERT_TRUE(cert.get()); | 
| 1079   whitelist_strings.clear(); | 1079   whitelist_strings.clear(); | 
| 1080   GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); | 1080   GetCertificateWhitelistStrings(*cert, *issuer_cert, &whitelist_strings); | 
| 1081   EXPECT_THAT(whitelist_strings, ElementsAre()); | 1081   EXPECT_THAT(whitelist_strings, ElementsAre()); | 
| 1082 } | 1082 } | 
| 1083 }  // namespace safe_browsing | 1083 }  // namespace safe_browsing | 
| OLD | NEW | 
|---|