OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/signature_util.h" | 5 #include "chrome/browser/safe_browsing/signature_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "chrome/common/safe_browsing/csd.pb.h" | 14 #include "chrome/common/safe_browsing/csd.pb.h" |
15 #include "net/base/x509_cert_types.h" | 15 #include "net/cert/x509_cert_types.h" |
16 #include "net/base/x509_certificate.h" | 16 #include "net/cert/x509_certificate.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 | 18 |
19 namespace safe_browsing { | 19 namespace safe_browsing { |
20 | 20 |
21 class SignatureUtilWinTest : public testing::Test { | 21 class SignatureUtilWinTest : public testing::Test { |
22 protected: | 22 protected: |
23 virtual void SetUp() { | 23 virtual void SetUp() { |
24 base::FilePath source_path; | 24 base::FilePath source_path; |
25 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path)); | 25 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path)); |
26 testdata_path_ = source_path | 26 testdata_path_ = source_path |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Test a file that doesn't exist. | 97 // Test a file that doesn't exist. |
98 scoped_refptr<SignatureUtil> signature_util(new SignatureUtil()); | 98 scoped_refptr<SignatureUtil> signature_util(new SignatureUtil()); |
99 ClientDownloadRequest_SignatureInfo signature_info; | 99 ClientDownloadRequest_SignatureInfo signature_info; |
100 signature_util->CheckSignature(testdata_path_.Append(L"doesnotexist.exe"), | 100 signature_util->CheckSignature(testdata_path_.Append(L"doesnotexist.exe"), |
101 &signature_info); | 101 &signature_info); |
102 EXPECT_EQ(0, signature_info.certificate_chain_size()); | 102 EXPECT_EQ(0, signature_info.certificate_chain_size()); |
103 EXPECT_FALSE(signature_info.has_trusted()); | 103 EXPECT_FALSE(signature_info.has_trusted()); |
104 } | 104 } |
105 | 105 |
106 } // namespace safe_browsing | 106 } // namespace safe_browsing |
OLD | NEW |