diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-13 21:59:13 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-13 21:59:13 +0000 |
commit | 6afa8d1bfe1b3794f03c6f6cfbf883d000099e37 (patch) | |
tree | 69fba00aa4b371c85eb0567c1d7f0673323668b1 /webkit/support | |
parent | 73dc267106977c19f8b7ec217a2faf100224ca37 (diff) | |
download | chromium_src-6afa8d1bfe1b3794f03c6f6cfbf883d000099e37.zip chromium_src-6afa8d1bfe1b3794f03c6f6cfbf883d000099e37.tar.gz chromium_src-6afa8d1bfe1b3794f03c6f6cfbf883d000099e37.tar.bz2 |
Remove dead code from webkit_support
webkit/support still has legacy code from when it was used to run layout
tests. This removes a large portion of code that did setup/teardown work
that was either only needed for layout tests and not webkit_unit_tests or
that was redundant with base::TestSuite.
R=darin@chromium.org
Review URL: https://codereview.chromium.org/22798008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217356 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/support')
-rw-r--r-- | webkit/support/drt_application_mac.h | 23 | ||||
-rw-r--r-- | webkit/support/drt_application_mac.mm | 24 | ||||
-rw-r--r-- | webkit/support/mac/DumpRenderTreePasteboard.h | 46 | ||||
-rw-r--r-- | webkit/support/mac/DumpRenderTreePasteboard.m | 214 | ||||
-rw-r--r-- | webkit/support/platform_support.h | 22 | ||||
-rw-r--r-- | webkit/support/platform_support_android.cc | 62 | ||||
-rw-r--r-- | webkit/support/platform_support_linux.cc | 35 | ||||
-rw-r--r-- | webkit/support/platform_support_mac.mm | 46 | ||||
-rw-r--r-- | webkit/support/platform_support_win.cc | 36 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 89 | ||||
-rw-r--r-- | webkit/support/webkit_support.gypi | 9 | ||||
-rw-r--r-- | webkit/support/webkit_support.h | 13 |
12 files changed, 16 insertions, 603 deletions
diff --git a/webkit/support/drt_application_mac.h b/webkit/support/drt_application_mac.h deleted file mode 100644 index 969894f..0000000 --- a/webkit/support/drt_application_mac.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_SUPPORT_DRT_APPLICATION_MAC_H -#define WEBKIT_SUPPORT_DRT_APPLICATION_MAC_H - -#include "base/mac/scoped_sending_event.h" -#include "base/message_loop/message_pump_mac.h" - -@interface CrDrtApplication : NSApplication<CrAppProtocol, - CrAppControlProtocol> { - @private - BOOL handlingSendEvent_; -} -// CrAppProtocol -- (BOOL)isHandlingSendEvent; - -// CrAppControlProtocol -- (void)setHandlingSendEvent:(BOOL)handlingSendEvent; -@end - -#endif // WEBKIT_SUPPORT_DRT_APPLICATION_MAC_H diff --git a/webkit/support/drt_application_mac.mm b/webkit/support/drt_application_mac.mm deleted file mode 100644 index 0c2f900..0000000 --- a/webkit/support/drt_application_mac.mm +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/support/drt_application_mac.h" - -#include "base/auto_reset.h" - -@implementation CrDrtApplication - -- (BOOL)isHandlingSendEvent { - return handlingSendEvent_; -} - -- (void)sendEvent:(NSEvent*)event { - base::AutoReset<BOOL> scoper(&handlingSendEvent_, YES); - [super sendEvent:event]; -} - -- (void)setHandlingSendEvent:(BOOL)handlingSendEvent { - handlingSendEvent_ = handlingSendEvent; -} - -@end diff --git a/webkit/support/mac/DumpRenderTreePasteboard.h b/webkit/support/mac/DumpRenderTreePasteboard.h deleted file mode 100644 index 41796ea3..0000000 --- a/webkit/support/mac/DumpRenderTreePasteboard.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 Apple, Inc. All rights reserved. - * (C) 2007 Graham Dennis (graham.dennis@gmail.com) - * (C) 2007 Eric Seidel <eric@webkit.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// This file comes from WebKit: -// WebKit/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.m -// It is copied here since that location is the best for pulling into Chromium -// and has a few includes commented out. darin@chromium.org suggests in the -// future we see if there is a better place for it to live so it could be -// shared. -// - -#import <AppKit/AppKit.h> -// #import <WebKit/WebTypesInternal.h> - -@interface DumpRenderTreePasteboard : NSPasteboard -- (NSInteger)declareType:(NSString *)type owner:(id)newOwner; -+ (void)releaseLocalPasteboards; -@end diff --git a/webkit/support/mac/DumpRenderTreePasteboard.m b/webkit/support/mac/DumpRenderTreePasteboard.m deleted file mode 100644 index 3e3cf1c..0000000 --- a/webkit/support/mac/DumpRenderTreePasteboard.m +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (C) 2005, 2006, 2007 Apple, Inc. All rights reserved. - * (C) 2007 Graham Dennis (graham.dennis@gmail.com) - * (C) 2007 Eric Seidel <eric@webkit.org> - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -// -// This file comes from WebKit: -// WebKit/Tools/DumpRenderTree/mac/DumpRenderTreePasteboard.m -// It is copied here since that location is the best for pulling into Chromium -// and has a few includes commented out. darin@chromium.org suggests in the -// future we see if there is a better place for it to live so it could be -// shared. -// - -// #import "DumpRenderTreeMac.h" -#import "DumpRenderTreePasteboard.h" - -// #import <WebKit/WebTypesInternal.h> - -@interface LocalPasteboard : NSPasteboard -{ - NSMutableArray *typesArray; - NSMutableSet *typesSet; - NSMutableDictionary *dataByType; - NSInteger changeCount; -} -@end - -static NSMutableDictionary *localPasteboards; - -@implementation DumpRenderTreePasteboard - -// Return a local pasteboard so we don't disturb the real pasteboards when running tests. -+ (NSPasteboard *)_pasteboardWithName:(NSString *)name -{ - static int number = 0; - if (!name) - name = [NSString stringWithFormat:@"LocalPasteboard%d", ++number]; - if (!localPasteboards) - localPasteboards = [[NSMutableDictionary alloc] init]; - LocalPasteboard *pasteboard = [localPasteboards objectForKey:name]; - if (pasteboard) - return pasteboard; - pasteboard = [[LocalPasteboard alloc] init]; - [localPasteboards setObject:pasteboard forKey:name]; - [pasteboard release]; - return pasteboard; -} - -+ (void)releaseLocalPasteboards -{ - [localPasteboards release]; - localPasteboards = nil; -} - -// Convenience method for JS so that it doesn't have to try and create a NSArray on the objc side instead -// of the usual WebScriptObject that is passed around -- (NSInteger)declareType:(NSString *)type owner:(id)newOwner -{ - return [self declareTypes:[NSArray arrayWithObject:type] owner:newOwner]; -} - -@end - -@implementation LocalPasteboard - -+ (id)alloc -{ - return NSAllocateObject(self, 0, 0); -} - -- (id)init -{ - typesArray = [[NSMutableArray alloc] init]; - typesSet = [[NSMutableSet alloc] init]; - dataByType = [[NSMutableDictionary alloc] init]; - return self; -} - -- (void)dealloc -{ - [typesArray release]; - [typesSet release]; - [dataByType release]; - [super dealloc]; -} - -- (NSString *)name -{ - return nil; -} - -- (void)releaseGlobally -{ -} - -- (NSInteger)declareTypes:(NSArray *)newTypes owner:(id)newOwner -{ - [typesArray removeAllObjects]; - [typesSet removeAllObjects]; - [dataByType removeAllObjects]; - return [self addTypes:newTypes owner:newOwner]; -} - -- (NSInteger)addTypes:(NSArray *)newTypes owner:(id)newOwner -{ - unsigned count = [newTypes count]; - unsigned i; - for (i = 0; i < count; ++i) { - NSString *type = [newTypes objectAtIndex:i]; - NSString *setType = [typesSet member:type]; - if (!setType) { - setType = [type copy]; - [typesArray addObject:setType]; - [typesSet addObject:setType]; - [setType release]; - } - if (newOwner && [newOwner respondsToSelector:@selector(pasteboard:provideDataForType:)]) - [newOwner pasteboard:self provideDataForType:setType]; - } - return ++changeCount; -} - -- (NSInteger)changeCount -{ - return changeCount; -} - -- (NSArray *)types -{ - return typesArray; -} - -- (NSString *)availableTypeFromArray:(NSArray *)types -{ - unsigned count = [types count]; - unsigned i; - for (i = 0; i < count; ++i) { - NSString *type = [types objectAtIndex:i]; - NSString *setType = [typesSet member:type]; - if (setType) - return setType; - } - return nil; -} - -- (BOOL)setData:(NSData *)data forType:(NSString *)dataType -{ - if (data == nil) - data = [NSData data]; - if (![typesSet containsObject:dataType]) - return NO; - [dataByType setObject:data forKey:dataType]; - ++changeCount; - return YES; -} - -- (NSData *)dataForType:(NSString *)dataType -{ - return [dataByType objectForKey:dataType]; -} - -- (BOOL)setPropertyList:(id)propertyList forType:(NSString *)dataType -{ - CFDataRef data = NULL; - if (propertyList) - data = CFPropertyListCreateXMLData(NULL, propertyList); - BOOL result = [self setData:(NSData *)data forType:dataType]; - if (data) - CFRelease(data); - return result; -} - -- (BOOL)setString:(NSString *)string forType:(NSString *)dataType -{ - CFDataRef data = NULL; - if (string) { - if ([string length] == 0) - data = CFDataCreate(NULL, NULL, 0); - else - data = CFStringCreateExternalRepresentation(NULL, (CFStringRef)string, kCFStringEncodingUTF8, 0); - } - BOOL result = [self setData:(NSData *)data forType:dataType]; - if (data) - CFRelease(data); - return result; -} - -@end diff --git a/webkit/support/platform_support.h b/webkit/support/platform_support.h deleted file mode 100644 index 73ab950..0000000 --- a/webkit/support/platform_support.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_SUPPORT_PLATFORM_SUPORT_H_ -#define WEBKIT_SUPPORT_PLATFORM_SUPORT_H_ - -namespace webkit_support { -// Called before WebKit::initialize(). -void BeforeInitialize(); - -// Called after WebKit::initialize(). -void AfterInitialize(); - -// Called before WebKit::shutdown(). -void BeforeShutdown(); - -// Called after WebKit::shutdown(). -void AfterShutdown(); -} // namespace webkit_support - -#endif // WEBKIT_SUPPORT_PLATFORM_SUPORT_H_ diff --git a/webkit/support/platform_support_android.cc b/webkit/support/platform_support_android.cc deleted file mode 100644 index 582dc3a..0000000 --- a/webkit/support/platform_support_android.cc +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/support/platform_support.h" - -#include "base/android/jni_android.h" -#include "base/file_util.h" -#include "base/files/file_path.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/strings/string16.h" -#include "base/strings/string_piece.h" -#include "base/test/test_support_android.h" -#include "grit/webkit_resources.h" -#include "media/base/android/media_jni_registrar.h" -#include "net/android/net_jni_registrar.h" -#include "net/android/network_library.h" -#include "ui/android/ui_jni_registrar.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/gl/android/gl_jni_registrar.h" -#include "url/gurl.h" -#include "webkit/support/test_webkit_platform_support.h" - -namespace { - -// The place where the Android layout test script will put the required tools -// and resources. Must keep consistent with DEVICE_DRT_DIR in -// WebKit/Tools/Scripts/webkitpy/layout_tests/port/chromium_android.py. -const char kDumpRenderTreeDir[] = "/data/local/tmp/drt"; - -} - -namespace webkit_support { - -void BeforeInitialize() { - base::InitAndroidTestPaths(); - - // Place cache under kDumpRenderTreeDir to allow the NRWT script to clear it. - base::FilePath path(kDumpRenderTreeDir); - path = path.Append("cache"); - PathService::Override(base::DIR_CACHE, path); - - // Set XML_CATALOG_FILES environment variable to blank to prevent libxml from - // loading and complaining the non-exsistent /etc/xml/catalog file. - setenv("XML_CATALOG_FILES", "", 0); - - JNIEnv* env = base::android::AttachCurrentThread(); - net::android::RegisterNetworkLibrary(env); -} - -void AfterInitialize() { -} - -void BeforeShutdown() { -} - -void AfterShutdown() { -} - -} // namespace webkit_support - diff --git a/webkit/support/platform_support_linux.cc b/webkit/support/platform_support_linux.cc deleted file mode 100644 index 85cc841..0000000 --- a/webkit/support/platform_support_linux.cc +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/support/platform_support.h" - -#include "base/file_util.h" -#include "base/files/file_path.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/strings/string16.h" -#include "base/strings/string_piece.h" -#include "grit/webkit_resources.h" -#include "ui/base/resource/resource_bundle.h" -#include "webkit/support/test_webkit_platform_support.h" - -namespace webkit_support { - -// TODO(tkent): Implement some of the followings for platform-dependent tasks -// such as loading resource. - -void BeforeInitialize() { -} - -void AfterInitialize() { -} - -void BeforeShutdown() { -} - -void AfterShutdown() { -} - -} // namespace webkit_support - diff --git a/webkit/support/platform_support_mac.mm b/webkit/support/platform_support_mac.mm deleted file mode 100644 index 6d96ec1..0000000 --- a/webkit/support/platform_support_mac.mm +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/support/platform_support.h" - -#import <AppKit/AppKit.h> -#include <AvailabilityMacros.h> -#import <Foundation/Foundation.h> -#import <objc/objc-runtime.h> - -#include "base/base_paths.h" -#include "base/file_util.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/strings/string16.h" -#include "base/strings/utf_string_conversions.h" -#include "grit/webkit_resources.h" -#include "ui/base/resource/data_pack.h" -#import "webkit/support/drt_application_mac.h" -#import "webkit/support/mac/DumpRenderTreePasteboard.h" -#include "webkit/support/test_webkit_platform_support.h" - -namespace webkit_support { - -static NSAutoreleasePool* autorelease_pool; - -void BeforeInitialize() { - [CrDrtApplication sharedApplication]; - autorelease_pool = [[NSAutoreleasePool alloc] init]; - DCHECK(autorelease_pool); -} - -void AfterInitialize() { -} - -void BeforeShutdown() { -} - -void AfterShutdown() { - [DumpRenderTreePasteboard releaseLocalPasteboards]; - [autorelease_pool drain]; -} - -} // namespace webkit_support - diff --git a/webkit/support/platform_support_win.cc b/webkit/support/platform_support_win.cc deleted file mode 100644 index ce601c5..0000000 --- a/webkit/support/platform_support_win.cc +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "webkit/support/platform_support.h" - -#include "base/base_paths.h" -#include "base/file_util.h" -#include "base/files/file_path.h" -#include "base/logging.h" -#include "base/path_service.h" -#include "base/strings/string16.h" -#include "base/strings/string_piece.h" -#include "base/win/resource_util.h" -#include "grit/blink_resources.h" -#include "grit/webkit_resources.h" -#include "ui/base/resource/resource_bundle.h" -#include "webkit/support/test_webkit_platform_support.h" - - -namespace webkit_support { - -void BeforeInitialize() { -} - -void AfterInitialize() { -} - -void BeforeShutdown() { -} - -void AfterShutdown() { -} - -} // namespace webkit_support - diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index c584638..6f9d41a 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -4,77 +4,26 @@ #include "webkit/support/webkit_support.h" -#include "base/command_line.h" -#include "base/debug/debugger.h" -#include "base/debug/stack_trace.h" -#include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "base/path_service.h" -#include "base/process/memory.h" #include "base/run_loop.h" -#include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/public/web/WebCache.h" #include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" #include "url/url_util.h" -#include "webkit/child/webkitplatformsupport_impl.h" #include "webkit/common/user_agent/user_agent.h" #include "webkit/common/user_agent/user_agent_util.h" -#include "webkit/glue/webkit_glue.h" -#include "webkit/support/platform_support.h" #include "webkit/support/test_webkit_platform_support.h" #if defined(OS_ANDROID) -#include "base/test/test_support_android.h" +#include "base/android/jni_android.h" +#include "net/android/network_library.h" #endif -namespace { - -// All fatal log messages (e.g. DCHECK failures) imply unit test failures -void UnitTestAssertHandler(const std::string& str) { - FAIL() << str; -} - -void InitLogging() { -#if defined(OS_WIN) - if (!::IsDebuggerPresent()) { - UINT new_flags = SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX - | SEM_NOGPFAULTERRORBOX; - - // Preserve existing error mode, as discussed at - // http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx - UINT existing_flags = SetErrorMode(new_flags); - SetErrorMode(existing_flags | new_flags); - - // Don't pop up dialog on assertion failure, log to stdout instead. - _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); - _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDOUT); - } +#if defined(OS_MACOSX) +#include "base/test/mock_chrome_application_mac.h" #endif -#if defined(OS_ANDROID) - // On Android we expect the log to appear in logcat. - base::InitAndroidTestLogging(); -#else - base::FilePath log_filename; - PathService::Get(base::DIR_EXE, &log_filename); - log_filename = log_filename.AppendASCII("DumpRenderTree.log"); - logging::LoggingSettings settings; - // Only log to a file. This prevents debugging output from disrupting - // whether or not we pass. - settings.logging_dest = logging::LOG_TO_FILE; - settings.log_file = log_filename.value().c_str(); - settings.delete_old = logging::DELETE_OLD_LOG_FILE; - logging::InitLogging(settings); - - // We want process and thread IDs because we may have multiple processes. - const bool kProcessId = true; - const bool kThreadId = true; - const bool kTimestamp = true; - const bool kTickcount = true; - logging::SetLogItems(kProcessId, kThreadId, !kTimestamp, kTickcount); -#endif // else defined(OS_ANDROID) -} +namespace { class TestEnvironment { public: @@ -86,7 +35,6 @@ class TestEnvironment { #endif TestEnvironment() { - logging::SetLogAssertHandler(UnitTestAssertHandler); main_message_loop_.reset(new MessageLoopType); // TestWebKitPlatformSupport must be instantiated after MessageLoopType. @@ -109,30 +57,24 @@ TestEnvironment* test_environment; namespace webkit_support { void SetUpTestEnvironmentForUnitTests() { - base::debug::EnableInProcessStackDumping(); - base::EnableTerminationOnHeapCorruption(); - - // Initialize the singleton CommandLine with fixed values. Some code refer to - // CommandLine::ForCurrentProcess(). We don't use the actual command-line - // arguments of DRT to avoid unexpected behavior change. - // - // webkit/glue/plugin/plugin_list_posix.cc checks --debug-plugin-loading. - // webkit/glue/plugin/plugin_list_win.cc checks --old-wmp. - // If DRT needs these flags, specify them in the following kFixedArguments. - const char* kFixedArguments[] = {"DumpRenderTree"}; - CommandLine::Init(arraysize(kFixedArguments), kFixedArguments); - WebKit::WebRuntimeFeatures::enableStableFeatures(true); WebKit::WebRuntimeFeatures::enableExperimentalFeatures(true); WebKit::WebRuntimeFeatures::enableTestOnlyFeatures(true); +#if defined(OS_ANDROID) + JNIEnv* env = base::android::AttachCurrentThread(); + net::android::RegisterNetworkLibrary(env); +#endif + +#if defined(OS_MACOSX) + mock_cr_app::RegisterMockCrApp(); +#endif + // Explicitly initialize the GURL library before spawning any threads. // Otherwise crash may happend when different threads try to create a GURL // at same time. url_util::Initialize(); - webkit_support::BeforeInitialize(); test_environment = new TestEnvironment; - webkit_support::AfterInitialize(); webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct( "DumpRenderTree/0.0.0.0"), false); } @@ -142,14 +84,11 @@ void TearDownTestEnvironment() { // http://code.google.com/p/chromium/issues/detail?id=9500 base::RunLoop().RunUntilIdle(); - BeforeShutdown(); if (RunningOnValgrind()) WebKit::WebCache::clear(); WebKit::shutdown(); delete test_environment; test_environment = NULL; - AfterShutdown(); - logging::CloseLogFile(); } } // namespace webkit_support diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index bc7fae0b..db8a3a1 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -45,13 +45,6 @@ 'UNIT_TEST' ], 'sources': [ - 'drt_application_mac.h', - 'drt_application_mac.mm', - 'platform_support.h', - 'platform_support_android.cc', - 'platform_support_linux.cc', - 'platform_support_mac.mm', - 'platform_support_win.cc', 'test_webkit_platform_support.cc', 'test_webkit_platform_support.h', 'webkit_support.cc', @@ -107,8 +100,6 @@ '<(DEPTH)/base/base.gyp:base', ], 'sources': [ - '<(DEPTH)/webkit/support/mac/DumpRenderTreePasteboard.h', - '<(DEPTH)/webkit/support/mac/DumpRenderTreePasteboard.m', '<(DEPTH)/webkit/support/mock_webclipboard_impl.cc', '<(DEPTH)/webkit/support/mock_webclipboard_impl.h', ], diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h index 9369be1..ed09e67 100644 --- a/webkit/support/webkit_support.h +++ b/webkit/support/webkit_support.h @@ -5,19 +5,10 @@ #ifndef WEBKIT_SUPPORT_WEBKIT_SUPPORT_H_ #define WEBKIT_SUPPORT_WEBKIT_SUPPORT_H_ -// This package provides functions used by DumpRenderTree/chromium. +// This package provides functions used by webkit_unit_tests. namespace webkit_support { -// Initializes or terminates a test environment. -// |unit_test_mode| should be set to true when running in a TestSuite, in which -// case no AtExitManager is created and ICU is not initialized (as it is already -// done by the TestSuite). -// SetUpTestEnvironment() and SetUpTestEnvironmentForUnitTests() calls -// WebKit::initialize(). -// TearDownTestEnvironment() calls WebKit::shutdown(). -// SetUpTestEnvironmentForUnitTests() should be used when running in a -// TestSuite, in which case no AtExitManager is created and ICU is not -// initialized (as it is already done by the TestSuite). +// Initializes or terminates a test environment for unit tests. void SetUpTestEnvironmentForUnitTests(); void TearDownTestEnvironment(); |