| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/test/test_file_util.h" | 12 #include "base/test/test_file_util.h" |
| 13 #include "base/test/test_timeouts.h" |
| 13 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 16 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/download/download_util.h" | 17 #include "chrome/browser/download/download_util.h" |
| 17 #include "chrome/browser/net/url_request_mock_http_job.h" | 18 #include "chrome/browser/net/url_request_mock_http_job.h" |
| 18 #include "chrome/browser/net/url_request_slow_download_job.h" | 19 #include "chrome/browser/net/url_request_slow_download_job.h" |
| 19 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 20 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/test/ui/ui_test.h" | 22 #include "chrome/test/ui/ui_test.h" |
| 22 #include "chrome/test/automation/tab_proxy.h" | 23 #include "chrome/test/automation/tab_proxy.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 147 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
| 147 TEST_F(DownloadTest, FLAKY_NoDownload) { | 148 TEST_F(DownloadTest, FLAKY_NoDownload) { |
| 148 FilePath file(FILE_PATH_LITERAL("download-test2.html")); | 149 FilePath file(FILE_PATH_LITERAL("download-test2.html")); |
| 149 FilePath file_path = download_prefix_.Append(file); | 150 FilePath file_path = download_prefix_.Append(file); |
| 150 CleanupDownloadFiles(file); | 151 CleanupDownloadFiles(file); |
| 151 | 152 |
| 152 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); | 153 NavigateToURL(URLRequestMockHTTPJob::GetMockUrl(file)); |
| 153 WaitUntilTabCount(1); | 154 WaitUntilTabCount(1); |
| 154 | 155 |
| 155 // Wait to see if the file will be downloaded. | 156 // Wait to see if the file will be downloaded. |
| 156 base::PlatformThread::Sleep(sleep_timeout_ms()); | 157 base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms()); |
| 157 | 158 |
| 158 EXPECT_FALSE(file_util::PathExists(file_path)); | 159 EXPECT_FALSE(file_util::PathExists(file_path)); |
| 159 if (file_util::PathExists(file_path)) | 160 if (file_util::PathExists(file_path)) |
| 160 ASSERT_TRUE(file_util::Delete(file_path, false)); | 161 ASSERT_TRUE(file_util::Delete(file_path, false)); |
| 161 | 162 |
| 162 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 163 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 163 ASSERT_TRUE(browser.get()); | 164 ASSERT_TRUE(browser.get()); |
| 164 EXPECT_FALSE(WaitForDownloadShelfVisible(browser.get())); | 165 EXPECT_FALSE(WaitForDownloadShelfVisible(browser.get())); |
| 165 } | 166 } |
| 166 | 167 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 CleanupDownloadFiles(file); | 516 CleanupDownloadFiles(file); |
| 516 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 517 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
| 517 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); | 518 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); |
| 518 | 519 |
| 519 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 520 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
| 520 | 521 |
| 521 CheckDownload(file); | 522 CheckDownload(file); |
| 522 } | 523 } |
| 523 | 524 |
| 524 } // namespace | 525 } // namespace |
| OLD | NEW |