diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 01:22:44 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 01:22:44 +0000 |
commit | 6a498ea5ce42dac982a317d07c6f08c15ab70b73 (patch) | |
tree | a43392f36d8eae3b3ee699b1aa547bb8478a6481 | |
parent | 0983710c01d97e432bcb6b3efd0a0f1c36a16d2d (diff) | |
download | chromium_src-6a498ea5ce42dac982a317d07c6f08c15ab70b73.zip chromium_src-6a498ea5ce42dac982a317d07c6f08c15ab70b73.tar.gz chromium_src-6a498ea5ce42dac982a317d07c6f08c15ab70b73.tar.bz2 |
Move DownloadFileTest and DevtoolsManagerTest to content_unittests
BUG=90443
TEST=everything still works
Review URL: http://codereview.chromium.org/7889031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101885 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/chrome_tests.gypi | 2 | ||||
-rw-r--r-- | content/browser/download/download_file_unittest.cc | 5 | ||||
-rw-r--r-- | content/browser/mock_content_browser_client.cc | 10 | ||||
-rw-r--r-- | content/browser/mock_content_browser_client.h | 9 | ||||
-rw-r--r-- | content/content_tests.gypi | 2 |
5 files changed, 20 insertions, 8 deletions
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index fcba7dd..05fcf5f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1830,8 +1830,6 @@ 'test/base/v8_unit_test.h', 'test/data/resource.rc', 'tools/convert_dict/convert_dict_unittest.cc', - '../content/browser/debugger/devtools_manager_unittest.cc', - '../content/browser/download/download_file_unittest.cc', '../content/browser/in_process_webkit/dom_storage_unittest.cc', '../content/browser/in_process_webkit/indexed_db_quota_client_unittest.cc', '../content/browser/renderer_host/render_widget_host_unittest.cc', diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 7a176c5..190c2792 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -4,7 +4,6 @@ #include "base/file_util.h" #include "base/message_loop.h" -#include "base/scoped_temp_dir.h" #include "base/string_number_conversions.h" #include "content/browser/browser_thread.h" #include "content/browser/download/download_create_info.h" @@ -42,7 +41,6 @@ class DownloadFileTest : public testing::Test { } virtual void SetUp() { - ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); download_manager_delegate_.reset(new MockDownloadManagerDelegate()); download_manager_ = new MockDownloadManager( download_manager_delegate_.get(), &download_status_updater_); @@ -94,9 +92,6 @@ class DownloadFileTest : public testing::Test { } protected: - // Temporary directory for renamed downloads. - ScopedTempDir temp_dir_; - DownloadStatusUpdater download_status_updater_; scoped_ptr<MockDownloadManagerDelegate> download_manager_delegate_; scoped_refptr<DownloadManager> download_manager_; diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc index 51d770f..be23fd8 100644 --- a/content/browser/mock_content_browser_client.cc +++ b/content/browser/mock_content_browser_client.cc @@ -6,6 +6,7 @@ #include <string> +#include "base/logging.h" #include "base/file_path.h" #include "content/browser/webui/empty_web_ui_factory.h" #include "content/test/test_tab_contents_view.h" @@ -16,6 +17,9 @@ namespace content { +MockContentBrowserClient::MockContentBrowserClient() { +} + MockContentBrowserClient::~MockContentBrowserClient() { } @@ -250,7 +254,11 @@ void MockContentBrowserClient::ClearCookies(RenderViewHost* rvh) { } FilePath MockContentBrowserClient::GetDefaultDownloadDirectory() { - return FilePath(); + if (!download_dir_.IsValid()) { + bool result = download_dir_.CreateUniqueTempDir(); + CHECK(result); + } + return download_dir_.path(); } net::URLRequestContextGetter* diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h index 8af7faa..e5ae25b 100644 --- a/content/browser/mock_content_browser_client.h +++ b/content/browser/mock_content_browser_client.h @@ -8,7 +8,9 @@ #include <string> +#include "base/basictypes.h" #include "base/compiler_specific.h" +#include "base/scoped_temp_dir.h" #include "content/browser/content_browser_client.h" namespace content { @@ -16,6 +18,7 @@ namespace content { // Base for unit tests that need to mock the ContentBrowserClient. class MockContentBrowserClient : public ContentBrowserClient { public: + MockContentBrowserClient(); virtual ~MockContentBrowserClient(); virtual BrowserMainParts* CreateBrowserMainParts( @@ -137,6 +140,12 @@ class MockContentBrowserClient : public ContentBrowserClient { crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( const GURL& url) OVERRIDE; #endif + + private: + // Temporary directory for GetDefaultDownloadDirectory. + ScopedTempDir download_dir_; + + DISALLOW_COPY_AND_ASSIGN(MockContentBrowserClient); }; } // namespace content diff --git a/content/content_tests.gypi b/content/content_tests.gypi index 29ac579..fd79b78 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -98,8 +98,10 @@ 'browser/browser_thread_unittest.cc', 'browser/browser_url_handler_unittest.cc', 'browser/child_process_security_policy_unittest.cc', + 'browser/debugger/devtools_manager_unittest.cc', 'browser/device_orientation/provider_unittest.cc', 'browser/download/base_file_unittest.cc', + 'browser/download/download_file_unittest.cc', 'browser/download/download_status_updater_unittest.cc', 'browser/download/save_package_unittest.cc', 'browser/geolocation/device_data_provider_unittest.cc', |