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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "net/cert/x509_certificate.h" | 34 #include "net/cert/x509_certificate.h" |
35 #include "net/http/http_status_code.h" | 35 #include "net/http/http_status_code.h" |
36 #include "net/url_request/test_url_fetcher_factory.h" | 36 #include "net/url_request/test_url_fetcher_factory.h" |
37 #include "net/url_request/url_fetcher_delegate.h" | 37 #include "net/url_request/url_fetcher_delegate.h" |
38 #include "net/url_request/url_request_status.h" | 38 #include "net/url_request/url_request_status.h" |
39 #include "testing/gmock/include/gmock/gmock.h" | 39 #include "testing/gmock/include/gmock/gmock.h" |
40 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
41 #include "third_party/zlib/google/zip.h" | 41 #include "third_party/zlib/google/zip.h" |
42 #include "url/gurl.h" | 42 #include "url/gurl.h" |
43 | 43 |
| 44 #if defined(OS_MACOSX) |
| 45 #include "base/metrics/field_trial.h" |
| 46 #include "components/variations/entropy_provider.h" |
| 47 #endif |
| 48 |
44 using ::testing::Assign; | 49 using ::testing::Assign; |
45 using ::testing::ContainerEq; | 50 using ::testing::ContainerEq; |
46 using ::testing::DoAll; | 51 using ::testing::DoAll; |
47 using ::testing::ElementsAre; | 52 using ::testing::ElementsAre; |
48 using ::testing::Mock; | 53 using ::testing::Mock; |
49 using ::testing::NotNull; | 54 using ::testing::NotNull; |
50 using ::testing::Return; | 55 using ::testing::Return; |
51 using ::testing::ReturnRef; | 56 using ::testing::ReturnRef; |
52 using ::testing::SaveArg; | 57 using ::testing::SaveArg; |
53 using ::testing::StrictMock; | 58 using ::testing::StrictMock; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 base::Owned(check))); | 195 base::Owned(check))); |
191 } | 196 } |
192 | 197 |
193 class DownloadProtectionServiceTest : public testing::Test { | 198 class DownloadProtectionServiceTest : public testing::Test { |
194 protected: | 199 protected: |
195 DownloadProtectionServiceTest() | 200 DownloadProtectionServiceTest() |
196 : test_browser_thread_bundle_( | 201 : test_browser_thread_bundle_( |
197 content::TestBrowserThreadBundle::IO_MAINLOOP) { | 202 content::TestBrowserThreadBundle::IO_MAINLOOP) { |
198 } | 203 } |
199 virtual void SetUp() { | 204 virtual void SetUp() { |
| 205 #if defined(OS_MACOSX) |
| 206 field_trial_list_.reset(new base::FieldTrialList( |
| 207 new metrics::SHA1EntropyProvider("42"))); |
| 208 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( |
| 209 "SafeBrowsingOSXClientDownloadPings", |
| 210 "Enabled")); |
| 211 #endif |
200 // Start real threads for the IO and File threads so that the DCHECKs | 212 // Start real threads for the IO and File threads so that the DCHECKs |
201 // to test that we're on the correct thread work. | 213 // to test that we're on the correct thread work. |
202 sb_service_ = new StrictMock<FakeSafeBrowsingService>(); | 214 sb_service_ = new StrictMock<FakeSafeBrowsingService>(); |
203 sb_service_->Initialize(); | 215 sb_service_->Initialize(); |
204 binary_feature_extractor_ = new StrictMock<MockBinaryFeatureExtractor>(); | 216 binary_feature_extractor_ = new StrictMock<MockBinaryFeatureExtractor>(); |
205 download_service_ = sb_service_->download_protection_service(); | 217 download_service_ = sb_service_->download_protection_service(); |
206 download_service_->binary_feature_extractor_ = binary_feature_extractor_; | 218 download_service_->binary_feature_extractor_ = binary_feature_extractor_; |
207 download_service_->SetEnabled(true); | 219 download_service_->SetEnabled(true); |
208 base::RunLoop().RunUntilIdle(); | 220 base::RunLoop().RunUntilIdle(); |
209 has_result_ = false; | 221 has_result_ = false; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 | 363 |
352 protected: | 364 protected: |
353 scoped_refptr<FakeSafeBrowsingService> sb_service_; | 365 scoped_refptr<FakeSafeBrowsingService> sb_service_; |
354 scoped_refptr<MockBinaryFeatureExtractor> binary_feature_extractor_; | 366 scoped_refptr<MockBinaryFeatureExtractor> binary_feature_extractor_; |
355 DownloadProtectionService* download_service_; | 367 DownloadProtectionService* download_service_; |
356 DownloadProtectionService::DownloadCheckResult result_; | 368 DownloadProtectionService::DownloadCheckResult result_; |
357 bool has_result_; | 369 bool has_result_; |
358 content::TestBrowserThreadBundle test_browser_thread_bundle_; | 370 content::TestBrowserThreadBundle test_browser_thread_bundle_; |
359 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; | 371 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; |
360 base::FilePath testdata_path_; | 372 base::FilePath testdata_path_; |
| 373 #if defined(OS_MACOSX) |
| 374 scoped_ptr<base::FieldTrialList> field_trial_list_; |
| 375 #endif |
361 }; | 376 }; |
362 | 377 |
363 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) { | 378 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) { |
364 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); | 379 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); |
365 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); | 380 base::FilePath a_exe(FILE_PATH_LITERAL("a.exe")); |
366 std::vector<GURL> url_chain; | 381 std::vector<GURL> url_chain; |
367 GURL referrer("http://www.google.com/"); | 382 GURL referrer("http://www.google.com/"); |
368 | 383 |
369 content::MockDownloadItem item; | 384 content::MockDownloadItem item; |
370 EXPECT_CALL(item, GetFullPath()).WillRepeatedly(ReturnRef(a_tmp)); | 385 EXPECT_CALL(item, GetFullPath()).WillRepeatedly(ReturnRef(a_tmp)); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); | 518 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); |
504 #endif | 519 #endif |
505 | 520 |
506 // Only if the final url is whitelisted should it be SAFE. | 521 // Only if the final url is whitelisted should it be SAFE. |
507 url_chain.push_back(GURL("http://www.google.com/a.exe")); | 522 url_chain.push_back(GURL("http://www.google.com/a.exe")); |
508 download_service_->CheckClientDownload( | 523 download_service_->CheckClientDownload( |
509 &item, | 524 &item, |
510 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 525 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
511 base::Unretained(this))); | 526 base::Unretained(this))); |
512 MessageLoop::current()->Run(); | 527 MessageLoop::current()->Run(); |
| 528 #if defined(OS_MACOSX) |
| 529 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); |
| 530 #else |
513 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); | 531 EXPECT_TRUE(IsResult(DownloadProtectionService::SAFE)); |
| 532 #endif |
514 } | 533 } |
515 | 534 |
516 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { | 535 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadFetchFailed) { |
517 net::FakeURLFetcherFactory factory(NULL); | 536 net::FakeURLFetcherFactory factory(NULL); |
518 // HTTP request will fail. | 537 // HTTP request will fail. |
519 factory.SetFakeResponse( | 538 factory.SetFakeResponse( |
520 DownloadProtectionService::GetDownloadRequestUrl(), std::string(), | 539 DownloadProtectionService::GetDownloadRequestUrl(), std::string(), |
521 net::HTTP_INTERNAL_SERVER_ERROR, net::URLRequestStatus::FAILED); | 540 net::HTTP_INTERNAL_SERVER_ERROR, net::URLRequestStatus::FAILED); |
522 | 541 |
523 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); | 542 base::FilePath a_tmp(FILE_PATH_LITERAL("a.tmp")); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 | 955 |
937 EXPECT_FALSE(download_service_->IsSupportedDownload(item, a_crx)); | 956 EXPECT_FALSE(download_service_->IsSupportedDownload(item, a_crx)); |
938 download_service_->CheckClientDownload( | 957 download_service_->CheckClientDownload( |
939 &item, | 958 &item, |
940 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 959 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
941 base::Unretained(this))); | 960 base::Unretained(this))); |
942 MessageLoop::current()->Run(); | 961 MessageLoop::current()->Run(); |
943 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); | 962 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); |
944 } | 963 } |
945 | 964 |
| 965 #if defined(OS_MACOSX) |
| 966 // TODO(mattm): remove this (see crbug.com/414834). |
| 967 TEST_F(DownloadProtectionServiceTest, |
| 968 CheckClientDownloadPingOnOSXRequiresFieldTrial) { |
| 969 // Clear the field trial that was set in SetUp(). |
| 970 field_trial_list_.reset(); |
| 971 |
| 972 net::TestURLFetcherFactory factory; |
| 973 |
| 974 base::FilePath tmp_path(FILE_PATH_LITERAL("bla.tmp")); |
| 975 base::FilePath final_path(FILE_PATH_LITERAL("bla.exe")); |
| 976 std::vector<GURL> url_chain; |
| 977 url_chain.push_back(GURL("http://www.google.com/")); |
| 978 url_chain.push_back(GURL("http://www.google.com/bla.exe")); |
| 979 GURL referrer("http://www.google.com/"); |
| 980 std::string hash = "hash"; |
| 981 std::string remote_address = "10.11.12.13"; |
| 982 |
| 983 content::MockDownloadItem item; |
| 984 EXPECT_CALL(item, GetFullPath()).WillRepeatedly(ReturnRef(tmp_path)); |
| 985 EXPECT_CALL(item, GetTargetFilePath()).WillRepeatedly(ReturnRef(final_path)); |
| 986 EXPECT_CALL(item, GetUrlChain()).WillRepeatedly(ReturnRef(url_chain)); |
| 987 EXPECT_CALL(item, GetReferrerUrl()).WillRepeatedly(ReturnRef(referrer)); |
| 988 EXPECT_CALL(item, GetTabUrl()).WillRepeatedly(ReturnRef(GURL::EmptyGURL())); |
| 989 EXPECT_CALL(item, GetTabReferrerUrl()) |
| 990 .WillRepeatedly(ReturnRef(GURL::EmptyGURL())); |
| 991 EXPECT_CALL(item, GetHash()).WillRepeatedly(ReturnRef(hash)); |
| 992 EXPECT_CALL(item, GetReceivedBytes()).WillRepeatedly(Return(100)); |
| 993 EXPECT_CALL(item, HasUserGesture()).WillRepeatedly(Return(true)); |
| 994 EXPECT_CALL(item, GetRemoteAddress()).WillRepeatedly(Return(remote_address)); |
| 995 |
| 996 EXPECT_CALL(*sb_service_->mock_database_manager(), |
| 997 MatchDownloadWhitelistUrl(_)) |
| 998 .WillRepeatedly(Return(false)); |
| 999 EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)) |
| 1000 .WillOnce(SetCertificateContents("dummy cert data")); |
| 1001 EXPECT_CALL(*binary_feature_extractor_.get(), |
| 1002 ExtractImageHeaders(tmp_path, _)) |
| 1003 .WillOnce(SetDosHeaderContents("dummy dos header")); |
| 1004 download_service_->CheckClientDownload( |
| 1005 &item, |
| 1006 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
| 1007 base::Unretained(this))); |
| 1008 |
| 1009 // SendRequest is not called. Wait for FinishRequest to call our callback. |
| 1010 MessageLoop::current()->Run(); |
| 1011 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
| 1012 EXPECT_EQ(NULL, fetcher); |
| 1013 } |
| 1014 #endif |
| 1015 |
946 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) { | 1016 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) { |
947 net::TestURLFetcherFactory factory; | 1017 net::TestURLFetcherFactory factory; |
948 | 1018 |
949 base::FilePath tmp_path(FILE_PATH_LITERAL("bla.tmp")); | 1019 base::FilePath tmp_path(FILE_PATH_LITERAL("bla.tmp")); |
950 base::FilePath final_path(FILE_PATH_LITERAL("bla.exe")); | 1020 base::FilePath final_path(FILE_PATH_LITERAL("bla.exe")); |
951 std::vector<GURL> url_chain; | 1021 std::vector<GURL> url_chain; |
952 url_chain.push_back(GURL("http://www.google.com/")); | 1022 url_chain.push_back(GURL("http://www.google.com/")); |
953 url_chain.push_back(GURL("http://www.google.com/bla.exe")); | 1023 url_chain.push_back(GURL("http://www.google.com/bla.exe")); |
954 GURL referrer("http://www.google.com/"); | 1024 GURL referrer("http://www.google.com/"); |
955 std::string hash = "hash"; | 1025 std::string hash = "hash"; |
(...skipping 18 matching lines...) Expand all Loading... |
974 EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)) | 1044 EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)) |
975 .WillOnce(SetCertificateContents("dummy cert data")); | 1045 .WillOnce(SetCertificateContents("dummy cert data")); |
976 EXPECT_CALL(*binary_feature_extractor_.get(), | 1046 EXPECT_CALL(*binary_feature_extractor_.get(), |
977 ExtractImageHeaders(tmp_path, _)) | 1047 ExtractImageHeaders(tmp_path, _)) |
978 .WillOnce(SetDosHeaderContents("dummy dos header")); | 1048 .WillOnce(SetDosHeaderContents("dummy dos header")); |
979 download_service_->CheckClientDownload( | 1049 download_service_->CheckClientDownload( |
980 &item, | 1050 &item, |
981 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 1051 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
982 base::Unretained(this))); | 1052 base::Unretained(this))); |
983 | 1053 |
984 #if !defined(OS_WIN) | 1054 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
985 // SendRequest is not called. Wait for FinishRequest to call our callback. | 1055 // SendRequest is not called. Wait for FinishRequest to call our callback. |
986 MessageLoop::current()->Run(); | 1056 MessageLoop::current()->Run(); |
987 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1057 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
988 EXPECT_EQ(NULL, fetcher); | 1058 EXPECT_EQ(NULL, fetcher); |
989 #else | 1059 #else |
990 // Run the message loop(s) until SendRequest is called. | 1060 // Run the message loop(s) until SendRequest is called. |
991 FlushThreadMessageLoops(); | 1061 FlushThreadMessageLoops(); |
992 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1062 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
993 ASSERT_TRUE(fetcher); | 1063 ASSERT_TRUE(fetcher); |
994 ClientDownloadRequest request; | 1064 ClientDownloadRequest request; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 MatchDownloadWhitelistUrl(_)) | 1129 MatchDownloadWhitelistUrl(_)) |
1060 .WillRepeatedly(Return(false)); | 1130 .WillRepeatedly(Return(false)); |
1061 EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)); | 1131 EXPECT_CALL(*binary_feature_extractor_.get(), CheckSignature(tmp_path, _)); |
1062 EXPECT_CALL(*binary_feature_extractor_.get(), | 1132 EXPECT_CALL(*binary_feature_extractor_.get(), |
1063 ExtractImageHeaders(tmp_path, _)); | 1133 ExtractImageHeaders(tmp_path, _)); |
1064 download_service_->CheckClientDownload( | 1134 download_service_->CheckClientDownload( |
1065 &item, | 1135 &item, |
1066 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 1136 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
1067 base::Unretained(this))); | 1137 base::Unretained(this))); |
1068 | 1138 |
1069 #if !defined(OS_WIN) | 1139 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
1070 // SendRequest is not called. Wait for FinishRequest to call our callback. | 1140 // SendRequest is not called. Wait for FinishRequest to call our callback. |
1071 MessageLoop::current()->Run(); | 1141 MessageLoop::current()->Run(); |
1072 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1142 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
1073 EXPECT_EQ(NULL, fetcher); | 1143 EXPECT_EQ(NULL, fetcher); |
1074 #else | 1144 #else |
1075 // Run the message loop(s) until SendRequest is called. | 1145 // Run the message loop(s) until SendRequest is called. |
1076 FlushThreadMessageLoops(); | 1146 FlushThreadMessageLoops(); |
1077 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1147 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
1078 ASSERT_TRUE(fetcher); | 1148 ASSERT_TRUE(fetcher); |
1079 ClientDownloadRequest request; | 1149 ClientDownloadRequest request; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 .WillRepeatedly(SetDosHeaderContents("dummy dos header")); | 1217 .WillRepeatedly(SetDosHeaderContents("dummy dos header")); |
1148 | 1218 |
1149 // First test with no history match for the tab URL. | 1219 // First test with no history match for the tab URL. |
1150 { | 1220 { |
1151 TestURLFetcherWatcher fetcher_watcher(&factory); | 1221 TestURLFetcherWatcher fetcher_watcher(&factory); |
1152 download_service_->CheckClientDownload( | 1222 download_service_->CheckClientDownload( |
1153 &item, | 1223 &item, |
1154 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 1224 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
1155 base::Unretained(this))); | 1225 base::Unretained(this))); |
1156 | 1226 |
1157 #if !defined(OS_WIN) | 1227 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
1158 // SendRequest is not called. Wait for FinishRequest to call our callback. | 1228 // SendRequest is not called. Wait for FinishRequest to call our callback. |
1159 MessageLoop::current()->Run(); | 1229 MessageLoop::current()->Run(); |
1160 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1230 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
1161 EXPECT_EQ(NULL, fetcher); | 1231 EXPECT_EQ(NULL, fetcher); |
1162 #else | 1232 #else |
1163 EXPECT_EQ(0, fetcher_watcher.WaitForRequest()); | 1233 EXPECT_EQ(0, fetcher_watcher.WaitForRequest()); |
1164 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1234 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
1165 ASSERT_TRUE(fetcher); | 1235 ASSERT_TRUE(fetcher); |
1166 ClientDownloadRequest request; | 1236 ClientDownloadRequest request; |
1167 EXPECT_TRUE(request.ParseFromString(fetcher->upload_data())); | 1237 EXPECT_TRUE(request.ParseFromString(fetcher->upload_data())); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 redirects, | 1292 redirects, |
1223 content::PAGE_TRANSITION_TYPED, | 1293 content::PAGE_TRANSITION_TYPED, |
1224 history::SOURCE_BROWSED, | 1294 history::SOURCE_BROWSED, |
1225 false); | 1295 false); |
1226 | 1296 |
1227 TestURLFetcherWatcher fetcher_watcher(&factory); | 1297 TestURLFetcherWatcher fetcher_watcher(&factory); |
1228 download_service_->CheckClientDownload( | 1298 download_service_->CheckClientDownload( |
1229 &item, | 1299 &item, |
1230 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, | 1300 base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, |
1231 base::Unretained(this))); | 1301 base::Unretained(this))); |
1232 #if !defined(OS_WIN) | 1302 #if !defined(OS_WIN) && !defined(OS_MACOSX) |
1233 // SendRequest is not called. Wait for FinishRequest to call our callback. | 1303 // SendRequest is not called. Wait for FinishRequest to call our callback. |
1234 MessageLoop::current()->Run(); | 1304 MessageLoop::current()->Run(); |
1235 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1305 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
1236 EXPECT_EQ(NULL, fetcher); | 1306 EXPECT_EQ(NULL, fetcher); |
1237 #else | 1307 #else |
1238 EXPECT_EQ(0, fetcher_watcher.WaitForRequest()); | 1308 EXPECT_EQ(0, fetcher_watcher.WaitForRequest()); |
1239 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 1309 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
1240 ASSERT_TRUE(fetcher); | 1310 ASSERT_TRUE(fetcher); |
1241 ClientDownloadRequest request; | 1311 ClientDownloadRequest request; |
1242 EXPECT_TRUE(request.ParseFromString(fetcher->upload_data())); | 1312 EXPECT_TRUE(request.ParseFromString(fetcher->upload_data())); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); | 1584 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); |
1515 | 1585 |
1516 cert = ReadTestCertificate("test_c.pem"); | 1586 cert = ReadTestCertificate("test_c.pem"); |
1517 ASSERT_TRUE(cert.get()); | 1587 ASSERT_TRUE(cert.get()); |
1518 whitelist_strings.clear(); | 1588 whitelist_strings.clear(); |
1519 GetCertificateWhitelistStrings( | 1589 GetCertificateWhitelistStrings( |
1520 *cert.get(), *issuer_cert.get(), &whitelist_strings); | 1590 *cert.get(), *issuer_cert.get(), &whitelist_strings); |
1521 EXPECT_THAT(whitelist_strings, ElementsAre()); | 1591 EXPECT_THAT(whitelist_strings, ElementsAre()); |
1522 } | 1592 } |
1523 } // namespace safe_browsing | 1593 } // namespace safe_browsing |
OLD | NEW |