diff options
author | paul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 21:29:58 +0000 |
---|---|---|
committer | paul@chromium.org <paul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 21:29:58 +0000 |
commit | 0cea3942c2a153f0d7018919f601e71af80b3fce (patch) | |
tree | 4fe7f5c90b1eafa90e3e5dbccc94b461624accbb /chrome | |
parent | 57848548374cbe92a5a54492e29b3190f4ce1339 (diff) | |
download | chromium_src-0cea3942c2a153f0d7018919f601e71af80b3fce.zip chromium_src-0cea3942c2a153f0d7018919f601e71af80b3fce.tar.gz chromium_src-0cea3942c2a153f0d7018919f601e71af80b3fce.tar.bz2 |
Add a UI test for downloading in incognito mode.
This test opens an incognito window and verifies that
downloads work and that closing the incognito window
does not crash (see bug http://crbug.com/13983).
TEST=Test should run and not crash.
BUG=none
Review URL: http://codereview.chromium.org/126181
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/download/download_uitest.cc | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc index 8f7eb99..811bf00 100644 --- a/chrome/browser/download/download_uitest.cc +++ b/chrome/browser/download/download_uitest.cc @@ -15,6 +15,7 @@ #include "base/path_service.h" #include "base/platform_thread.h" #include "base/string_util.h" +#include "chrome/app/chrome_dll_resource.h" #include "chrome/browser/automation/url_request_mock_http_job.h" #include "chrome/browser/automation/url_request_slow_download_job.h" #include "chrome/common/chrome_constants.h" @@ -263,7 +264,6 @@ TEST_F(DownloadTest, PerWindowShelf) { ASSERT_FALSE(shelf_visible); } - // UnknownSize and KnownSize are tests which depend on // URLRequestSlowDownloadJob to serve content in a certain way. Data will be // sent in two chunks where the first chunk is 35K and the second chunk is 10K. @@ -289,4 +289,46 @@ TEST_F(DownloadTest, DISABLED_KnownSize) { L"100% - " + filename.ToWStringHack()); } +// Test that when downloading an item in Incognito mode, we don't crash when +// closing the last Incognito window (http://crbug.com/13983). +TEST_F(DownloadTest, IncognitoDownload) { + // Open a regular window and sanity check default values for window / tab + // count and shelf visibility. + scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); + int window_count = 0; + automation()->GetBrowserWindowCount(&window_count); + ASSERT_EQ(1, window_count); + EXPECT_EQ(1, GetTabCount()); + bool is_shelf_visible; + browser->IsShelfVisible(&is_shelf_visible); + EXPECT_FALSE(is_shelf_visible); + + // Open an Incognito window. + ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); + scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1)); + scoped_refptr<TabProxy> tab(incognito->GetTab(0)); + automation()->GetBrowserWindowCount(&window_count); + ASSERT_EQ(2, window_count); + + // Download something. + FilePath file(FILE_PATH_LITERAL("download-test1.lib")); + ASSERT_TRUE(tab->NavigateToURL( + URLRequestMockHTTPJob::GetMockUrl(file.ToWStringHack()))); + PlatformThread::Sleep(action_timeout_ms()); + + // Verify that the download shelf is showing for the Incognito window. + EXPECT_TRUE(WaitForDownloadShelfVisible(incognito.get())); + + // Close the Incognito window and don't crash. + ASSERT_TRUE(incognito->RunCommand(IDC_CLOSE_WINDOW)); + automation()->GetBrowserWindowCount(&window_count); + ASSERT_EQ(1, window_count); + + // Verify that the regular window does not have a download shelf. + browser->IsShelfVisible(&is_shelf_visible); + EXPECT_FALSE(is_shelf_visible); + + CleanUpDownload(file); +} + } // namespace |