Chromium Code Reviews| 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..97a9ab54fe3c71966673603af888f119b09a2476 100644 |
| --- a/webkit/support/platform_support_android.cc |
| +++ b/webkit/support/platform_support_android.cc |
| @@ -4,23 +4,41 @@ |
| #include "webkit/support/platform_support.h" |
| +#include <locale.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 "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): Investigate if it is feasible to remove this dependency |
| +// by putting the tools and resources into the apk. |
| +const char kDumpRenderTreeDir[] = "/data/drt"; |
|
nilesh
2012/05/24 21:28:33
We may also want to explore using "/data/local/tmp
Xianzhu
2012/05/24 21:59:35
Done.
|
| + |
| +} |
| + |
| namespace webkit_support { |
| void BeforeInitialize(bool unit_test_mode) { |
| - InitAndroidOSPathStub(); |
| + // Some tests rely on this to produce proper number format etc., |
| + // e.g. fast/speech/input-appearance-numberandspeech.html. |
| + setlocale(LC_CTYPE, "en_US"); |
| + |
| + 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 +48,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 +81,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 +95,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); |