Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Unified Diff: webkit/support/platform_support_android.cc

Issue 10408091: Chromium support of running DumpRenderTree as an apk on Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes according to comments in Patch Set 3 Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..d83d0246d1e6f0a7a59e96bba9ab57c75661fde6 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): 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();
+ // Some tests rely on this to produce proper number format etc.,
+ // e.g. fast/speech/input-appearance-numberandspeech.html.
+ setlocale(LC_CTYPE, "en_US");
Paweł Hajdan Jr. 2012/05/25 19:06:08 Is this ever used in non-test code? If so, this lo
Xianzhu 2012/05/29 17:15:55 This is only for layout tests. Just verified that
+
+ 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);

Powered by Google App Engine
This is Rietveld 408576698