Title: [94862] trunk
Revision
94862
Author
[email protected]
Date
2011-09-09 10:37:05 -0700 (Fri, 09 Sep 2011)

Log Message

[chromium] Implement DRT support for Android.
https://bugs.webkit.org/show_bug.cgi?id=67590

Patch by Hao Zheng <[email protected]> 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):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (94861 => 94862)


--- trunk/Source/WebKit/chromium/ChangeLog	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Source/WebKit/chromium/ChangeLog	2011-09-09 17:37:05 UTC (rev 94862)
@@ -1,5 +1,16 @@
 2011-09-09  Hao Zheng  <[email protected]>
 
+        [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  <[email protected]>
+
         [Chromium] Add WebSandboxSupport and WebThemeEngine for Android.
         https://bugs.webkit.org/show_bug.cgi?id=67584
 

Modified: trunk/Source/WebKit/chromium/WebKit.gyp (94861 => 94862)


--- trunk/Source/WebKit/chromium/WebKit.gyp	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Source/WebKit/chromium/WebKit.gyp	2011-09-09 17:37:05 UTC (rev 94862)
@@ -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',

Modified: trunk/Tools/ChangeLog (94861 => 94862)


--- trunk/Tools/ChangeLog	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Tools/ChangeLog	2011-09-09 17:37:05 UTC (rev 94862)
@@ -1,3 +1,34 @@
+2011-09-09  Hao Zheng  <[email protected]>
+
+        [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  <[email protected]>
 
         [wx] Unreviewed build fix. Add Source/_javascript_Core/dfg directory to the build.

Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.gypi (94861 => 94862)


--- trunk/Tools/DumpRenderTree/DumpRenderTree.gypi	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.gypi	2011-09-09 17:37:05 UTC (rev 94862)
@@ -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',

Modified: trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp (94861 => 94862)


--- trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp	2011-09-09 17:37:05 UTC (rev 94862)
@@ -237,6 +237,11 @@
             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 @@
                     *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++)

Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (94861 => 94862)


--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2011-09-09 17:37:05 UTC (rev 94862)
@@ -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>

Added: trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp (0 => 94862)


--- trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp	                        (rev 0)
+++ trunk/Tools/DumpRenderTree/chromium/TestShellAndroid.cpp	2011-09-09 17:37:05 UTC (rev 94862)
@@ -0,0 +1,90 @@
+/*
+ * 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;
+}

Modified: trunk/Tools/DumpRenderTree/chromium/TestShellGtk.cpp (94861 => 94862)


--- trunk/Tools/DumpRenderTree/chromium/TestShellGtk.cpp	2011-09-09 17:27:50 UTC (rev 94861)
+++ trunk/Tools/DumpRenderTree/chromium/TestShellGtk.cpp	2011-09-09 17:37:05 UTC (rev 94862)
@@ -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 @@
 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 @@
 
     // Remove the alarm.
     alarm(0);
-    signal(SIGALRM, SIG_DFL);
+    sigaction(SIGALRM, &oldAction, 0);
 }
 
 void platformInit(int* argc, char*** argv)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to