diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-09 21:11:36 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-09 21:11:36 +0000 |
commit | 3d68b595e6db3e79daca5430d3f6bf0562262a84 (patch) | |
tree | c7ffc49ae01abeab2c6614bed41c626337a8538e /chrome/browser/download | |
parent | 2e71662080eac468322f9b61a81a3abb4c9d40bc (diff) | |
download | chromium_src-3d68b595e6db3e79daca5430d3f6bf0562262a84.zip chromium_src-3d68b595e6db3e79daca5430d3f6bf0562262a84.tar.gz chromium_src-3d68b595e6db3e79daca5430d3f6bf0562262a84.tar.bz2 |
Enable download_request_manager_unittest on linux.
Review URL: http://codereview.chromium.org/41002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r-- | chrome/browser/download/download_request_manager_unittest.cc | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/chrome/browser/download/download_request_manager_unittest.cc b/chrome/browser/download/download_request_manager_unittest.cc index 61da19e..683ee09 100644 --- a/chrome/browser/download/download_request_manager_unittest.cc +++ b/chrome/browser/download/download_request_manager_unittest.cc @@ -9,8 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" class DownloadRequestManagerTest : public testing::Test, - public DownloadRequestManager::Callback, - public DownloadRequestManager::TestingDelegate { + public DownloadRequestManager::Callback { public: virtual void SetUp() { allow_download_ = true; @@ -20,7 +19,8 @@ class DownloadRequestManagerTest : public testing::Test, contents->set_commit_on_navigate(true); controller_ = new NavigationController(contents, &profile_); download_request_manager_ = new DownloadRequestManager(NULL, NULL); - DownloadRequestManager::SetTestingDelegate(this); + test_delegate_.reset(new DownloadRequestManagerTestDelegate(this)); + DownloadRequestManager::SetTestingDelegate(test_delegate_.get()); } virtual void TearDown() { @@ -40,14 +40,29 @@ class DownloadRequestManagerTest : public testing::Test, controller_->active_contents(), this); } - virtual bool ShouldAllowDownload() { + bool ShouldAllowDownload() { ask_allow_count_++; return allow_download_; } protected: + class DownloadRequestManagerTestDelegate + : public DownloadRequestManager::TestingDelegate { + public: + DownloadRequestManagerTestDelegate(DownloadRequestManagerTest* test) + : test_(test) { } + + virtual bool ShouldAllowDownload() { + return test_->ShouldAllowDownload(); + } + + private: + DownloadRequestManagerTest* test_; + }; + TestingProfile profile_; scoped_ptr<TestTabContentsFactory> factory_; + scoped_ptr<DownloadRequestManagerTestDelegate> test_delegate_; NavigationController* controller_; scoped_refptr<DownloadRequestManager> download_request_manager_; |