Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(559)

Side by Side Diff: chrome/browser/safe_browsing/download_protection_service_unittest.cc

Issue 1984763003: Delete tmp_path_ at the end of the tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 EXPECT_EQ(ClientDownloadRequest_DownloadType_INVALID_ZIP, 558 EXPECT_EQ(ClientDownloadRequest_DownloadType_INVALID_ZIP,
559 GetClientDownloadRequest()->download_type()); 559 GetClientDownloadRequest()->download_type());
560 ClearClientDownloadRequest(); 560 ClearClientDownloadRequest();
561 } else { 561 } else {
562 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN)); 562 EXPECT_TRUE(IsResult(DownloadProtectionService::UNKNOWN));
563 EXPECT_FALSE(HasClientDownloadRequest()); 563 EXPECT_FALSE(HasClientDownloadRequest());
564 } 564 }
565 565
566 Mock::VerifyAndClearExpectations(sb_service_.get()); 566 Mock::VerifyAndClearExpectations(sb_service_.get());
567 Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); 567 Mock::VerifyAndClearExpectations(binary_feature_extractor_.get());
568
569 base::DeleteFile(tmp_path_, false);
asanka 2016/05/17 14:51:56 This won't be executed if any of the ASSERT_*s fai
568 } 570 }
569 571
570 572
571 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) { 573 TEST_F(DownloadProtectionServiceTest, CheckClientDownloadInvalidUrl) {
572 content::MockDownloadItem item; 574 content::MockDownloadItem item;
573 PrepareBasicDownloadItem( 575 PrepareBasicDownloadItem(
574 &item, 576 &item,
575 std::vector<std::string>(), // empty url_chain 577 std::vector<std::string>(), // empty url_chain
576 "http://www.google.com/", // referrer 578 "http://www.google.com/", // referrer
577 FILE_PATH_LITERAL("a.tmp"), // tmp_path 579 FILE_PATH_LITERAL("a.tmp"), // tmp_path
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1194 base::Unretained(this))); 1196 base::Unretained(this)));
1195 MessageLoop::current()->Run(); 1197 MessageLoop::current()->Run();
1196 1198
1197 ASSERT_TRUE(HasClientDownloadRequest()); 1199 ASSERT_TRUE(HasClientDownloadRequest());
1198 EXPECT_EQ(0, GetClientDownloadRequest()->archived_binary_size()); 1200 EXPECT_EQ(0, GetClientDownloadRequest()->archived_binary_size());
1199 EXPECT_TRUE(GetClientDownloadRequest()->has_download_type()); 1201 EXPECT_TRUE(GetClientDownloadRequest()->has_download_type());
1200 EXPECT_EQ(ClientDownloadRequest_DownloadType_ZIPPED_ARCHIVE, 1202 EXPECT_EQ(ClientDownloadRequest_DownloadType_ZIPPED_ARCHIVE,
1201 GetClientDownloadRequest()->download_type()); 1203 GetClientDownloadRequest()->download_type());
1202 ClearClientDownloadRequest(); 1204 ClearClientDownloadRequest();
1203 Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); 1205 Mock::VerifyAndClearExpectations(binary_feature_extractor_.get());
1206
1207 base::DeleteFile(tmp_path_, false);
1204 } 1208 }
1205 1209
1206 TEST_F(DownloadProtectionServiceTest, 1210 TEST_F(DownloadProtectionServiceTest,
1207 CheckClientDownloadReportCorruptZipNormal) { 1211 CheckClientDownloadReportCorruptZipNormal) {
1208 // !is_extended_reporting && !is_incognito 1212 // !is_extended_reporting && !is_incognito
1209 CheckClientDownloadReportCorruptZip(false, false); 1213 CheckClientDownloadReportCorruptZip(false, false);
1210 } 1214 }
1211 1215
1212 TEST_F(DownloadProtectionServiceTest, 1216 TEST_F(DownloadProtectionServiceTest,
1213 CheckClientDownloadReportCorruptZipExtended) { 1217 CheckClientDownloadReportCorruptZipExtended) {
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 1918 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
1915 base::Unretained(this))); 1919 base::Unretained(this)));
1916 MessageLoop::current()->Run(); 1920 MessageLoop::current()->Run();
1917 1921
1918 EXPECT_FALSE(HasClientDownloadRequest()); 1922 EXPECT_FALSE(HasClientDownloadRequest());
1919 // Overriden by flag: 1923 // Overriden by flag:
1920 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); 1924 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS));
1921 } 1925 }
1922 1926
1923 } // namespace safe_browsing 1927 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698