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 | |
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')
-rw-r--r-- | chrome/browser/download/download_request_manager_unittest.cc | 23 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_factory.h | 1 | ||||
-rw-r--r-- | chrome/test/test_tab_contents.h | 8 | ||||
-rw-r--r-- | chrome/test/unit/unit_tests.scons | 5 |
4 files changed, 30 insertions, 7 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_; diff --git a/chrome/browser/tab_contents/tab_contents_factory.h b/chrome/browser/tab_contents/tab_contents_factory.h index 0841aa1..e140bc7 100644 --- a/chrome/browser/tab_contents/tab_contents_factory.h +++ b/chrome/browser/tab_contents/tab_contents_factory.h @@ -8,6 +8,7 @@ #include <string> #include "chrome/browser/tab_contents/tab_contents_type.h" +class GURL; class TabContents; // Extend from this class to implement a custom tab contents type. See diff --git a/chrome/test/test_tab_contents.h b/chrome/test/test_tab_contents.h index 56c2e24..541bec0 100644 --- a/chrome/test/test_tab_contents.h +++ b/chrome/test/test_tab_contents.h @@ -6,9 +6,15 @@ #define CHROME_BROWSER_TEST_TEST_TAB_CONTENTS_H_ #include "base/string_util.h" -#include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_factory.h" +// TODO(port): get rid of this section and finish porting. +#if defined(OS_WIN) +#include "chrome/browser/tab_contents/tab_contents.h" +#else +#include "chrome/common/temp_scaffolding_stubs.h" +#endif + // TabContents typed created by TestTabContentsFactory. class TestTabContents : public TabContents { public: diff --git a/chrome/test/unit/unit_tests.scons b/chrome/test/unit/unit_tests.scons index 9b7bdb8..450b500 100644 --- a/chrome/test/unit/unit_tests.scons +++ b/chrome/test/unit/unit_tests.scons @@ -393,8 +393,10 @@ if not env.Bit('windows'): '$CHROME_DIR/browser/bookmarks/bookmark_table_model_unittest.cc', '$CHROME_DIR/browser/bookmarks/bookmark_utils_unittest.cc', '$CHROME_DIR/browser/browser_commands_unittest.cc', + # This test is mostly about renaming downloads to safe file names. As such + # we don't need/want to port it to linux. We might want to write our own + # tests for the download manager on linux, though. '$CHROME_DIR/browser/download/download_manager_unittest.cc', - '$CHROME_DIR/browser/download/download_request_manager_unittest.cc', '$CHROME_DIR/browser/extensions/user_script_master_unittest.cc', '$CHROME_DIR/browser/importer/firefox_importer_unittest.cc', '$CHROME_DIR/browser/importer/importer_unittest.cc', @@ -429,7 +431,6 @@ if not env.Bit('windows'): '$CHROME_DIR/common/time_format_unittest.cc', '$CHROME_DIR/common/win_util_unittest.cc', '$CHROME_DIR/test/browser_with_test_window_test.cc', - '$CHROME_DIR/test/test_tab_contents.cc', '$CHROME_DIR/views/focus_manager_unittest.cc', '$CHROME_DIR/views/grid_layout_unittest.cc', '$CHROME_DIR/views/label_unittest.cc', |