diff options
author | peter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 21:08:10 +0000 |
---|---|---|
committer | peter@chromium.org <peter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-20 21:08:10 +0000 |
commit | eadcff0f5cfb061e3dd6e09ed8ff89cbb65066e2 (patch) | |
tree | e9b6c318840979272755c2f33931d17b1e912ca0 /content/shell/shell_browser_main.cc | |
parent | d0b9b36624e453d39eff8853ce598103331da031 (diff) | |
download | chromium_src-eadcff0f5cfb061e3dd6e09ed8ff89cbb65066e2.zip chromium_src-eadcff0f5cfb061e3dd6e09ed8ff89cbb65066e2.tar.gz chromium_src-eadcff0f5cfb061e3dd6e09ed8ff89cbb65066e2.tar.bz2 |
content_shell: Create the FIFOs needed for running Android layout tests
The Android layout test runner communicates with content_shell through
a set of three fifos, one for each of [stdout, stderr, stdin]. Create
those after basic initialization.
BUG=232044
Review URL: https://chromiumcodereview.appspot.com/17265005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/shell/shell_browser_main.cc')
-rw-r--r-- | content/shell/shell_browser_main.cc | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index b1f0e9f..44f09f9 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -25,27 +25,12 @@ #include "webkit/support/webkit_support.h" #if defined(OS_ANDROID) -#include "base/android/jni_android.h" #include "base/run_loop.h" -#include "content/public/test/nested_message_pump_android.h" +#include "content/shell/shell_layout_tests_android.h" #endif 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/"; - -base::MessagePump* CreateMessagePumpForUI() { - return new content::NestedMessagePumpAndroid(); -} - -#endif - GURL GetURLForLayoutTest(const std::string& test_name, base::FilePath* current_working_directory, bool* enable_pixel_dumping, @@ -71,19 +56,13 @@ GURL GetURLForLayoutTest(const std::string& test_name, if (expected_pixel_hash) *expected_pixel_hash = pixel_hash; + GURL test_url; #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); - } + if (content::GetTestUrlForAndroid(path_or_url, &test_url)) + return test_url; #endif - GURL test_url(path_or_url); + test_url = GURL(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. base::ThreadRestrictions::ScopedAllowIO allow_io; @@ -130,8 +109,9 @@ bool GetNextTest(const CommandLine::StringVector& args, } // namespace // Main routine for running as the Browser process. -int ShellBrowserMain(const content::MainFunctionParams& parameters, - scoped_ptr<content::BrowserMainRunner>& main_runner) { +int ShellBrowserMain( + const content::MainFunctionParams& parameters, + const scoped_ptr<content::BrowserMainRunner>& main_runner) { bool layout_test_mode = CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree); base::ScopedTempDir browser_context_path_for_layout_tests; @@ -144,19 +124,12 @@ int ShellBrowserMain(const content::MainFunctionParams& parameters, browser_context_path_for_layout_tests.path().MaybeAsASCII()); #if defined(OS_ANDROID) - // TODO(beverloo): Create the FIFOs required for Android layout tests. - - JNIEnv* env = base::android::AttachCurrentThread(); - content::NestedMessagePumpAndroid::RegisterJni(env); - - const bool success = base::MessageLoop::InitMessagePumpForUIFactory( - &CreateMessagePumpForUI); - CHECK(success) << "Unable to initialize the message pump for Android."; + content::EnsureInitializeForAndroidLayoutTests(); #endif } int exit_code = main_runner->Initialize(parameters); - DCHECK(exit_code < 0) + DCHECK_LT(exit_code, 0) << "BrowserMainRunner::Initialize failed in ShellBrowserMain"; if (exit_code >= 0) |