[chromium] Implement DRT support for Android.

https://bugs.webkit.org/show_bug.cgi?id=67590

Patch by Hao Zheng <zhenghao@chromium.org> on 2011-09-09
Reviewed by Tony Chang.

Source/WebKit/chromium:

Exclude Android specific files of DRT from other platforms.

* WebKit.gyp:

Tools:

Add 2 mechanism to make DRT interaction more robust on Android:
- Send 'QUIT' to DRT to make it stop.
- Wait until receiving '#READY' from DRT, so that DRT won't miss any
input commands before it starts.
And LayoutTestController.cpp needs to include <cctype> for 'tolower'
and <clocale> for 'LC_ALL' to compile on Android.

Also change to use sigaction instead of signal for TestShellGtk.cpp,
as signal() man page recommends using sigaction().

* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/chromium/DumpRenderTree.cpp:
(main):
* DumpRenderTree/chromium/LayoutTestController.cpp:
* DumpRenderTree/chromium/TestShellAndroid.cpp: Added.
(AlarmHandler):
(TestShell::waitTestFinished):
(platformInit):
(openStartupDialog):
(checkLayoutTestSystemDependencies):
* DumpRenderTree/chromium/TestShellGtk.cpp:
(AlarmHandler):
(TestShell::waitTestFinished):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@94862 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b03bb3c0
2011-09-09 Hao Zheng <zhenghao@chromium.org>
[chromium] Implement DRT support for Android.
https://bugs.webkit.org/show_bug.cgi?id=67590
Reviewed by Tony Chang.
Exclude Android specific files of DRT from other platforms.
* WebKit.gyp:
2011-09-09 Hao Zheng <zhenghao@chromium.org>
[Chromium] Add WebSandboxSupport and WebThemeEngine for Android.
......
......@@ -1134,6 +1134,11 @@
['exclude', '(Gtk|Linux)\\.cpp$']
]
}],
['OS!="android"', {
'sources/': [
['exclude', '(Android)\\.cpp$']
],
}],
['inside_chromium_build==1 and component=="shared_library"', {
'sources': [
'src/ChromiumCurrentTime.cpp',
......
2011-09-09 Hao Zheng <zhenghao@chromium.org>
[chromium] Implement DRT support for Android.
https://bugs.webkit.org/show_bug.cgi?id=67590
Reviewed by Tony Chang.
Add 2 mechanism to make DRT interaction more robust on Android:
- Send 'QUIT' to DRT to make it stop.
- Wait until receiving '#READY' from DRT, so that DRT won't miss any
input commands before it starts.
And LayoutTestController.cpp needs to include <cctype> for 'tolower'
and <clocale> for 'LC_ALL' to compile on Android.
Also change to use sigaction instead of signal for TestShellGtk.cpp,
as signal() man page recommends using sigaction().
* DumpRenderTree/DumpRenderTree.gypi:
* DumpRenderTree/chromium/DumpRenderTree.cpp:
(main):
* DumpRenderTree/chromium/LayoutTestController.cpp:
* DumpRenderTree/chromium/TestShellAndroid.cpp: Added.
(AlarmHandler):
(TestShell::waitTestFinished):
(platformInit):
(openStartupDialog):
(checkLayoutTestSystemDependencies):
* DumpRenderTree/chromium/TestShellGtk.cpp:
(AlarmHandler):
(TestShell::waitTestFinished):
2011-09-09 Kevin Ollivier <kevino@theolliviers.com>
[wx] Unreviewed build fix. Add Source/JavaScriptCore/dfg directory to the build.
......@@ -32,6 +32,7 @@
'chromium/TestNavigationController.h',
'chromium/TestShell.cpp',
'chromium/TestShell.h',
'chromium/TestShellAndroid.cpp',
'chromium/TestShellGtk.cpp',
'chromium/TestShellMac.mm',
'chromium/TestShellWin.cpp',
......
......@@ -237,6 +237,11 @@ int main(int argc, char* argv[])
shell.setLayoutTestTimeout(0x20000000);
}
if (serverMode && !tests.size()) {
#if OS(ANDROID)
// Send a signal to host to indicate DRT is ready to process commands.
puts("#READY");
fflush(stdout);
#endif
params.printSeparators = true;
char testString[2048]; // 2048 is the same as the sizes of other platforms.
while (fgets(testString, sizeof(testString), stdin)) {
......@@ -245,10 +250,13 @@ int main(int argc, char* argv[])
*newLinePosition = '\0';
if (testString[0] == '\0')
continue;
// Explicitly quit on platforms where EOF is not reliable.
if (!strcmp(testString, "QUIT"))
break;
runTest(shell, params, testString, testShellMode);
}
} else if (!tests.size())
printf("#EOF\n");
puts("#EOF");
else {
params.printSeparators = tests.size() > 1;
for (unsigned i = 0; i < tests.size(); i++)
......
......@@ -59,6 +59,8 @@
#include "WebViewHost.h"
#include "webkit/support/webkit_support.h"
#include <algorithm>
#include <cctype>
#include <clocale>
#include <cstdlib>
#include <limits>
#include <wtf/text/WTFString.h>
......
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "TestShell.h"
#include "SkTypeface.h"
#include "WebView.h"
#include "webkit/support/webkit_support.h"
#include <signal.h>
#include <unistd.h>
static void AlarmHandler(int)
{
// If the alarm alarmed, kill the process since we have a really bad hang.
puts("\n#TEST_TIMED_OUT\n");
puts("#EOF\n");
fflush(stdout);
webkit_support::TearDownTestEnvironment();
exit(0);
}
void TestShell::waitTestFinished()
{
ASSERT(!m_testIsPending);
m_testIsPending = true;
// Install an alarm signal handler that will kill us if we time out.
struct sigaction alarmAction;
alarmAction.sa_handler = AlarmHandler;
sigemptyset(&alarmAction.sa_mask);
alarmAction.sa_flags = 0;
struct sigaction oldAction;
sigaction(SIGALRM, &alarmAction, &oldAction);
alarm(layoutTestTimeoutForWatchDog() / 1000);
// TestFinished() will post a quit message to break this loop when the page
// finishes loading.
while (m_testIsPending)
webkit_support::RunMessageLoop();
// Remove the alarm.
alarm(0);
sigaction(SIGALRM, &oldAction, 0);
}
void platformInit(int* argc, char*** argv)
{
// Nothing to do here.
}
void openStartupDialog()
{
notImplemented();
}
bool checkLayoutTestSystemDependencies()
{
// Nothing to do here.
return true;
}
......@@ -36,7 +36,7 @@
#include <gtk/gtk.h>
#include <signal.h>
static void AlarmHandler(int signatl)
static void AlarmHandler(int)
{
// If the alarm alarmed, kill the process since we have a really bad hang.
puts("\n#TEST_TIMED_OUT\n");
......@@ -171,11 +171,16 @@ static void setupFontconfig()
void TestShell::waitTestFinished()
{
ASSERT(!m_testIsPending);
m_testIsPending = true;
// Install an alarm signal handler that will kill us if we time out.
signal(SIGALRM, AlarmHandler);
struct sigaction alarmAction;
alarmAction.sa_handler = AlarmHandler;
sigemptyset(&alarmAction.sa_mask);
alarmAction.sa_flags = 0;
struct sigaction oldAction;
sigaction(SIGALRM, &alarmAction, &oldAction);
alarm(layoutTestTimeoutForWatchDog() / 1000);
// TestFinished() will post a quit message to break this loop when the page
......@@ -185,7 +190,7 @@ void TestShell::waitTestFinished()
// Remove the alarm.
alarm(0);
signal(SIGALRM, SIG_DFL);
sigaction(SIGALRM, &oldAction, 0);
}
void platformInit(int* argc, char*** argv)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment