diff options
author | peter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 17:44:14 +0000 |
---|---|---|
committer | peter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-13 17:44:14 +0000 |
commit | 7252e25273c5141545e8b177259b9987d5d9455e (patch) | |
tree | 4ff48f59950614be003e74c6d4cfeb0a4fa0a019 | |
parent | 5f5eae6d4277e4ead86f1d7d73f7f3eec4de0196 (diff) | |
download | chromium_src-7252e25273c5141545e8b177259b9987d5d9455e.zip chromium_src-7252e25273c5141545e8b177259b9987d5d9455e.tar.gz chromium_src-7252e25273c5141545e8b177259b9987d5d9455e.tar.bz2 |
content_shell: Translate layout test paths to URLs for Android
It's not feasible to transfer all layout tests to the device on Android,
so we reverse-forward ports from the device to the host allowing them
to be served from a web server on the host. Translate the test URLs.
BUG=232044
Review URL: https://chromiumcodereview.appspot.com/15734029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206107 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/shell/shell_browser_main.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index 465b10c..18624be 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -26,6 +26,15 @@ namespace { +#if defined(OS_ANDROID) +// Path to search for when translating a layout test path to an URL. +const char kAndroidLayoutTestPath[] = + "/data/local/tmp/third_party/WebKit/LayoutTests/"; + +// The base URL from which layout tests are being served on Android. +const char kAndroidLayoutTestBase[] = "http://127.0.0.1:8000/all-tests/"; +#endif + GURL GetURLForLayoutTest(const std::string& test_name, base::FilePath* current_working_directory, bool* enable_pixel_dumping, @@ -50,6 +59,19 @@ GURL GetURLForLayoutTest(const std::string& test_name, } if (expected_pixel_hash) *expected_pixel_hash = pixel_hash; + +#if defined(OS_ANDROID) + // On Android, all passed tests will be paths to a local temporary directory. + // However, because we can't transfer all test files to the device, translate + // those paths to a local, forwarded URL so the host can serve them. + if (path_or_url.find(kAndroidLayoutTestPath) != std::string::npos) { + std::string test_location(kAndroidLayoutTestBase); + test_location.append(path_or_url.substr(strlen(kAndroidLayoutTestPath))); + + return GURL(test_location); + } +#endif + GURL test_url(path_or_url); if (!(test_url.is_valid() && test_url.has_scheme())) { // We're outside of the message loop here, and this is a test. |