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..3062c8ec544a3a5753a1e326f878faae48173e87 100644 |
--- a/webkit/support/platform_support_android.cc |
+++ b/webkit/support/platform_support_android.cc |
@@ -10,17 +10,29 @@ |
#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 "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); |
@@ -30,8 +42,7 @@ 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 +75,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 +89,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); |