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" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 download_util::EraseUniqueDownloadFiles(path_prefix); | 72 download_util::EraseUniqueDownloadFiles(path_prefix); |
73 } | 73 } |
74 | 74 |
75 virtual void SetUp() { | 75 virtual void SetUp() { |
76 UITest::SetUp(); | 76 UITest::SetUp(); |
77 download_prefix_ = GetDownloadDirectory(); | 77 download_prefix_ = GetDownloadDirectory(); |
78 } | 78 } |
79 | 79 |
80 protected: | 80 protected: |
81 void RunSizeTest(const GURL& url, | 81 void RunSizeTest(const GURL& url, |
82 const std::wstring& expected_title_in_progress, | 82 const string16& expected_title_in_progress, |
83 const std::wstring& expected_title_finished) { | 83 const string16& expected_title_finished) { |
84 FilePath filename; | 84 FilePath filename; |
85 net::FileURLToFilePath(url, &filename); | 85 net::FileURLToFilePath(url, &filename); |
86 filename = filename.BaseName(); | 86 filename = filename.BaseName(); |
87 CleanupDownloadFiles(filename); | 87 CleanupDownloadFiles(filename); |
88 | 88 |
89 { | 89 { |
90 EXPECT_EQ(1, GetTabCount()); | 90 EXPECT_EQ(1, GetTabCount()); |
91 | 91 |
92 NavigateToURL(url); | 92 NavigateToURL(url); |
93 // Downloads appear in the shelf | 93 // Downloads appear in the shelf |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // in the middle until the server receives a second request for | 235 // in the middle until the server receives a second request for |
236 // "download-finish. At that time, the download will finish. | 236 // "download-finish. At that time, the download will finish. |
237 // All download tests are flaky on all platforms, http://crbug.com/35275, | 237 // All download tests are flaky on all platforms, http://crbug.com/35275, |
238 // http://crbug.com/48913. | 238 // http://crbug.com/48913. |
239 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 239 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
240 TEST_F(DownloadTest, FLAKY_UnknownSize) { | 240 TEST_F(DownloadTest, FLAKY_UnknownSize) { |
241 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); | 241 GURL url(URLRequestSlowDownloadJob::kUnknownSizeUrl); |
242 FilePath filename; | 242 FilePath filename; |
243 net::FileURLToFilePath(url, &filename); | 243 net::FileURLToFilePath(url, &filename); |
244 filename = filename.BaseName(); | 244 filename = filename.BaseName(); |
245 RunSizeTest(url, L"32.0 KB - " + filename.ToWStringHack(), | 245 RunSizeTest(url, |
246 L"100% - " + filename.ToWStringHack()); | 246 ASCIIToUTF16("32.0 KB - ") + filename.LossyDisplayName(), |
| 247 ASCIIToUTF16("100% - ") + filename.LossyDisplayName()); |
247 } | 248 } |
248 | 249 |
249 // All download tests are flaky on all platforms, http://crbug.com/35275, | 250 // All download tests are flaky on all platforms, http://crbug.com/35275, |
250 // http://crbug.com/48913. | 251 // http://crbug.com/48913. |
251 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 252 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
252 TEST_F(DownloadTest, FLAKY_KnownSize) { | 253 TEST_F(DownloadTest, FLAKY_KnownSize) { |
253 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); | 254 GURL url(URLRequestSlowDownloadJob::kKnownSizeUrl); |
254 FilePath filename; | 255 FilePath filename; |
255 net::FileURLToFilePath(url, &filename); | 256 net::FileURLToFilePath(url, &filename); |
256 filename = filename.BaseName(); | 257 filename = filename.BaseName(); |
257 RunSizeTest(url, L"71% - " + filename.ToWStringHack(), | 258 RunSizeTest(url, |
258 L"100% - " + filename.ToWStringHack()); | 259 ASCIIToUTF16("71% - ") + filename.LossyDisplayName(), |
| 260 ASCIIToUTF16("100% - ") + filename.LossyDisplayName()); |
259 } | 261 } |
260 | 262 |
261 // Test that when downloading an item in Incognito mode, we don't crash when | 263 // Test that when downloading an item in Incognito mode, we don't crash when |
262 // closing the last Incognito window (http://crbug.com/13983). | 264 // closing the last Incognito window (http://crbug.com/13983). |
263 // All download tests are flaky on all platforms, http://crbug.com/35275, | 265 // All download tests are flaky on all platforms, http://crbug.com/35275, |
264 // http://crbug.com/48913. | 266 // http://crbug.com/48913. |
265 // Additionally, there is Windows-specific flake, http://crbug.com/20809. | 267 // Additionally, there is Windows-specific flake, http://crbug.com/20809. |
266 TEST_F(DownloadTest, DISABLED_IncognitoDownload) { | 268 TEST_F(DownloadTest, DISABLED_IncognitoDownload) { |
267 // Open a regular window and sanity check default values for window / tab | 269 // Open a regular window and sanity check default values for window / tab |
268 // count and shelf visibility. | 270 // count and shelf visibility. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 CleanupDownloadFiles(file); | 518 CleanupDownloadFiles(file); |
517 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( | 519 ASSERT_TRUE(tab_proxy->NavigateToURLAsyncWithDisposition( |
518 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); | 520 URLRequestMockHTTPJob::GetMockUrl(file), NEW_WINDOW)); |
519 | 521 |
520 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); | 522 ASSERT_TRUE(automation()->WaitForWindowCountToBecome(2)); |
521 | 523 |
522 CheckDownload(file); | 524 CheckDownload(file); |
523 } | 525 } |
524 | 526 |
525 } // namespace | 527 } // namespace |
OLD | NEW |