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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 GetCurrentManager()->GetAllDownloads(items); | 464 GetCurrentManager()->GetAllDownloads(items); |
465 ASSERT_EQ(count, items->size()); | 465 ASSERT_EQ(count, items->size()); |
466 } | 466 } |
467 | 467 |
468 DownloadItem* CreateSlowTestDownload() { | 468 DownloadItem* CreateSlowTestDownload() { |
469 scoped_ptr<content::DownloadTestObserver> observer( | 469 scoped_ptr<content::DownloadTestObserver> observer( |
470 CreateInProgressDownloadObserver(1)); | 470 CreateInProgressDownloadObserver(1)); |
471 GURL slow_download_url(URLRequestSlowDownloadJob::kUnknownSizeUrl); | 471 GURL slow_download_url(URLRequestSlowDownloadJob::kUnknownSizeUrl); |
472 DownloadManager* manager = GetCurrentManager(); | 472 DownloadManager* manager = GetCurrentManager(); |
473 | 473 |
| 474 EXPECT_EQ(0, manager->NonDangerousInProgressCount()); |
474 EXPECT_EQ(0, manager->InProgressCount()); | 475 EXPECT_EQ(0, manager->InProgressCount()); |
475 if (manager->InProgressCount() != 0) | 476 if (manager->InProgressCount() != 0) |
476 return NULL; | 477 return NULL; |
477 | 478 |
478 ui_test_utils::NavigateToURLWithDisposition( | 479 ui_test_utils::NavigateToURLWithDisposition( |
479 current_browser(), slow_download_url, CURRENT_TAB, | 480 current_browser(), slow_download_url, CURRENT_TAB, |
480 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 481 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
481 | 482 |
482 observer->WaitForFinished(); | 483 observer->WaitForFinished(); |
483 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::IN_PROGRESS)); | 484 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::IN_PROGRESS)); |
(...skipping 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3336 GoOnTheRecord(); | 3337 GoOnTheRecord(); |
3337 content::RenderProcessHost* host = AddFilenameDeterminer(); | 3338 content::RenderProcessHost* host = AddFilenameDeterminer(); |
3338 | 3339 |
3339 // Start a download. | 3340 // Start a download. |
3340 DownloadItem* item = NULL; | 3341 DownloadItem* item = NULL; |
3341 { | 3342 { |
3342 DownloadManager* manager = GetCurrentManager(); | 3343 DownloadManager* manager = GetCurrentManager(); |
3343 scoped_ptr<content::DownloadTestObserver> observer( | 3344 scoped_ptr<content::DownloadTestObserver> observer( |
3344 new JustInProgressDownloadObserver(manager, 1)); | 3345 new JustInProgressDownloadObserver(manager, 1)); |
3345 ASSERT_EQ(0, manager->InProgressCount()); | 3346 ASSERT_EQ(0, manager->InProgressCount()); |
| 3347 ASSERT_EQ(0, manager->NonDangerousInProgressCount()); |
3346 // Tabs created just for a download are automatically closed, invalidating | 3348 // Tabs created just for a download are automatically closed, invalidating |
3347 // the download's WebContents. Downloads without WebContents cannot be | 3349 // the download's WebContents. Downloads without WebContents cannot be |
3348 // resumed. http://crbug.com/225901 | 3350 // resumed. http://crbug.com/225901 |
3349 ui_test_utils::NavigateToURLWithDisposition( | 3351 ui_test_utils::NavigateToURLWithDisposition( |
3350 current_browser(), | 3352 current_browser(), |
3351 GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl), | 3353 GURL(URLRequestSlowDownloadJob::kUnknownSizeUrl), |
3352 CURRENT_TAB, | 3354 CURRENT_TAB, |
3353 ui_test_utils::BROWSER_TEST_NONE); | 3355 ui_test_utils::BROWSER_TEST_NONE); |
3354 observer->WaitForFinished(); | 3356 observer->WaitForFinished(); |
3355 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::IN_PROGRESS)); | 3357 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::IN_PROGRESS)); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3603 &conflict_action, | 3605 &conflict_action, |
3604 &warnings); | 3606 &warnings); |
3605 EXPECT_EQ("suggester", winner_id); | 3607 EXPECT_EQ("suggester", winner_id); |
3606 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); | 3608 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); |
3607 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 3609 EXPECT_EQ(api::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
3608 EXPECT_FALSE(warnings.empty()); | 3610 EXPECT_FALSE(warnings.empty()); |
3609 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, | 3611 EXPECT_EQ(extensions::ExtensionWarning::kDownloadFilenameConflict, |
3610 warnings.begin()->warning_type()); | 3612 warnings.begin()->warning_type()); |
3611 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 3613 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
3612 } | 3614 } |
OLD | NEW |