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

Unified Diff: chrome/browser/download/save_page_browsertest.cc

Issue 7212017: Add save package download items to history. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/save_page_browsertest.cc
===================================================================
--- chrome/browser/download/save_page_browsertest.cc (revision 91035)
+++ chrome/browser/download/save_page_browsertest.cc (working copy)
@@ -7,10 +7,12 @@
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
#include "chrome/app/chrome_command_ids.h"
+#include "chrome/browser/download/download_item.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/download/download_tab_helper.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/webui/active_downloads_ui.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/in_process_browser_test.h"
@@ -47,6 +49,30 @@
return *Details<GURL>(observer.details()).ptr();
}
+ void CheckDownloadUI(const FilePath& download_path) {
+#if defined(OS_CHROMEOS)
+ Browser* popup = ActiveDownloadsUI::GetPopup();
+ EXPECT_TRUE(popup);
+ ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>(
+ popup->GetSelectedTabContents()->web_ui());
+ ASSERT_TRUE(downloads_ui);
+ const ActiveDownloadsUI::DownloadList& downloads =
+ downloads_ui->GetDownloads();
+ EXPECT_EQ(downloads.size(), 1U);
+
+ bool found = false;
+ for (size_t i = 0; i < downloads.size(); ++i) {
+ if (downloads[i]->full_path() == download_path) {
+ found = true;
+ break;
+ }
+ }
+ EXPECT_TRUE(found);
+#else
+ EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
+#endif
+ }
+
// Path to directory containing test data.
FilePath test_dir_;
@@ -70,8 +96,7 @@
EXPECT_EQ(url, WaitForSavePackageToFinish());
- if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF))
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
+ CheckDownloadUI(full_file_name);
EXPECT_TRUE(file_util::PathExists(full_file_name));
EXPECT_FALSE(file_util::PathExists(dir));
@@ -99,8 +124,7 @@
EXPECT_EQ(actual_page_url, WaitForSavePackageToFinish());
- if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF))
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
+ CheckDownloadUI(full_file_name);
EXPECT_TRUE(file_util::PathExists(full_file_name));
EXPECT_FALSE(file_util::PathExists(dir));
@@ -125,8 +149,7 @@
EXPECT_EQ(url, WaitForSavePackageToFinish());
- if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF))
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
+ CheckDownloadUI(full_file_name);
EXPECT_TRUE(file_util::PathExists(full_file_name));
EXPECT_TRUE(file_util::PathExists(dir));
@@ -167,8 +190,7 @@
EXPECT_EQ(url, WaitForSavePackageToFinish());
- if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF))
- EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
+ CheckDownloadUI(full_file_name);
EXPECT_TRUE(file_util::PathExists(full_file_name));
EXPECT_TRUE(file_util::PathExists(dir));
« no previous file with comments | « chrome/browser/download/download_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698