summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 14:26:31 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 14:26:31 +0000
commit8c899745075cbd3a3abead137ca0b151529898a2 (patch)
treec0b33b7b1a0a1b7b430060b78b165e79700d4972 /chrome/browser/download
parent03f7f4f98a9c241ed05862158e10120bfe64472f (diff)
downloadchromium_src-8c899745075cbd3a3abead137ca0b151529898a2.zip
chromium_src-8c899745075cbd3a3abead137ca0b151529898a2.tar.gz
chromium_src-8c899745075cbd3a3abead137ca0b151529898a2.tar.bz2
[GTTF] Add more NULL-checks to UI tests that were lacking them to avoid crashiness.
TEST=none BUG=none Review URL: http://codereview.chromium.org/841002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41273 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r--chrome/browser/download/download_uitest.cc16
-rw-r--r--chrome/browser/download/save_page_uitest.cc1
2 files changed, 9 insertions, 8 deletions
diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc
index f4b370f..17aa989 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 "base/test/test_file_util.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/net/url_request_mock_http_job.h"
#include "chrome/browser/net/url_request_slow_download_job.h"
@@ -106,6 +107,7 @@ class DownloadTest : public UITest {
// Complete sending the request. We do this by loading a second URL in a
// separate tab.
scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(window.get());
EXPECT_TRUE(window->AppendTab(GURL(
URLRequestSlowDownloadJob::kFinishDownloadUrl)));
EXPECT_EQ(2, GetTabCount());
@@ -122,11 +124,7 @@ class DownloadTest : public UITest {
EXPECT_TRUE(file_util::PathExists(download_path));
// Delete the file we just downloaded.
- for (int i = 0; i < 10; ++i) {
- if (file_util::Delete(download_path, false))
- break;
- PlatformThread::Sleep(action_max_timeout_ms() / 10);
- }
+ EXPECT_TRUE(file_util::DieFileDie(download_path, true));
EXPECT_FALSE(file_util::PathExists(download_path));
}
@@ -329,6 +327,7 @@ TEST_F(DownloadTest, FLAKY_IncognitoDownload) {
// Open a regular window and sanity check default values for window / tab
// count and shelf visibility.
scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
int window_count = 0;
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
ASSERT_EQ(1, window_count);
@@ -339,14 +338,15 @@ TEST_F(DownloadTest, FLAKY_IncognitoDownload) {
// 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));
ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
ASSERT_EQ(2, window_count);
+ scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1));
+ ASSERT_TRUE(incognito.get());
// Download something.
FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
- //PlatformThread::Sleep(1000);
+ scoped_refptr<TabProxy> tab(incognito->GetTab(0));
+ ASSERT_TRUE(tab.get());
ASSERT_TRUE(tab->NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)));
PlatformThread::Sleep(action_timeout_ms());
diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc
index 8774637..563333c 100644
--- a/chrome/browser/download/save_page_uitest.cc
+++ b/chrome/browser/download/save_page_uitest.cc
@@ -76,6 +76,7 @@ TEST_F(SavePageTest, CleanFilenameFromPageTitle) {
WaitUntilTabCount(1);
scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
automation()->SavePackageShouldPromptUser(false);
EXPECT_TRUE(browser->RunCommandAsync(IDC_SAVE_PAGE));
EXPECT_TRUE(WaitForDownloadShelfVisible(browser.get()));