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 3 // found in the LICENSE file. 4 5 #include "chrome/browser/download/test_download_shelf.h" 6 7 #include "content/public/browser/download_manager.h" 8 TestDownloadShelf()9TestDownloadShelf::TestDownloadShelf() 10 : is_showing_(false), 11 did_add_download_(false), 12 download_manager_(NULL) { 13 } 14 ~TestDownloadShelf()15TestDownloadShelf::~TestDownloadShelf() { 16 if (download_manager_) 17 download_manager_->RemoveObserver(this); 18 } 19 IsShowing() const20bool TestDownloadShelf::IsShowing() const { 21 return is_showing_; 22 } 23 IsClosing() const24bool TestDownloadShelf::IsClosing() const { 25 return false; 26 } 27 browser() const28Browser* TestDownloadShelf::browser() const { 29 return NULL; 30 } 31 set_download_manager(content::DownloadManager * download_manager)32void TestDownloadShelf::set_download_manager( 33 content::DownloadManager* download_manager) { 34 if (download_manager_) 35 download_manager_->RemoveObserver(this); 36 download_manager_ = download_manager; 37 if (download_manager_) 38 download_manager_->AddObserver(this); 39 } 40 ManagerGoingDown(content::DownloadManager * manager)41void TestDownloadShelf::ManagerGoingDown(content::DownloadManager* manager) { 42 DCHECK_EQ(manager, download_manager_); 43 download_manager_ = NULL; 44 } 45 DoAddDownload(content::DownloadItem * download)46void TestDownloadShelf::DoAddDownload(content::DownloadItem* download) { 47 did_add_download_ = true; 48 } 49 DoShow()50void TestDownloadShelf::DoShow() { 51 is_showing_ = true; 52 } 53 DoClose(CloseReason reason)54void TestDownloadShelf::DoClose(CloseReason reason) { 55 is_showing_ = false; 56 } 57 GetTransientDownloadShowDelay()58base::TimeDelta TestDownloadShelf::GetTransientDownloadShowDelay() { 59 return base::TimeDelta(); 60 } 61 GetDownloadManager()62content::DownloadManager* TestDownloadShelf::GetDownloadManager() { 63 return download_manager_; 64 } 65