2011-06-23 Martin Robinson <mrobinson@igalia.com>
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Jun 2011 21:41:35 +0000 (21:41 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Jun 2011 21:41:35 +0000 (21:41 +0000)
        Reviewed by Xan Lopez.

        [GTK] [WebKit2] WebKitTestRunner does not properly load TestNetscapePlugin
        https://bugs.webkit.org/show_bug.cgi?id=63287

        Send the path to the TestNetscapePlugin to the WKTR via an environment variable
        so that the plugin loads properly.

        * Scripts/old-run-webkit-tests: Pass the appropriate environment variable to WKTR.
        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
        (WTR::getEnvironmentVariableAsUTF8String): Added this helper which abstracts away some
        of the work for getting an environment variable and converting it to UTF-8.
        (WTR::TestController::initializeInjectedBundlePath): Use the helper.
        (WTR::TestController::initializeTestPluginDirectory): Get the path from an environment variable now.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@89616 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/old-run-webkit-tests
Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp

index fb05fe6..f8b9279 100644 (file)
@@ -1,3 +1,20 @@
+2011-06-23  Martin Robinson  <mrobinson@igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [GTK] [WebKit2] WebKitTestRunner does not properly load TestNetscapePlugin
+        https://bugs.webkit.org/show_bug.cgi?id=63287
+
+        Send the path to the TestNetscapePlugin to the WKTR via an environment variable
+        so that the plugin loads properly.
+
+        * Scripts/old-run-webkit-tests: Pass the appropriate environment variable to WKTR.
+        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+        (WTR::getEnvironmentVariableAsUTF8String): Added this helper which abstracts away some
+        of the work for getting an environment variable and converting it to UTF-8.
+        (WTR::TestController::initializeInjectedBundlePath): Use the helper.
+        (WTR::TestController::initializeTestPluginDirectory): Get the path from an environment variable now.
+
 2011-06-23  Adam Roben  <aroben@apple.com>
 
         Record whether old-run-webkit-tests aborted early in results.html
index 8557f08..ba4d177 100755 (executable)
@@ -1502,6 +1502,8 @@ sub openDumpTool()
         if ($useWebKitTestRunner) {
             my $injectedBundlePath = productDir() . "/Libraries/.libs/libTestRunnerInjectedBundle";
             $CLEAN_ENV{TEST_RUNNER_INJECTED_BUNDLE_FILENAME} = $injectedBundlePath;
+            my $testPluginPath = productDir() . "/TestNetscapePlugin/.libs";
+            $CLEAN_ENV{TEST_RUNNER_TEST_PLUGIN_PATH} = $testPluginPath;
         }
     }
 
index a33a64f..e5f6a45 100644 (file)
@@ -68,24 +68,27 @@ void TestController::platformRunUntil(bool&, double timeout)
     gtk_main();
 }
 
-void TestController::initializeInjectedBundlePath()
+static char* getEnvironmentVariableAsUTF8String(const char* variableName)
 {
-    const char* bundlePath = g_getenv("TEST_RUNNER_INJECTED_BUNDLE_FILENAME");
-    if (!bundlePath) {
-        fprintf(stderr, "TEST_RUNNER_INJECTED_BUNDLE_FILENAME environment variable not found\n");
+    const char* value = g_getenv(variableName);
+    if (!value) {
+        fprintf(stderr, "%s environment variable not found\n", variableName);
         exit(0);
     }
-
     gsize bytesWritten;
-    GOwnPtr<char> utf8BundlePath(g_filename_to_utf8(bundlePath, -1, 0, &bytesWritten, 0));
+    return g_filename_to_utf8(value, -1, 0, &bytesWritten, 0);
+}
+
+void TestController::initializeInjectedBundlePath()
+{
+    GOwnPtr<char> utf8BundlePath(getEnvironmentVariableAsUTF8String("TEST_RUNNER_INJECTED_BUNDLE_FILENAME"));
     m_injectedBundlePath.adopt(WKStringCreateWithUTF8CString(utf8BundlePath.get()));
 }
 
 void TestController::initializeTestPluginDirectory()
 {
-    // This is called after initializeInjectedBundlePath.
-    ASSERT(m_injectedBundlePath);
-    m_testPluginDirectory = m_injectedBundlePath;
+    GOwnPtr<char> testPluginPath(getEnvironmentVariableAsUTF8String("TEST_RUNNER_TEST_PLUGIN_PATH"));
+    m_testPluginDirectory.adopt(WKStringCreateWithUTF8CString(testPluginPath.get()));
 }
 
 void TestController::platformInitializeContext()