OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/download/download_browsertest.h" | 5 #include "chrome/browser/download/download_browsertest.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <sstream> | 8 #include <sstream> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 965 |
966 for (size_t i = 0; i < count; ++i) { | 966 for (size_t i = 0; i < count; ++i) { |
967 DownloadFilesCheckErrorsLoopBody(download_info[i], i); | 967 DownloadFilesCheckErrorsLoopBody(download_info[i], i); |
968 } | 968 } |
969 } | 969 } |
970 | 970 |
971 void DownloadInsertFilesErrorCheckErrorsLoopBody( | 971 void DownloadInsertFilesErrorCheckErrorsLoopBody( |
972 scoped_refptr<content::TestFileErrorInjector> injector, | 972 scoped_refptr<content::TestFileErrorInjector> injector, |
973 const FileErrorInjectInfo& info, | 973 const FileErrorInjectInfo& info, |
974 size_t i) { | 974 size_t i) { |
975 std::stringstream s; | 975 SCOPED_TRACE( |
976 s << " " << __FUNCTION__ << "()" | 976 ::testing::Message() |
977 << " index = " << i | 977 << " " << __FUNCTION__ << "()" |
978 << " url = " << info.error_info.url | 978 << " index = " << i << " operation code = " |
979 << " operation code = " | 979 << content::TestFileErrorInjector::DebugString(info.error_info.code) |
980 << content::TestFileErrorInjector::DebugString(info.error_info.code) | 980 << " instance = " << info.error_info.operation_instance << " error = " |
981 << " instance = " << info.error_info.operation_instance | 981 << content::DownloadInterruptReasonToString(info.error_info.error)); |
982 << " error = " | |
983 << content::DownloadInterruptReasonToString(info.error_info.error); | |
984 | 982 |
985 injector->ClearErrors(); | 983 injector->ClearErrors(); |
986 injector->AddError(info.error_info); | 984 injector->AddError(info.error_info); |
987 | 985 |
988 injector->InjectErrors(); | 986 injector->InjectErrors(); |
989 | 987 |
990 DownloadFilesCheckErrorsLoopBody(info.download_info, i); | 988 DownloadFilesCheckErrorsLoopBody(info.download_info, i); |
991 | 989 |
992 size_t expected_successes = info.download_info.show_download_item ? 1u : 0u; | 990 size_t expected_successes = info.download_info.show_download_item ? 1u : 0u; |
993 EXPECT_EQ(expected_successes, injector->TotalFileCount()) << s.str(); | 991 EXPECT_EQ(expected_successes, injector->TotalFileCount()); |
994 EXPECT_EQ(0u, injector->CurrentFileCount()) << s.str(); | 992 EXPECT_EQ(0u, injector->CurrentFileCount()); |
995 | |
996 if (info.download_info.show_download_item) | |
997 EXPECT_TRUE(injector->HadFile(GURL(info.error_info.url))) << s.str(); | |
998 } | 993 } |
999 | 994 |
1000 void DownloadInsertFilesErrorCheckErrors(size_t count, | 995 void DownloadInsertFilesErrorCheckErrors(size_t count, |
1001 FileErrorInjectInfo* info) { | 996 FileErrorInjectInfo* info) { |
1002 DownloadFilesCheckErrorsSetup(); | 997 DownloadFilesCheckErrorsSetup(); |
1003 | 998 |
1004 // Set up file failures. | 999 // Set up file failures. |
1005 scoped_refptr<content::TestFileErrorInjector> injector( | 1000 scoped_refptr<content::TestFileErrorInjector> injector( |
1006 content::TestFileErrorInjector::Create( | 1001 content::TestFileErrorInjector::Create( |
1007 DownloadManagerForBrowser(browser()))); | 1002 DownloadManagerForBrowser(browser()))); |
1008 | 1003 |
1009 for (size_t i = 0; i < count; ++i) { | 1004 for (size_t i = 0; i < count; ++i) { |
1010 // Set up the full URL, for download file tracking. | |
1011 std::string server_path = "/downloads/"; | |
1012 server_path += info[i].download_info.starting_url; | |
1013 GURL url = embedded_test_server()->GetURL(server_path); | |
1014 info[i].error_info.url = url.spec(); | |
1015 | |
1016 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i); | 1005 DownloadInsertFilesErrorCheckErrorsLoopBody(injector, info[i], i); |
1017 } | 1006 } |
1018 } | 1007 } |
1019 | 1008 |
1020 // Attempts to download a file to a read-only folder, based on information | 1009 // Attempts to download a file to a read-only folder, based on information |
1021 // in |download_info|. | 1010 // in |download_info|. |
1022 void DownloadFilesToReadonlyFolder(size_t count, | 1011 void DownloadFilesToReadonlyFolder(size_t count, |
1023 DownloadInfo* download_info) { | 1012 DownloadInfo* download_info) { |
1024 DownloadFilesCheckErrorsSetup(); | 1013 DownloadFilesCheckErrorsSetup(); |
1025 | 1014 |
(...skipping 12 matching lines...) Expand all Loading... |
1038 // This method: | 1027 // This method: |
1039 // * Starts a mock download by navigating browser() to a URLRequestMockHTTPJob | 1028 // * Starts a mock download by navigating browser() to a URLRequestMockHTTPJob |
1040 // mock URL. | 1029 // mock URL. |
1041 // * Injects |error| on the first write using |error_injector|. | 1030 // * Injects |error| on the first write using |error_injector|. |
1042 // * Waits for the download to be interrupted. | 1031 // * Waits for the download to be interrupted. |
1043 // * Clears the errors on |error_injector|. | 1032 // * Clears the errors on |error_injector|. |
1044 // * Returns the resulting interrupted download. | 1033 // * Returns the resulting interrupted download. |
1045 DownloadItem* StartMockDownloadAndInjectError( | 1034 DownloadItem* StartMockDownloadAndInjectError( |
1046 content::TestFileErrorInjector* error_injector, | 1035 content::TestFileErrorInjector* error_injector, |
1047 content::DownloadInterruptReason error) { | 1036 content::DownloadInterruptReason error) { |
1048 GURL url = URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path); | |
1049 | |
1050 content::TestFileErrorInjector::FileErrorInfo error_info; | 1037 content::TestFileErrorInjector::FileErrorInfo error_info; |
1051 error_info.url = url.spec(); | |
1052 error_info.code = content::TestFileErrorInjector::FILE_OPERATION_WRITE; | 1038 error_info.code = content::TestFileErrorInjector::FILE_OPERATION_WRITE; |
1053 error_info.operation_instance = 0; | 1039 error_info.operation_instance = 0; |
1054 error_info.error = error; | 1040 error_info.error = error; |
1055 error_injector->ClearErrors(); | 1041 error_injector->ClearErrors(); |
1056 error_injector->AddError(error_info); | 1042 error_injector->AddError(error_info); |
1057 error_injector->InjectErrors(); | 1043 error_injector->InjectErrors(); |
1058 | 1044 |
1059 scoped_ptr<content::DownloadTestObserver> observer( | 1045 scoped_ptr<content::DownloadTestObserver> observer( |
1060 new DownloadTestObserverResumable( | 1046 new DownloadTestObserverResumable( |
1061 DownloadManagerForBrowser(browser()), 1)); | 1047 DownloadManagerForBrowser(browser()), 1)); |
| 1048 |
| 1049 GURL url = URLRequestMockHTTPJob::GetMockUrl(kDownloadTest1Path); |
1062 ui_test_utils::NavigateToURL(browser(), url); | 1050 ui_test_utils::NavigateToURL(browser(), url); |
1063 observer->WaitForFinished(); | 1051 observer->WaitForFinished(); |
1064 | 1052 |
1065 content::DownloadManager::DownloadVector downloads; | 1053 content::DownloadManager::DownloadVector downloads; |
1066 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads); | 1054 DownloadManagerForBrowser(browser())->GetAllDownloads(&downloads); |
1067 EXPECT_EQ(1u, downloads.size()); | 1055 EXPECT_EQ(1u, downloads.size()); |
1068 | 1056 |
1069 if (downloads.size() != 1) | 1057 if (downloads.size() != 1) |
1070 return NULL; | 1058 return NULL; |
1071 | 1059 |
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 | 2325 |
2338 DownloadFilesCheckErrors(arraysize(download_info), download_info); | 2326 DownloadFilesCheckErrors(arraysize(download_info), download_info); |
2339 } | 2327 } |
2340 | 2328 |
2341 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadErrorsFile) { | 2329 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadErrorsFile) { |
2342 FileErrorInjectInfo error_info[] = { | 2330 FileErrorInjectInfo error_info[] = { |
2343 {// Navigated download with injected "Disk full" error in Initialize(). | 2331 {// Navigated download with injected "Disk full" error in Initialize(). |
2344 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, | 2332 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, |
2345 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, | 2333 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, |
2346 { | 2334 { |
2347 "", content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 2335 content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
2348 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, | 2336 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, |
2349 }}, | 2337 }}, |
2350 {// Direct download with injected "Disk full" error in Initialize(). | 2338 {// Direct download with injected "Disk full" error in Initialize(). |
2351 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2339 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2352 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, | 2340 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, |
2353 { | 2341 { |
2354 "", content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 2342 content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
2355 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, | 2343 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, |
2356 }}, | 2344 }}, |
2357 {// Navigated download with injected "Disk full" error in Write(). | 2345 {// Navigated download with injected "Disk full" error in Write(). |
2358 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, | 2346 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, |
2359 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, | 2347 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, |
2360 { | 2348 { |
2361 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, | 2349 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, |
2362 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, | 2350 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, |
2363 }}, | 2351 }}, |
2364 {// Direct download with injected "Disk full" error in Write(). | 2352 {// Direct download with injected "Disk full" error in Write(). |
2365 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2353 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2366 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, | 2354 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, |
2367 { | 2355 { |
2368 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, | 2356 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, |
2369 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, | 2357 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, |
2370 }}, | 2358 }}, |
2371 {// Navigated download with injected "Failed" error in Initialize(). | 2359 {// Navigated download with injected "Failed" error in Initialize(). |
2372 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, | 2360 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, |
2373 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, | 2361 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, |
2374 { | 2362 { |
2375 "", content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 2363 content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
2376 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 2364 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
2377 }}, | 2365 }}, |
2378 {// Direct download with injected "Failed" error in Initialize(). | 2366 {// Direct download with injected "Failed" error in Initialize(). |
2379 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2367 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2380 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, | 2368 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, |
2381 { | 2369 { |
2382 "", content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 2370 content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
2383 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 2371 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
2384 }}, | 2372 }}, |
2385 {// Navigated download with injected "Failed" error in Write(). | 2373 {// Navigated download with injected "Failed" error in Write(). |
2386 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, | 2374 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, |
2387 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, | 2375 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, |
2388 { | 2376 { |
2389 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, | 2377 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, |
2390 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 2378 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
2391 }}, | 2379 }}, |
2392 {// Direct download with injected "Failed" error in Write(). | 2380 {// Direct download with injected "Failed" error in Write(). |
2393 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2381 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2394 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, | 2382 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, |
2395 { | 2383 { |
2396 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, | 2384 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, |
2397 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 2385 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
2398 }}, | 2386 }}, |
2399 {// Navigated download with injected "Name too long" error in | 2387 {// Navigated download with injected "Name too long" error in |
2400 // Initialize(). | 2388 // Initialize(). |
2401 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, | 2389 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, |
2402 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, true, false}, | 2390 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, true, false}, |
2403 { | 2391 { |
2404 "", content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 2392 content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
2405 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, | 2393 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, |
2406 }}, | 2394 }}, |
2407 {// Direct download with injected "Name too long" error in Initialize(). | 2395 {// Direct download with injected "Name too long" error in Initialize(). |
2408 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2396 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2409 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, true, false}, | 2397 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, true, false}, |
2410 { | 2398 { |
2411 "", content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, | 2399 content::TestFileErrorInjector::FILE_OPERATION_INITIALIZE, 0, |
2412 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, | 2400 content::DOWNLOAD_INTERRUPT_REASON_FILE_NAME_TOO_LONG, |
2413 }}, | 2401 }}, |
2414 {// Navigated download with injected "Name too long" error in Write(). | 2402 {// Navigated download with injected "Name too long" error in Write(). |
2415 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, | 2403 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_NAVIGATE, |
2416 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, | 2404 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, |
2417 { | 2405 { |
2418 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, | 2406 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, |
2419 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 2407 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
2420 }}, | 2408 }}, |
2421 {// Direct download with injected "Name too long" error in Write(). | 2409 {// Direct download with injected "Name too long" error in Write(). |
2422 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2410 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2423 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, | 2411 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, true, false}, |
2424 { | 2412 { |
2425 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, | 2413 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 0, |
2426 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, | 2414 content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED, |
2427 }}, | 2415 }}, |
2428 {// Direct download with injected "Disk full" error in 2nd Write(). | 2416 {// Direct download with injected "Disk full" error in 2nd Write(). |
2429 {"06bESSE21Evolution.ppt", "06bESSE21Evolution.ppt", DOWNLOAD_DIRECT, | 2417 {"06bESSE21Evolution.ppt", "06bESSE21Evolution.ppt", DOWNLOAD_DIRECT, |
2430 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, | 2418 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, true, false}, |
2431 { | 2419 { |
2432 "", content::TestFileErrorInjector::FILE_OPERATION_WRITE, 1, | 2420 content::TestFileErrorInjector::FILE_OPERATION_WRITE, 1, |
2433 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, | 2421 content::DOWNLOAD_INTERRUPT_REASON_FILE_NO_SPACE, |
2434 }}}; | 2422 }}}; |
2435 | 2423 |
2436 DownloadInsertFilesErrorCheckErrors(arraysize(error_info), error_info); | 2424 DownloadInsertFilesErrorCheckErrors(arraysize(error_info), error_info); |
2437 } | 2425 } |
2438 | 2426 |
2439 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadErrorReadonlyFolder) { | 2427 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadErrorReadonlyFolder) { |
2440 DownloadInfo download_info[] = { | 2428 DownloadInfo download_info[] = { |
2441 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, | 2429 {"a_zip_file.zip", "a_zip_file.zip", DOWNLOAD_DIRECT, |
2442 // This passes because we switch to the My Documents folder. | 2430 // This passes because we switch to the My Documents folder. |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3057 scoped_ptr<content::DownloadTestObserver> resumable_observer( | 3045 scoped_ptr<content::DownloadTestObserver> resumable_observer( |
3058 new DownloadTestObserverResumable( | 3046 new DownloadTestObserverResumable( |
3059 DownloadManagerForBrowser(browser()), 2)); | 3047 DownloadManagerForBrowser(browser()), 2)); |
3060 | 3048 |
3061 EnableFileChooser(true); | 3049 EnableFileChooser(true); |
3062 DownloadItem* download = StartMockDownloadAndInjectError( | 3050 DownloadItem* download = StartMockDownloadAndInjectError( |
3063 error_injector.get(), content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); | 3051 error_injector.get(), content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED); |
3064 ASSERT_TRUE(download); | 3052 ASSERT_TRUE(download); |
3065 | 3053 |
3066 content::TestFileErrorInjector::FileErrorInfo error_info; | 3054 content::TestFileErrorInjector::FileErrorInfo error_info; |
3067 error_info.url = download->GetOriginalUrl().spec(); | |
3068 error_info.code = content::TestFileErrorInjector::FILE_OPERATION_WRITE; | 3055 error_info.code = content::TestFileErrorInjector::FILE_OPERATION_WRITE; |
3069 error_info.operation_instance = 0; | 3056 error_info.operation_instance = 0; |
3070 error_info.error = content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED; | 3057 error_info.error = content::DOWNLOAD_INTERRUPT_REASON_FILE_FAILED; |
3071 error_injector->AddError(error_info); | 3058 error_injector->AddError(error_info); |
3072 error_injector->InjectErrors(); | 3059 error_injector->InjectErrors(); |
3073 | 3060 |
3074 // Resuming should cause the download to be interrupted again due to the | 3061 // Resuming should cause the download to be interrupted again due to the |
3075 // errors we are injecting. | 3062 // errors we are injecting. |
3076 download->Resume(); | 3063 download->Resume(); |
3077 resumable_observer->WaitForFinished(); | 3064 resumable_observer->WaitForFinished(); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3546 | 3533 |
3547 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( | 3534 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( |
3548 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3535 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
3549 ui_test_utils::NavigateToURL(browser(), extension_url); | 3536 ui_test_utils::NavigateToURL(browser(), extension_url); |
3550 | 3537 |
3551 observer->WaitForFinished(); | 3538 observer->WaitForFinished(); |
3552 | 3539 |
3553 // Download shelf should close. | 3540 // Download shelf should close. |
3554 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); | 3541 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); |
3555 } | 3542 } |
OLD | NEW |