From 366af8acfca9eca7e77a453c514dd02e2d638577 Mon Sep 17 00:00:00 2001 From: "levin@chromium.org" Date: Wed, 14 Jan 2009 08:27:39 +0000 Subject: Fix UrlFetcher unittest. TBR=joshia,iyengar Review URL: http://codereview.chromium.org/18220 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8001 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc | 5 +++++ chrome/browser/url_fetcher_unittest.cc | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'chrome/browser') diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc index d40c21b..ae6b684 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -7,6 +7,7 @@ #include "base/message_loop.h" #include "chrome/browser/renderer_security_policy.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" +#include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/render_messages.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" @@ -103,6 +104,10 @@ class ResourceDispatcherHostTest : public testing::Test, URLRequest::RegisterProtocolFactory("test", NULL); RendererSecurityPolicy::GetInstance()->Remove(0); + // The plugin lib is automatically loaded during these test + // and we want a clean environment for other tests. + ChromePluginLib::UnloadAllPlugins(); + // Flush the message loop to make Purify happy. message_loop_.RunAllPending(); } diff --git a/chrome/browser/url_fetcher_unittest.cc b/chrome/browser/url_fetcher_unittest.cc index dccf560..7e28f33 100644 --- a/chrome/browser/url_fetcher_unittest.cc +++ b/chrome/browser/url_fetcher_unittest.cc @@ -6,6 +6,7 @@ #include "base/time.h" #include "chrome/browser/url_fetcher.h" #include "chrome/browser/url_fetcher_protect.h" +#include "chrome/common/chrome_plugin_lib.h" #include "net/base/ssl_test_util.h" #include "net/url_request/url_request_unittest.h" #include "testing/gtest/include/gtest/gtest.h" @@ -33,6 +34,13 @@ class URLFetcherTest : public testing::Test, public URLFetcher::Delegate { const std::string& data); protected: + virtual void SetUp() { + testing::Test::SetUp(); + + // Ensure that any plugin operations done by other tests are cleaned up. + ChromePluginLib::UnloadAllPlugins(); + } + // URLFetcher is designed to run on the main UI thread, but in our tests // we assume that the current thread is the IO thread where the URLFetcher // dispatches its requests to. When we wish to simulate being used from -- cgit v1.1