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

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

Issue 14947007: [Downloads] Allow acquiring dangerous download file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 6 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 | Annotate | Revision Log
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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1764 matching lines...) Expand 10 before | Expand all | Expand 10 after
1775 row.current_path); 1775 row.current_path);
1776 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, row.danger_type); 1776 EXPECT_EQ(content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, row.danger_type);
1777 EXPECT_LE(start, row.start_time); 1777 EXPECT_LE(start, row.start_time);
1778 EXPECT_EQ(content::DownloadItem::IN_PROGRESS, row.state); 1778 EXPECT_EQ(content::DownloadItem::IN_PROGRESS, row.state);
1779 EXPECT_FALSE(row.opened); 1779 EXPECT_FALSE(row.opened);
1780 1780
1781 // Validate the download and wait for it to finish. 1781 // Validate the download and wait for it to finish.
1782 std::vector<DownloadItem*> downloads; 1782 std::vector<DownloadItem*> downloads;
1783 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads); 1783 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads);
1784 ASSERT_EQ(1u, downloads.size()); 1784 ASSERT_EQ(1u, downloads.size());
1785 downloads[0]->DangerousDownloadValidated(); 1785 downloads[0]->ValidateDangerousDownload();
1786 download_observer->WaitForFinished(); 1786 download_observer->WaitForFinished();
1787 1787
1788 // Get history details and confirm it's what you expect. 1788 // Get history details and confirm it's what you expect.
1789 downloads_in_database->clear(); 1789 downloads_in_database->clear();
1790 ASSERT_TRUE(DownloadsHistoryDataCollector( 1790 ASSERT_TRUE(DownloadsHistoryDataCollector(
1791 browser()->profile()).WaitForDownloadInfo(&downloads_in_database)); 1791 browser()->profile()).WaitForDownloadInfo(&downloads_in_database));
1792 ASSERT_EQ(1u, downloads_in_database->size()); 1792 ASSERT_EQ(1u, downloads_in_database->size());
1793 history::DownloadRow& row1(downloads_in_database->at(0)); 1793 history::DownloadRow& row1(downloads_in_database->at(0));
1794 EXPECT_EQ(DestinationFile(browser(), file), row1.target_path); 1794 EXPECT_EQ(DestinationFile(browser(), file), row1.target_path);
1795 EXPECT_EQ(DestinationFile(browser(), file), row1.current_path); 1795 EXPECT_EQ(DestinationFile(browser(), file), row1.current_path);
(...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2936 scoped_ptr<content::DownloadTestObserver> observer( 2936 scoped_ptr<content::DownloadTestObserver> observer(
2937 DangerousDownloadWaiter( 2937 DangerousDownloadWaiter(
2938 browser(), 1, 2938 browser(), 1,
2939 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 2939 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
2940 ui_test_utils::NavigateToURL(browser(), url); 2940 ui_test_utils::NavigateToURL(browser(), url);
2941 observer->WaitForFinished(); 2941 observer->WaitForFinished();
2942 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); 2942 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED));
2943 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); 2943 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
2944 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 2944 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
2945 } 2945 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/browser/download/download_shelf_context_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698