Home | History | Annotate | Download | only in download
      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 
      9 TestDownloadShelf::TestDownloadShelf()
     10     : is_showing_(false),
     11       did_add_download_(false),
     12       download_manager_(NULL) {
     13 }
     14 
     15 TestDownloadShelf::~TestDownloadShelf() {
     16   if (download_manager_)
     17     download_manager_->RemoveObserver(this);
     18 }
     19 
     20 bool TestDownloadShelf::IsShowing() const {
     21   return is_showing_;
     22 }
     23 
     24 bool TestDownloadShelf::IsClosing() const {
     25   return false;
     26 }
     27 
     28 Browser* TestDownloadShelf::browser() const {
     29   return NULL;
     30 }
     31 
     32 void 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 
     41 void TestDownloadShelf::ManagerGoingDown(content::DownloadManager* manager) {
     42   DCHECK_EQ(manager, download_manager_);
     43   download_manager_ = NULL;
     44 }
     45 
     46 void TestDownloadShelf::DoAddDownload(content::DownloadItem* download) {
     47   did_add_download_ = true;
     48 }
     49 
     50 void TestDownloadShelf::DoShow() {
     51   is_showing_ = true;
     52 }
     53 
     54 void TestDownloadShelf::DoClose(CloseReason reason) {
     55   is_showing_ = false;
     56 }
     57 
     58 base::TimeDelta TestDownloadShelf::GetTransientDownloadShowDelay() {
     59   return base::TimeDelta();
     60 }
     61 
     62 content::DownloadManager* TestDownloadShelf::GetDownloadManager() {
     63   return download_manager_;
     64 }
     65