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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 2786103005: Revert of Fix flaky DownloadTest.FeedbackServiceKeepDownload (Closed)
Patch Set: Created 3 years, 8 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/download/download_browsertest.h" 5 #include "chrome/browser/download/download_browsertest.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <sstream> 8 #include <sstream>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3430 *(downloads[0]))); 3430 *(downloads[0])));
3431 3431
3432 // Begin feedback and check that the file is "stolen". 3432 // Begin feedback and check that the file is "stolen".
3433 download_protection_service->feedback_service()->BeginFeedbackForDownload( 3433 download_protection_service->feedback_service()->BeginFeedbackForDownload(
3434 downloads[0], DownloadCommands::DISCARD); 3434 downloads[0], DownloadCommands::DISCARD);
3435 std::vector<DownloadItem*> updated_downloads; 3435 std::vector<DownloadItem*> updated_downloads;
3436 GetDownloads(browser(), &updated_downloads); 3436 GetDownloads(browser(), &updated_downloads);
3437 ASSERT_TRUE(updated_downloads.empty()); 3437 ASSERT_TRUE(updated_downloads.empty());
3438 } 3438 }
3439 3439
3440 IN_PROC_BROWSER_TEST_F(DownloadTest, FeedbackServiceKeepDownload) { 3440 // Test is flaky Linux. crbug.com/705224
3441 #if defined(OS_LINUX)
3442 #define MAYBE_FeedbackServiceKeepDownload DISABLED_FeedbackServiceKeepDownload
3443 #else
3444 #define MAYBE_FeedbackServiceKeepDownload FeedbackServiceKeepDownload
3445 #endif
3446 IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_FeedbackServiceKeepDownload) {
3441 PrefService* prefs = browser()->profile()->GetPrefs(); 3447 PrefService* prefs = browser()->profile()->GetPrefs();
3442 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, true); 3448 prefs->SetBoolean(prefs::kSafeBrowsingEnabled, true);
3443 safe_browsing::SetExtendedReportingPref(prefs, true); 3449 safe_browsing::SetExtendedReportingPref(prefs, true);
3444 3450
3445 // Make a dangerous file. 3451 // Make a dangerous file.
3446 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl( 3452 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(
3447 "downloads/dangerous/dangerous.swf")); 3453 "downloads/dangerous/dangerous.swf"));
3448 std::unique_ptr<content::DownloadTestObserverInterrupted> 3454 std::unique_ptr<content::DownloadTestObserverInterrupted>
3449 interruption_observer(new content::DownloadTestObserverInterrupted( 3455 interruption_observer(new content::DownloadTestObserverInterrupted(
3450 DownloadManagerForBrowser(browser()), 1, 3456 DownloadManagerForBrowser(browser()), 1,
(...skipping 26 matching lines...) Expand all
3477 sb_service->download_protection_service(); 3483 sb_service->download_protection_service();
3478 download_protection_service->feedback_service()->MaybeStorePingsForDownload( 3484 download_protection_service->feedback_service()->MaybeStorePingsForDownload(
3479 safe_browsing::DownloadProtectionService::UNCOMMON, 3485 safe_browsing::DownloadProtectionService::UNCOMMON,
3480 true /* upload_requested */, downloads[0], ping_request, ping_response); 3486 true /* upload_requested */, downloads[0], ping_request, ping_response);
3481 ASSERT_TRUE(safe_browsing::DownloadFeedbackService::IsEnabledForDownload( 3487 ASSERT_TRUE(safe_browsing::DownloadFeedbackService::IsEnabledForDownload(
3482 *(downloads[0]))); 3488 *(downloads[0])));
3483 3489
3484 // Begin feedback and check that file is still there. 3490 // Begin feedback and check that file is still there.
3485 download_protection_service->feedback_service()->BeginFeedbackForDownload( 3491 download_protection_service->feedback_service()->BeginFeedbackForDownload(
3486 downloads[0], DownloadCommands::KEEP); 3492 downloads[0], DownloadCommands::KEEP);
3487 std::unique_ptr<DownloadTestObserverNotInProgress> completion_observer(
3488 new DownloadTestObserverNotInProgress(
3489 DownloadManagerForBrowser(browser()), 1));
3490
3491 // Make sure download is finished before starting evaluation.
3492 if (!completion_observer->IsFinished()) {
3493 completion_observer->StartObserving();
3494 completion_observer->WaitForFinished();
3495 }
3496 3493
3497 std::vector<DownloadItem*> updated_downloads; 3494 std::vector<DownloadItem*> updated_downloads;
3498 GetDownloads(browser(), &updated_downloads); 3495 GetDownloads(browser(), &updated_downloads);
3499 ASSERT_EQ(std::size_t(1), updated_downloads.size()); 3496 ASSERT_EQ(std::size_t(1), updated_downloads.size());
3500 ASSERT_FALSE(updated_downloads[0]->IsDangerous()); 3497 ASSERT_FALSE(updated_downloads[0]->IsDangerous());
3501 ASSERT_TRUE(PathExists(updated_downloads[0]->GetTargetFilePath())); 3498 ASSERT_TRUE(PathExists(updated_downloads[0]->GetFullPath()));
3502 updated_downloads[0]->Cancel(true); 3499 updated_downloads[0]->Cancel(true);
3503 } 3500 }
3504 3501
3505 IN_PROC_BROWSER_TEST_F(DownloadTestWithFakeSafeBrowsing, 3502 IN_PROC_BROWSER_TEST_F(DownloadTestWithFakeSafeBrowsing,
3506 SendUncommonDownloadReportIfUserProceed) { 3503 SendUncommonDownloadReportIfUserProceed) {
3507 browser()->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled, 3504 browser()->profile()->GetPrefs()->SetBoolean(prefs::kSafeBrowsingEnabled,
3508 true); 3505 true);
3509 // Make a dangerous file. 3506 // Make a dangerous file.
3510 GURL download_url( 3507 GURL download_url(
3511 net::URLRequestMockHTTPJob::GetMockUrl(kDangerousMockFilePath)); 3508 net::URLRequestMockHTTPJob::GetMockUrl(kDangerousMockFilePath));
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 browser(), 1, 3804 browser(), 1,
3808 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3805 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3809 ui_test_utils::NavigateToURL(browser(), extension_url); 3806 ui_test_utils::NavigateToURL(browser(), extension_url);
3810 3807
3811 observer->WaitForFinished(); 3808 observer->WaitForFinished();
3812 3809
3813 // Download shelf should close. 3810 // Download shelf should close.
3814 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3811 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3815 } 3812 }
3816 #endif // defined(OS_CHROMEOS) 3813 #endif // defined(OS_CHROMEOS)
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