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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 // is present in the UI (currently only on chromeos). | 588 // is present in the UI (currently only on chromeos). |
589 void CheckDownloadUI(Browser* browser, bool expected_non_cros, | 589 void CheckDownloadUI(Browser* browser, bool expected_non_cros, |
590 bool expected_cros, const FilePath& filename) { | 590 bool expected_cros, const FilePath& filename) { |
591 #if defined(OS_CHROMEOS) && !defined(USE_AURA) | 591 #if defined(OS_CHROMEOS) && !defined(USE_AURA) |
592 Browser* popup = ActiveDownloadsUI::GetPopup(); | 592 Browser* popup = ActiveDownloadsUI::GetPopup(); |
593 EXPECT_EQ(expected_cros, popup != NULL); | 593 EXPECT_EQ(expected_cros, popup != NULL); |
594 if (!popup || filename.empty()) | 594 if (!popup || filename.empty()) |
595 return; | 595 return; |
596 | 596 |
597 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( | 597 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( |
598 popup->GetSelectedTabContents()->web_ui()); | 598 popup->GetSelectedTabContents()->GetWebUI()); |
599 | 599 |
600 ASSERT_TRUE(downloads_ui); | 600 ASSERT_TRUE(downloads_ui); |
601 const ActiveDownloadsUI::DownloadList& downloads = | 601 const ActiveDownloadsUI::DownloadList& downloads = |
602 downloads_ui->GetDownloads(); | 602 downloads_ui->GetDownloads(); |
603 EXPECT_EQ(downloads.size(), 1U); | 603 EXPECT_EQ(downloads.size(), 1U); |
604 | 604 |
605 FilePath full_path(DestinationFile(browser, filename)); | 605 FilePath full_path(DestinationFile(browser, filename)); |
606 bool exists = false; | 606 bool exists = false; |
607 for (size_t i = 0; i < downloads.size(); ++i) { | 607 for (size_t i = 0; i < downloads.size(); ++i) { |
608 if (downloads[i]->GetFullPath() == full_path) { | 608 if (downloads[i]->GetFullPath() == full_path) { |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1731 | 1731 |
1732 // Check state. | 1732 // Check state. |
1733 EXPECT_EQ(1, browser()->tab_count()); | 1733 EXPECT_EQ(1, browser()->tab_count()); |
1734 ASSERT_TRUE(CheckDownloadFullPaths(browser(), | 1734 ASSERT_TRUE(CheckDownloadFullPaths(browser(), |
1735 target_file_full_path, | 1735 target_file_full_path, |
1736 OriginFile(file))); | 1736 OriginFile(file))); |
1737 | 1737 |
1738 // Temporary downloads won't be visible. | 1738 // Temporary downloads won't be visible. |
1739 CheckDownloadUI(browser(), false, false, file); | 1739 CheckDownloadUI(browser(), false, false, file); |
1740 } | 1740 } |
OLD | NEW |