From c8af9bba42a3f9275220c65b4aef626d2387140c Mon Sep 17 00:00:00 2001 From: "michaeln@chromium.org" Date: Wed, 2 Jun 2010 21:15:22 +0000 Subject: Quick fix to avoid crashing in unit tests when HTTPTestServer::CreateServer returns NULL. BUG=45664 TEST=none Review URL: http://codereview.chromium.org/2501002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48764 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/appcache/appcache_update_job_unittest.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'webkit') diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 09c349d..7ea664f 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -373,10 +373,14 @@ class AppCacheUpdateJobTest : public testing::Test, // Cleanup function; must be called on the IO Thread. static void CleanupIOThread() { - http_server_->Release(); - http_server_ = NULL; - request_context_->Release(); - request_context_ = NULL; + if (http_server_) { + http_server_->Release(); + http_server_ = NULL; + } + if (request_context_) { + request_context_->Release(); + request_context_ = NULL; + } io_thread_shutdown_event_->Signal(); } @@ -394,6 +398,10 @@ class AppCacheUpdateJobTest : public testing::Test, // when it goes out of scope. template void RunTestOnIOThread(Method method) { + EXPECT_TRUE(http_server_); + if (!http_server_) + return; // Don't even try to run any of these tests w/o the server. + event_.reset(new base::WaitableEvent(false, false)); io_thread_->message_loop()->PostTask( FROM_HERE, NewRunnableMethod(this, method)); @@ -3038,14 +3046,7 @@ TEST_F(AppCacheUpdateJobTest, ManifestRedirect) { RunTestOnIOThread(&AppCacheUpdateJobTest::ManifestRedirectTest); } -#if defined(OS_MACOSX) -// Crashing on mac webkit bots. http://crbug.com/45664 -#define MAYBE_ManifestWrongMimeType DISABLED_ManifestWrongMimeType -#else -#define MAYBE_ManifestWrongMimeType ManifestWrongMimeType -#endif - -TEST_F(AppCacheUpdateJobTest, MAYBE_ManifestWrongMimeType) { +TEST_F(AppCacheUpdateJobTest, ManifestWrongMimeType) { RunTestOnIOThread(&AppCacheUpdateJobTest::ManifestWrongMimeTypeTest); } -- cgit v1.1