| Index: webkit/support/platform_support_android.cc
|
| diff --git a/webkit/support/platform_support_android.cc b/webkit/support/platform_support_android.cc
|
| index dd6c914cefb3e6fee300ac3b1a1a0867d47e1384..7298b8176aa513e36b2588b185363a8079fffa6c 100644
|
| --- a/webkit/support/platform_support_android.cc
|
| +++ b/webkit/support/platform_support_android.cc
|
| @@ -4,34 +4,50 @@
|
|
|
| #include "webkit/support/platform_support.h"
|
|
|
| +#include "base/android/jni_android.h"
|
| #include "base/file_path.h"
|
| #include "base/file_util.h"
|
| #include "base/logging.h"
|
| #include "base/path_service.h"
|
| #include "base/string16.h"
|
| #include "base/string_piece.h"
|
| -#include "base/test/test_stub_android.h"
|
| +#include "base/test/test_support_android.h"
|
| #include "googleurl/src/gurl.h"
|
| #include "grit/webkit_resources.h"
|
| +#include "net/android/network_library.h"
|
| #include "ui/base/resource/resource_bundle.h"
|
| #include "webkit/support/test_webkit_platform_support.h"
|
| #include "webkit/tools/test_shell/simple_resource_loader_bridge.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.
|
| +// TODO(wangxianzhu): Allow running DRT on non-rooted device by putting
|
| +// the tools and resources into the apk or under /data/local/tmp.
|
| +const char kDumpRenderTreeDir[] = "/data/drt";
|
| +
|
| +}
|
| +
|
| namespace webkit_support {
|
|
|
| void BeforeInitialize(bool unit_test_mode) {
|
| - InitAndroidOSPathStub();
|
| + InitAndroidTestPaths();
|
| +
|
| // 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(bool unit_test_mode) {
|
| if (unit_test_mode)
|
| return; // We don't have a resource pack when running the unit-tests.
|
|
|
| - FilePath data_path;
|
| - PathService::Get(base::DIR_EXE, &data_path);
|
| + FilePath data_path(kDumpRenderTreeDir);
|
| data_path = data_path.Append("DumpRenderTree.pak");
|
| ResourceBundle::InitSharedInstanceWithPakFile(data_path);
|
|
|
| @@ -64,12 +80,11 @@ string16 TestWebKitPlatformSupport::GetLocalizedString(int message_id) {
|
| base::StringPiece TestWebKitPlatformSupport::GetDataResource(
|
| int resource_id,
|
| ui::ScaleFactor scale_factor) {
|
| - FilePath resources_path;
|
| - PathService::Get(base::DIR_EXE, &resources_path);
|
| + FilePath resources_path(kDumpRenderTreeDir);
|
| resources_path = resources_path.Append("DumpRenderTree_resources");
|
| switch (resource_id) {
|
| case IDR_BROKENIMAGE: {
|
| - static std::string broken_image_data;
|
| + CR_DEFINE_STATIC_LOCAL(std::string, broken_image_data, ());
|
| if (broken_image_data.empty()) {
|
| FilePath path = resources_path.Append("missingImage.gif");
|
| bool success = file_util::ReadFileToString(path, &broken_image_data);
|
| @@ -79,7 +94,7 @@ base::StringPiece TestWebKitPlatformSupport::GetDataResource(
|
| return broken_image_data;
|
| }
|
| case IDR_TEXTAREA_RESIZER: {
|
| - static std::string resize_corner_data;
|
| + CR_DEFINE_STATIC_LOCAL(std::string, resize_corner_data, ());
|
| if (resize_corner_data.empty()) {
|
| FilePath path = resources_path.Append("textAreaResizeCorner.png");
|
| bool success = file_util::ReadFileToString(path, &resize_corner_data);
|
|
|