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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) | 92 #if defined(OS_CHROMEOS) && defined(TOUCH_UI) |
93 const ActiveDownloadsUI::DownloadList& GetDownloads() const { | 93 const ActiveDownloadsUI::DownloadList& GetDownloads() const { |
94 TabContents* download_contents = ActiveDownloadsUI::GetPopup(NULL); | 94 TabContents* download_contents = ActiveDownloadsUI::GetPopup(NULL); |
95 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( | 95 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( |
96 download_contents->web_ui()); | 96 download_contents->web_ui()); |
97 EXPECT_TRUE(downloads_ui); | 97 EXPECT_TRUE(downloads_ui); |
98 return downloads_ui->GetDownloads(); | 98 return downloads_ui->GetDownloads(); |
99 } | 99 } |
100 #elif defined(OS_CHROMEOS) | 100 #elif defined(OS_CHROMEOS) && !defined(USE_AURA) |
101 const ActiveDownloadsUI::DownloadList& GetDownloads() const { | 101 const ActiveDownloadsUI::DownloadList& GetDownloads() const { |
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 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, | 313 ASSERT_TRUE(GetCurrentTab()->SavePage(full_file_name, dir, |
314 SavePackage::SAVE_AS_ONLY_HTML)); | 314 SavePackage::SAVE_AS_ONLY_HTML)); |
315 | 315 |
316 EXPECT_EQ(url, WaitForSavePackageToFinish()); | 316 EXPECT_EQ(url, WaitForSavePackageToFinish()); |
317 | 317 |
318 CheckDownloadUI(full_file_name); | 318 CheckDownloadUI(full_file_name); |
319 CheckDownloadHistory(url, full_file_name, 1); // a.htm is 1 file. | 319 CheckDownloadHistory(url, full_file_name, 1); // a.htm is 1 file. |
320 | 320 |
321 EXPECT_EQ(GetDownloadManager()->RemoveAllDownloads(), 1); | 321 EXPECT_EQ(GetDownloadManager()->RemoveAllDownloads(), 1); |
322 | 322 |
323 #if defined(OS_CHROMEOS) | 323 #if defined(OS_CHROMEOS) && !defined(USE_AURA) |
324 EXPECT_EQ(GetDownloads().size(), 0U); | 324 EXPECT_EQ(GetDownloads().size(), 0U); |
325 #endif | 325 #endif |
326 | 326 |
327 // Should not be in history. | 327 // Should not be in history. |
328 QueryDownloadHistory(); | 328 QueryDownloadHistory(); |
329 EXPECT_EQ(std::find_if(history_entries_.begin(), history_entries_.end(), | 329 EXPECT_EQ(std::find_if(history_entries_.begin(), history_entries_.end(), |
330 DownloadPersistentStoreInfoMatch(url, full_file_name, 1)), | 330 DownloadPersistentStoreInfoMatch(url, full_file_name, 1)), |
331 history_entries_.end()); | 331 history_entries_.end()); |
332 | 332 |
333 EXPECT_TRUE(file_util::PathExists(full_file_name)); | 333 EXPECT_TRUE(file_util::PathExists(full_file_name)); |
(...skipping 18 matching lines...) Expand all Loading... |
352 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { | 352 IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, ExplicitCancel) { |
353 GURL url = NavigateToMockURL("a"); | 353 GURL url = NavigateToMockURL("a"); |
354 FilePath full_file_name, dir; | 354 FilePath full_file_name, dir; |
355 GetDestinationPaths("a", &full_file_name, &dir); | 355 GetDestinationPaths("a", &full_file_name, &dir); |
356 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), | 356 scoped_refptr<SavePackage> save_package(new SavePackage(GetCurrentTab(), |
357 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); | 357 SavePackage::SAVE_AS_ONLY_HTML, full_file_name, dir)); |
358 save_package->Cancel(true); | 358 save_package->Cancel(true); |
359 } | 359 } |
360 | 360 |
361 } // namespace | 361 } // namespace |
OLD | NEW |