Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1257)

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 9224002: Make WebUI objects not derive from WebUI. WebUI objects own the controller. This is the ownership... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to head to clear linux_chromeos browsertest failures Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 // is present in the UI (currently only on chromeos). 587 // is present in the UI (currently only on chromeos).
588 void CheckDownloadUI(Browser* browser, bool expected_non_cros, 588 void CheckDownloadUI(Browser* browser, bool expected_non_cros,
589 bool expected_cros, const FilePath& filename) { 589 bool expected_cros, const FilePath& filename) {
590 #if defined(OS_CHROMEOS) && !defined(USE_AURA) 590 #if defined(OS_CHROMEOS) && !defined(USE_AURA)
591 Browser* popup = ActiveDownloadsUI::GetPopup(); 591 Browser* popup = ActiveDownloadsUI::GetPopup();
592 EXPECT_EQ(expected_cros, popup != NULL); 592 EXPECT_EQ(expected_cros, popup != NULL);
593 if (!popup || filename.empty()) 593 if (!popup || filename.empty())
594 return; 594 return;
595 595
596 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>( 596 ActiveDownloadsUI* downloads_ui = static_cast<ActiveDownloadsUI*>(
597 popup->GetSelectedWebContents()->GetWebUI()); 597 popup->GetSelectedWebContents()->GetWebUI()->GetController());
598 598
599 ASSERT_TRUE(downloads_ui); 599 ASSERT_TRUE(downloads_ui);
600 const ActiveDownloadsUI::DownloadList& downloads = 600 const ActiveDownloadsUI::DownloadList& downloads =
601 downloads_ui->GetDownloads(); 601 downloads_ui->GetDownloads();
602 EXPECT_EQ(downloads.size(), 1U); 602 EXPECT_EQ(downloads.size(), 1U);
603 603
604 FilePath full_path(DestinationFile(browser, filename)); 604 FilePath full_path(DestinationFile(browser, filename));
605 bool exists = false; 605 bool exists = false;
606 for (size_t i = 0; i < downloads.size(); ++i) { 606 for (size_t i = 0; i < downloads.size(); ++i) {
607 if (downloads[i]->GetFullPath() == full_path) { 607 if (downloads[i]->GetFullPath() == full_path) {
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 1730
1731 // Check state. 1731 // Check state.
1732 EXPECT_EQ(1, browser()->tab_count()); 1732 EXPECT_EQ(1, browser()->tab_count());
1733 ASSERT_TRUE(CheckDownloadFullPaths(browser(), 1733 ASSERT_TRUE(CheckDownloadFullPaths(browser(),
1734 target_file_full_path, 1734 target_file_full_path,
1735 OriginFile(file))); 1735 OriginFile(file)));
1736 1736
1737 // Temporary downloads won't be visible. 1737 // Temporary downloads won't be visible.
1738 CheckDownloadUI(browser(), false, false, file); 1738 CheckDownloadUI(browser(), false, false, file);
1739 } 1739 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698