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

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

Issue 2578363002: Wire up download attribution enable finch experiment (Closed)
Patch Set: Remove unnecessary includes Created 3 years, 12 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
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 const base::FilePath& tmp_full_path, 424 const base::FilePath& tmp_full_path,
425 const base::FilePath& final_full_path) { 425 const base::FilePath& final_full_path) {
426 url_chain_.clear(); 426 url_chain_.clear();
427 for (std::string item: url_chain_items) 427 for (std::string item: url_chain_items)
428 url_chain_.push_back(GURL(item)); 428 url_chain_.push_back(GURL(item));
429 referrer_ = GURL(referrer_url); 429 referrer_ = GURL(referrer_url);
430 tmp_path_ = tmp_full_path; 430 tmp_path_ = tmp_full_path;
431 final_path_ = final_full_path; 431 final_path_ = final_full_path;
432 hash_ = "hash"; 432 hash_ = "hash";
433 433
434 if (url_chain_.size() > 0) {
435 EXPECT_CALL(*item, GetURL()).WillRepeatedly(ReturnRef(url_chain_.back()));
436 } else{
437 GURL empty_url;
438 EXPECT_CALL(*item, GetURL()).WillRepeatedly(ReturnRef(empty_url));
439 }
434 EXPECT_CALL(*item, GetFullPath()).WillRepeatedly(ReturnRef(tmp_path_)); 440 EXPECT_CALL(*item, GetFullPath()).WillRepeatedly(ReturnRef(tmp_path_));
435 EXPECT_CALL(*item, GetTargetFilePath()) 441 EXPECT_CALL(*item, GetTargetFilePath())
436 .WillRepeatedly(ReturnRef(final_path_)); 442 .WillRepeatedly(ReturnRef(final_path_));
437 EXPECT_CALL(*item, GetUrlChain()).WillRepeatedly(ReturnRef(url_chain_)); 443 EXPECT_CALL(*item, GetUrlChain()).WillRepeatedly(ReturnRef(url_chain_));
438 EXPECT_CALL(*item, GetReferrerUrl()).WillRepeatedly(ReturnRef(referrer_)); 444 EXPECT_CALL(*item, GetReferrerUrl()).WillRepeatedly(ReturnRef(referrer_));
439 EXPECT_CALL(*item, GetTabUrl()) 445 EXPECT_CALL(*item, GetTabUrl())
440 .WillRepeatedly(ReturnRef(GURL::EmptyGURL())); 446 .WillRepeatedly(ReturnRef(GURL::EmptyGURL()));
441 EXPECT_CALL(*item, GetTabReferrerUrl()) 447 EXPECT_CALL(*item, GetTabReferrerUrl())
442 .WillRepeatedly(ReturnRef(GURL::EmptyGURL())); 448 .WillRepeatedly(ReturnRef(GURL::EmptyGURL()));
443 EXPECT_CALL(*item, GetHash()).WillRepeatedly(ReturnRef(hash_)); 449 EXPECT_CALL(*item, GetHash()).WillRepeatedly(ReturnRef(hash_));
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 2320 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
2315 base::Unretained(this), run_loop.QuitClosure())); 2321 base::Unretained(this), run_loop.QuitClosure()));
2316 run_loop.Run(); 2322 run_loop.Run();
2317 2323
2318 EXPECT_FALSE(HasClientDownloadRequest()); 2324 EXPECT_FALSE(HasClientDownloadRequest());
2319 // Overriden by flag: 2325 // Overriden by flag:
2320 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); 2326 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS));
2321 } 2327 }
2322 2328
2323 } // namespace safe_browsing 2329 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698