summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 21:48:40 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-20 21:48:40 +0000
commit899580bd8b49c615203d423b5ebdb8047467a7ed (patch)
tree29dfc63144157fefd88c88cd97cfae2c4535ac96
parentdd83f25f7791ff71c2bd9aea2447764d1932bc30 (diff)
downloadchromium_src-899580bd8b49c615203d423b5ebdb8047467a7ed.zip
chromium_src-899580bd8b49c615203d423b5ebdb8047467a7ed.tar.gz
chromium_src-899580bd8b49c615203d423b5ebdb8047467a7ed.tar.bz2
remove now-unused arguments from TestWebkitPlatformSupport
Just trying to simplify a bit. Were previously only used in DRT setup near hear (and same for test_shell) https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp&q=DumpRenderTree.cpp&sq=package:chromium&type=cs&l=82 R=jamesr@chromium.org BUG=239107 Review URL: https://codereview.chromium.org/17423005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207592 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/support/platform_support.h4
-rw-r--r--webkit/support/platform_support_android.cc32
-rw-r--r--webkit/support/platform_support_linux.cc4
-rw-r--r--webkit/support/platform_support_mac.mm65
-rw-r--r--webkit/support/platform_support_win.cc4
-rw-r--r--webkit/support/test_webkit_platform_support.cc14
-rw-r--r--webkit/support/test_webkit_platform_support.h10
-rw-r--r--webkit/support/webkit_support.cc100
-rw-r--r--webkit/support/webkit_support.h6
9 files changed, 43 insertions, 196 deletions
diff --git a/webkit/support/platform_support.h b/webkit/support/platform_support.h
index eb80e82..73ab950 100644
--- a/webkit/support/platform_support.h
+++ b/webkit/support/platform_support.h
@@ -7,10 +7,10 @@
namespace webkit_support {
// Called before WebKit::initialize().
-void BeforeInitialize(bool unit_test_mode);
+void BeforeInitialize();
// Called after WebKit::initialize().
-void AfterInitialize(bool unit_test_mode);
+void AfterInitialize();
// Called before WebKit::shutdown().
void BeforeShutdown();
diff --git a/webkit/support/platform_support_android.cc b/webkit/support/platform_support_android.cc
index 9ea968e..ebe272a 100644
--- a/webkit/support/platform_support_android.cc
+++ b/webkit/support/platform_support_android.cc
@@ -34,7 +34,7 @@ const char kDumpRenderTreeDir[] = "/data/local/tmp/drt";
namespace webkit_support {
-void BeforeInitialize(bool unit_test_mode) {
+void BeforeInitialize() {
base::InitAndroidTestPaths();
// Place cache under kDumpRenderTreeDir to allow the NRWT script to clear it.
@@ -48,40 +48,12 @@ void BeforeInitialize(bool unit_test_mode) {
JNIEnv* env = base::android::AttachCurrentThread();
net::android::RegisterNetworkLibrary(env);
-
- // Chromium binaries will register their Jni bindings through the library
- // loader that is part of content/. WebKit uses a different path, so the
- // bindings have to be initialized separately as well.
- if (!unit_test_mode) {
- media::RegisterJni(env);
- net::android::RegisterJni(env);
- ui::android::RegisterJni(env);
- ui::gl::android::RegisterJni(env);
- }
}
-void AfterInitialize(bool unit_test_mode) {
+void AfterInitialize() {
base::FilePath data_path(kDumpRenderTreeDir);
data_path = data_path.Append("DumpRenderTree.pak");
ResourceBundle::InitSharedInstanceWithPakPath(data_path);
-
- if (unit_test_mode)
- return;
-
- // We enable file-over-http to bridge the file protocol to http protocol
- // in here, which can
- // (1) run the layout and performance tests on android target device, but
- // never need to push the test files and corresponding resources to device,
- // which saves huge running time.
- // (2) still run non-http layout (tests not under LayoutTests/http) tests
- // via file protocol without breaking test environment / convention of webkit
- // layout tests, which are followed by current all webkit ports.
- SimpleResourceLoaderBridge::AllowFileOverHTTP(
- "third_party/WebKit/LayoutTests/",
- GURL("http://127.0.0.1:8000/all-tests/"));
- SimpleResourceLoaderBridge::AllowFileOverHTTP(
- "third_party/WebKit/PerformanceTests/",
- GURL("http://127.0.0.1:8000/all-perf-tests/"));
}
void BeforeShutdown() {
diff --git a/webkit/support/platform_support_linux.cc b/webkit/support/platform_support_linux.cc
index d108520..bf0b605 100644
--- a/webkit/support/platform_support_linux.cc
+++ b/webkit/support/platform_support_linux.cc
@@ -19,10 +19,10 @@ namespace webkit_support {
// TODO(tkent): Implement some of the followings for platform-dependent tasks
// such as loading resource.
-void BeforeInitialize(bool unit_test_mode) {
+void BeforeInitialize() {
}
-void AfterInitialize(bool unit_test_mode) {
+void AfterInitialize() {
base::FilePath data_path;
PathService::Get(base::DIR_EXE, &data_path);
data_path = data_path.Append("DumpRenderTree.pak");
diff --git a/webkit/support/platform_support_mac.mm b/webkit/support/platform_support_mac.mm
index bcdc1d1..a9ab2160 100644
--- a/webkit/support/platform_support_mac.mm
+++ b/webkit/support/platform_support_mac.mm
@@ -30,7 +30,7 @@ namespace webkit_support {
static NSAutoreleasePool* autorelease_pool;
-void BeforeInitialize(bool unit_test_mode) {
+void BeforeInitialize() {
[CrDrtApplication sharedApplication];
autorelease_pool = [[NSAutoreleasePool alloc] init];
DCHECK(autorelease_pool);
@@ -98,67 +98,20 @@ static void SwizzleNSPasteboard() {
#endif
}
-void AfterInitialize(bool unit_test_mode) {
+void AfterInitialize() {
// Load a data pack.
g_resource_data_pack = new ui::DataPack(ui::SCALE_FACTOR_100P);
base::FilePath resources_pak_path;
- if (unit_test_mode) {
- PathService::Get(base::DIR_EXE, &resources_pak_path);
- resources_pak_path = resources_pak_path.Append("Content Shell.app")
- .Append("Contents")
- .Append("Frameworks")
- .Append("Content Shell Framework.framework")
- .Append("Resources")
- .Append("content_shell.pak");
- } else {
- NOTREACHED();
- }
+ PathService::Get(base::DIR_EXE, &resources_pak_path);
+ resources_pak_path = resources_pak_path.Append("Content Shell.app")
+ .Append("Contents")
+ .Append("Frameworks")
+ .Append("Content Shell Framework.framework")
+ .Append("Resources")
+ .Append("content_shell.pak");
if (!g_resource_data_pack->LoadFromPath(resources_pak_path)) {
LOG(FATAL) << "failed to load DumpRenderTree.pak";
}
-
- if (unit_test_mode)
- return;
-
- // Load font files in the resource folder.
- static const char* const fontFileNames[] = {
- "AHEM____.TTF",
- "WebKitWeightWatcher100.ttf",
- "WebKitWeightWatcher200.ttf",
- "WebKitWeightWatcher300.ttf",
- "WebKitWeightWatcher400.ttf",
- "WebKitWeightWatcher500.ttf",
- "WebKitWeightWatcher600.ttf",
- "WebKitWeightWatcher700.ttf",
- "WebKitWeightWatcher800.ttf",
- "WebKitWeightWatcher900.ttf",
- };
-
- NSMutableArray* font_urls = [NSMutableArray array];
- NSURL* resources_directory = [[NSBundle mainBundle] resourceURL];
- for (unsigned i = 0; i < arraysize(fontFileNames); ++i) {
- NSURL* font_url = [resources_directory
- URLByAppendingPathComponent:[NSString
- stringWithUTF8String:fontFileNames[i]]];
- [font_urls addObject:[font_url absoluteURL]];
- }
-
- CFArrayRef errors = 0;
- if (!CTFontManagerRegisterFontsForURLs((CFArrayRef)font_urls,
- kCTFontManagerScopeProcess,
- &errors)) {
- DLOG(FATAL) << "Fail to activate fonts.";
- CFRelease(errors);
- }
-
- SwizzleNSPasteboard();
-
- // Add <app bundle's parent dir>/plugins to the plugin path so we can load
- // test plugins.
- base::FilePath plugins_dir;
- PathService::Get(base::DIR_EXE, &plugins_dir);
- plugins_dir = plugins_dir.AppendASCII("../../../plugins");
- webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(plugins_dir);
}
void BeforeShutdown() {
diff --git a/webkit/support/platform_support_win.cc b/webkit/support/platform_support_win.cc
index 90c4481..f2585fe 100644
--- a/webkit/support/platform_support_win.cc
+++ b/webkit/support/platform_support_win.cc
@@ -48,10 +48,10 @@ namespace webkit_support {
// TODO(tkent): Implement some of the followings for platform-dependent tasks
// such as loading resource.
-void BeforeInitialize(bool unit_test_mode) {
+void BeforeInitialize() {
}
-void AfterInitialize(bool unit_test_mode) {
+void AfterInitialize() {
// TODO(dpranke): update other resource loading to use the pak
// instead of loading resources directly compiled in.
base::FilePath path;
diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc
index 9de028d..4f33d15 100644
--- a/webkit/support/test_webkit_platform_support.cc
+++ b/webkit/support/test_webkit_platform_support.cc
@@ -67,11 +67,7 @@
using WebKit::WebScriptController;
using webkit::WebLayerTreeViewImplForTesting;
-TestWebKitPlatformSupport::TestWebKitPlatformSupport(bool unit_test_mode,
- WebKit::Platform* shadow_platform_delegate)
- : unit_test_mode_(unit_test_mode),
- shadow_platform_delegate_(shadow_platform_delegate),
- threaded_compositing_enabled_(false) {
+TestWebKitPlatformSupport::TestWebKitPlatformSupport() {
v8::V8::SetCounterFunction(base::StatsTable::FindLocation);
WebKit::initialize(this);
@@ -256,8 +252,6 @@ void TestWebKitPlatformSupport::prefetchHostName(const WebKit::WebString&) {
}
WebKit::WebURLLoader* TestWebKitPlatformSupport::createURLLoader() {
- if (!unit_test_mode_)
- return webkit_glue::WebKitPlatformSupportImpl::createURLLoader();
return url_loader_factory_.CreateURLLoader(
webkit_glue::WebKitPlatformSupportImpl::createURLLoader());
}
@@ -374,7 +368,7 @@ bool TestWebKitPlatformSupport::canAccelerate2dCanvas() {
}
bool TestWebKitPlatformSupport::isThreadedCompositingEnabled() {
- return threaded_compositing_enabled_;
+ return false;
}
WebKit::WebCompositorSupport*
@@ -445,8 +439,6 @@ TestWebKitPlatformSupport::CreateWebSocketBridge(
WebKit::WebMediaStreamCenter*
TestWebKitPlatformSupport::createMediaStreamCenter(
WebKit::WebMediaStreamCenterClient* client) {
- if (shadow_platform_delegate_)
- return shadow_platform_delegate_->createMediaStreamCenter(client);
return webkit_glue::WebKitPlatformSupportImpl::createMediaStreamCenter(
client);
@@ -455,8 +447,6 @@ TestWebKitPlatformSupport::createMediaStreamCenter(
WebKit::WebRTCPeerConnectionHandler*
TestWebKitPlatformSupport::createRTCPeerConnectionHandler(
WebKit::WebRTCPeerConnectionHandlerClient* client) {
- if (shadow_platform_delegate_)
- return shadow_platform_delegate_->createRTCPeerConnectionHandler(client);
return webkit_glue::WebKitPlatformSupportImpl::createRTCPeerConnectionHandler(
client);
diff --git a/webkit/support/test_webkit_platform_support.h b/webkit/support/test_webkit_platform_support.h
index a822a3d..df36c5e 100644
--- a/webkit/support/test_webkit_platform_support.h
+++ b/webkit/support/test_webkit_platform_support.h
@@ -39,8 +39,7 @@ class TestWebKitPlatformSupport :
public WebKit::WebUnitTestSupport,
public webkit_glue::WebKitPlatformSupportChildImpl {
public:
- TestWebKitPlatformSupport(bool unit_test_mode,
- WebKit::Platform* shadow_platform_delegate);
+ TestWebKitPlatformSupport();
virtual ~TestWebKitPlatformSupport();
virtual WebKit::WebMimeRegistry* mimeRegistry();
@@ -163,10 +162,6 @@ class TestWebKitPlatformSupport :
virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting(
TestViewType type);
- void set_threaded_compositing_enabled(bool enabled) {
- threaded_compositing_enabled_ = enabled;
- }
-
private:
TestShellWebMimeRegistryImpl mime_registry_;
MockWebClipboardImpl mock_clipboard_;
@@ -181,10 +176,7 @@ class TestWebKitPlatformSupport :
base::ScopedTempDir file_system_root_;
webkit_glue::MockWebHyphenator hyphenator_;
WebURLLoaderMockFactory url_loader_factory_;
- bool unit_test_mode_;
WebKit::WebGamepads gamepad_data_;
- WebKit::Platform* shadow_platform_delegate_;
- bool threaded_compositing_enabled_;
webkit::WebCompositorSupportImpl compositor_support_;
scoped_refptr<cc::ContextProvider> main_thread_contexts_;
diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc
index 66a3f13..efb1349 100644
--- a/webkit/support/webkit_support.cc
+++ b/webkit/support/webkit_support.cc
@@ -4,7 +4,6 @@
#include "webkit/support/webkit_support.h"
-#include "base/at_exit.h"
#include "base/base64.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
@@ -14,7 +13,6 @@
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
-#include "base/i18n/icu_util.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -154,22 +152,12 @@ class TestEnvironment {
typedef base::MessageLoopForUI MessageLoopType;
#endif
- TestEnvironment(bool unit_test_mode,
- base::AtExitManager* existing_at_exit_manager,
- WebKit::Platform* shadow_platform_delegate) {
- if (unit_test_mode) {
- logging::SetLogAssertHandler(UnitTestAssertHandler);
- } else {
- // The existing_at_exit_manager must be not NULL.
- at_exit_manager_.reset(existing_at_exit_manager);
- InitLogging();
- }
+ TestEnvironment() {
+ logging::SetLogAssertHandler(UnitTestAssertHandler);
main_message_loop_.reset(new MessageLoopType);
// TestWebKitPlatformSupport must be instantiated after MessageLoopType.
- webkit_platform_support_.reset(
- new TestWebKitPlatformSupport(unit_test_mode,
- shadow_platform_delegate));
+ webkit_platform_support_.reset(new TestWebKitPlatformSupport);
}
~TestEnvironment() {
@@ -214,9 +202,6 @@ class TestEnvironment {
}
private:
- // Data member at_exit_manager_ will take the ownership of the input
- // AtExitManager and manage its lifecycle.
- scoped_ptr<base::AtExitManager> at_exit_manager_;
scoped_ptr<MessageLoopType> main_message_loop_;
scoped_ptr<TestWebKitPlatformSupport> webkit_platform_support_;
@@ -283,48 +268,6 @@ class WebKitClientMessageLoopImpl
TestEnvironment* test_environment;
-void SetUpTestEnvironmentImpl(bool unit_test_mode,
- WebKit::Platform* shadow_platform_delegate) {
- 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);
-
- // 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();
- base::AtExitManager* at_exit_manager = NULL;
- // In Android DumpRenderTree, AtExitManager is created in
- // testing/android/native_test_wrapper.cc before main() is called.
-#if !defined(OS_ANDROID)
- // Some initialization code may use a AtExitManager before initializing
- // TestEnvironment, so we create a AtExitManager early and pass its ownership
- // to TestEnvironment.
- if (!unit_test_mode)
- at_exit_manager = new base::AtExitManager;
-#endif
- webkit_support::BeforeInitialize(unit_test_mode);
- test_environment = new TestEnvironment(unit_test_mode, at_exit_manager,
- shadow_platform_delegate);
- webkit_support::AfterInitialize(unit_test_mode);
- if (!unit_test_mode) {
- // Load ICU data tables. This has to run after TestEnvironment is created
- // because on Linux, we need base::AtExitManager.
- icu_util::Initialize();
- }
- webkit_glue::SetUserAgent(webkit_glue::BuildUserAgentFromProduct(
- "DumpRenderTree/0.0.0.0"), false);
-}
-
} // namespace
namespace webkit_support {
@@ -341,21 +284,29 @@ base::FilePath GetChromiumRootDirFilePath() {
.Append(FILE_PATH_LITERAL("Source/WebKit/chromium"));
}
-void SetUpTestEnvironment() {
- SetUpTestEnvironment(NULL);
-}
-
void SetUpTestEnvironmentForUnitTests() {
- SetUpTestEnvironmentForUnitTests(NULL);
-}
+ base::debug::EnableInProcessStackDumping();
+ base::EnableTerminationOnHeapCorruption();
-void SetUpTestEnvironment(WebKit::Platform* shadow_platform_delegate) {
- SetUpTestEnvironmentImpl(false, shadow_platform_delegate);
-}
+ // 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);
-void SetUpTestEnvironmentForUnitTests(
- WebKit::Platform* shadow_platform_delegate) {
- SetUpTestEnvironmentImpl(true, shadow_platform_delegate);
+ // 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);
}
void TearDownTestEnvironment() {
@@ -473,11 +424,6 @@ WebKit::WebLayerTreeView* CreateLayerTreeView(
return view.release();
}
-void SetThreadedCompositorEnabled(bool enabled) {
- test_environment->webkit_platform_support()->
- set_threaded_compositing_enabled(enabled);
-}
-
void RegisterMockedURL(const WebKit::WebURL& url,
const WebKit::WebURLResponse& response,
const WebKit::WebString& file_path) {
diff --git a/webkit/support/webkit_support.h b/webkit/support/webkit_support.h
index 85396dc..f1730d6 100644
--- a/webkit/support/webkit_support.h
+++ b/webkit/support/webkit_support.h
@@ -72,11 +72,7 @@ base::FilePath GetChromiumRootDirFilePath();
// 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).
-void SetUpTestEnvironment();
void SetUpTestEnvironmentForUnitTests();
-void SetUpTestEnvironment(WebKit::Platform* shadow_platform_delegate);
-void SetUpTestEnvironmentForUnitTests(
- WebKit::Platform* shadow_platform_delegate);
void TearDownTestEnvironment();
// Returns a pointer to a Platform implementation for
@@ -143,8 +139,6 @@ WebKit::WebLayerTreeView* CreateLayerTreeView(
DRTLayerTreeViewClient* client,
WebKit::WebThread* thread);
-void SetThreadedCompositorEnabled(bool enabled);
-
// ------- URL load mocking.
// Registers the file at |file_path| to be served when |url| is requested.
// |response| is the response provided with the contents.