Index: chrome/browser/download/save_page_browsertest.cc |
=================================================================== |
--- chrome/browser/download/save_page_browsertest.cc (revision 73953) |
+++ chrome/browser/download/save_page_browsertest.cc (working copy) |
@@ -8,7 +8,9 @@ |
#include "base/scoped_temp_dir.h" |
#include "chrome/app/chrome_command_ids.h" |
#include "chrome/browser/browser_window.h" |
+#include "chrome/browser/download/download_manager.h" |
#include "chrome/browser/net/url_request_mock_http_job.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/tab_contents/tab_contents.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/common/chrome_paths.h" |
@@ -18,8 +20,6 @@ |
#include "chrome/test/ui_test_utils.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-namespace { |
- |
static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("save_page"); |
static const char* kAppendedExtension = |
@@ -45,6 +45,13 @@ |
return *Details<GURL>(observer.details()).ptr(); |
} |
+ // Make sure the DownloadItem was added to the download history. |
+ void ValidateDownloadHistory(TabContents* current_tab) { |
+ DownloadManager* download_manager = |
+ current_tab->profile()->GetDownloadManager(); |
+ EXPECT_EQ(1u, download_manager->history_downloads_.size()); |
Paweł Hajdan Jr.
2011/02/14 09:35:53
This is not enough. I'd like to query the history
|
+ } |
+ |
// Path to directory containing test data. |
FilePath test_dir_; |
@@ -71,6 +78,8 @@ |
if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF)) |
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
+ ValidateDownloadHistory(current_tab); |
+ |
EXPECT_TRUE(file_util::PathExists(full_file_name)); |
EXPECT_FALSE(file_util::PathExists(dir)); |
EXPECT_TRUE(file_util::ContentsEqual( |
@@ -100,6 +109,8 @@ |
if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF)) |
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
+ ValidateDownloadHistory(current_tab); |
+ |
EXPECT_TRUE(file_util::PathExists(full_file_name)); |
EXPECT_FALSE(file_util::PathExists(dir)); |
EXPECT_TRUE(file_util::ContentsEqual( |
@@ -126,6 +137,8 @@ |
if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF)) |
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
+ ValidateDownloadHistory(current_tab); |
+ |
EXPECT_TRUE(file_util::PathExists(full_file_name)); |
EXPECT_TRUE(file_util::PathExists(dir)); |
EXPECT_TRUE(file_util::TextContentsEqual( |
@@ -168,6 +181,8 @@ |
if (browser()->SupportsWindowFeature(Browser::FEATURE_DOWNLOADSHELF)) |
EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
+ ValidateDownloadHistory(current_tab); |
+ |
EXPECT_TRUE(file_util::PathExists(full_file_name)); |
EXPECT_TRUE(file_util::PathExists(dir)); |
EXPECT_TRUE(file_util::TextContentsEqual( |
@@ -181,4 +196,3 @@ |
dir.AppendASCII("1.css"))); |
} |
-} // namespace |