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/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 Browser* popup = ActiveDownloadsUI::GetPopup(); | 102 Browser* popup = ActiveDownloadsUI::GetPopup(); |
103 EXPECT_TRUE(popup); | 103 EXPECT_TRUE(popup); |
104 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( | 104 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( |
105 popup->GetSelectedTabContents()->web_ui()); | 105 popup->GetSelectedTabContents()->web_ui()); |
106 EXPECT_TRUE(downloads_ui); | 106 EXPECT_TRUE(downloads_ui); |
107 return downloads_ui->GetDownloads(); | 107 return downloads_ui->GetDownloads(); |
108 } | 108 } |
109 #endif | 109 #endif |
110 | 110 |
111 void CheckDownloadUI(const FilePath& download_path) const { | 111 void CheckDownloadUI(const FilePath& download_path) const { |
112 // Expectations must be in sync with the implementation in | |
113 // Browser::OnStartDownload(). | |
114 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
115 const ActiveDownloadsUI::DownloadList& downloads = GetDownloads(); | 113 const ActiveDownloadsUI::DownloadList& downloads = GetDownloads(); |
116 EXPECT_EQ(downloads.size(), 1U); | 114 EXPECT_EQ(downloads.size(), 1U); |
117 | 115 |
118 bool found = false; | 116 bool found = false; |
119 for (size_t i = 0; i < downloads.size(); ++i) { | 117 for (size_t i = 0; i < downloads.size(); ++i) { |
120 if (downloads[i]->full_path() == download_path) { | 118 if (downloads[i]->full_path() == download_path) { |
121 found = true; | 119 found = true; |
122 break; | 120 break; |
123 } | 121 } |
124 } | 122 } |
125 EXPECT_TRUE(found); | 123 EXPECT_TRUE(found); |
126 #elif !defined(USE_AURA) | 124 #else |
127 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); | 125 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); |
128 #else | |
129 // TODO(jamescook): Downloads UI for non-ChromeOS Aura, crbug.com/103488 | |
130 NOTIMPLEMENTED(); | |
131 #endif | 126 #endif |
132 } | 127 } |
133 | 128 |
134 DownloadManager* GetDownloadManager() const { | 129 DownloadManager* GetDownloadManager() const { |
135 DownloadManager* download_manager = | 130 DownloadManager* download_manager = |
136 DownloadServiceFactory::GetForProfile( | 131 DownloadServiceFactory::GetForProfile( |
137 browser()->profile())->GetDownloadManager(); | 132 browser()->profile())->GetDownloadManager(); |
138 EXPECT_TRUE(download_manager); | 133 EXPECT_TRUE(download_manager); |
139 return download_manager; | 134 return download_manager; |
140 } | 135 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { | 352 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { |
358 GURL url = NavigateToMockURL("a"); | 353 GURL url = NavigateToMockURL("a"); |
359 FilePath full_file_name, dir; | 354 FilePath full_file_name, dir; |
360 GetDestinationPaths("a", &full_file_name, &dir); | 355 GetDestinationPaths("a", &full_file_name, &dir); |
361 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), | 356 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), |
362 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); | 357 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); |
363 save_package->Cancel(true); | 358 save_package->Cancel(true); |
364 } | 359 } |
365 | 360 |
366 } // namespace | 361 } // namespace |
OLD | NEW |