[EFL][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalReso...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2012 02:59:37 +0000 (02:59 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jun 2012 02:59:37 +0000 (02:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=67255

Patch by Joshua Lock <joshua.lock@intel.com> on 2012-06-07
Reviewed by Dirk Pranke.

Tools:

Implement pathToLocalResource to redirect file:///tmp URL's to
DUMPRENDERTREE_TEMP and file:///tmp/LayoutTests to point to the
LayoutTests sub-directory of the WebKit source tree.

* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::pathToLocalResource):

LayoutTests:

* platform/efl/TestExpectations: unskip
fast/dom/frame-loading-via-document-write.html now that
LayoutTestController::pathToLocalResource() is implemented for EFL.

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

LayoutTests/ChangeLog
LayoutTests/platform/efl/TestExpectations
Tools/ChangeLog
Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp

index 508e78e2be875952ab41587dcb81a9e604bb61fb..ffd75ae60416bf57d5e09fefa4c066c6cce5dcb5 100644 (file)
@@ -1,3 +1,14 @@
+2012-06-07  Joshua Lock  <joshua.lock@intel.com>
+
+        [EFL][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalResource()
+        https://bugs.webkit.org/show_bug.cgi?id=67255
+
+        Reviewed by Dirk Pranke.
+
+        * platform/efl/TestExpectations: unskip
+        fast/dom/frame-loading-via-document-write.html now that
+        LayoutTestController::pathToLocalResource() is implemented for EFL.
+
 2012-06-07  Noel Gordon  <noel.gordon@gmail.com>
 
         [chromium] Use WEBPImportPictureRGBX|BGRX to import picture data
index 8d2a0d6bc0c3f7f50f0023bf25ffff7db715c581..84a8aa2134d0f54934c35371dc77e5b474fe6e9f 100644 (file)
@@ -224,9 +224,6 @@ BUGWK84333 : http/tests/local/fileapi/send-sliced-dragged-file.html = TEXT
 BUGWK84333 : http/tests/local/formdata = TEXT
 BUGWK84333 : http/tests/security/clipboard/clipboard-file-access.html = TEXT
 
-// LayoutTestController.pathToLocalResource needs special handling of file URLs to /tmp.
-BUGWK84336 : fast/dom/frame-loading-via-document-write.html = TIMEOUT TEXT
-
 // Missing execCommand('copy') and execCommand('paste').
 BUGWK84338 : editing/deleting/paste-with-transparent-background-color.html = TEXT
 BUGWK84338 : editing/execCommand/find-after-replace.html = TEXT MISSING
index a9c6e085fea96a9e228de837dde455c04d3f7bf0..f60a2c38b64b7b237b2666b28a513a82a4120fde 100644 (file)
@@ -1,3 +1,17 @@
+2012-06-07  Joshua Lock  <joshua.lock@intel.com>
+
+        [EFL][DRT] Normalize file:///tmp/LayoutTests in LayoutTestController::pathToLocalResource()
+        https://bugs.webkit.org/show_bug.cgi?id=67255
+
+        Reviewed by Dirk Pranke.
+
+        Implement pathToLocalResource to redirect file:///tmp URL's to
+        DUMPRENDERTREE_TEMP and file:///tmp/LayoutTests to point to the
+        LayoutTests sub-directory of the WebKit source tree.
+
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::pathToLocalResource):
+
 2012-06-07  Tony Payne  <tpayne@chromium.org>
 
         [chromium] Allow LayoutTests under new git workflow
index b7aa530bc049a8e897ff7f72a4e481d37d055fb6..ddc0332a700d0898f21ebf32c90b6ecc5ceb85f9 100644 (file)
@@ -7,6 +7,7 @@
  * Copyright (C) 2010 Joone Hur <joone@kldp.org>
  * Copyright (C) 2011 ProFUSION Embedded Systems
  * Copyright (C) 2011 Samsung Electronics
+ * Copyright (C) 2012 Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -177,8 +178,28 @@ void LayoutTestController::notifyDone()
 
 JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url)
 {
-    // Function introduced in r28690. This may need special-casing on Windows.
-    return JSStringRetain(url); // Do nothing on Unix.
+    String requestedUrl(url->characters());
+    String resourceRoot;
+    String requestedRoot;
+
+    if (requestedUrl.find("LayoutTests") != notFound) {
+        // If the URL contains LayoutTests we need to remap that to
+        // LOCAL_RESOURCE_ROOT which is the path of the LayoutTests directory
+        // within the WebKit source tree.
+        requestedRoot = "/tmp/LayoutTests";
+        resourceRoot = getenv("LOCAL_RESOURCE_ROOT");
+    } else if (requestedUrl.find("tmp") != notFound) {
+        // If the URL is a child of /tmp we need to convert it to be a child
+        // DUMPRENDERTREE_TEMP replace tmp with DUMPRENDERTREE_TEMP
+        requestedRoot = "/tmp";
+        resourceRoot = getenv("DUMPRENDERTREE_TEMP");
+    }
+
+    size_t indexOfRootStart = requestedUrl.reverseFind(requestedRoot);
+    size_t indexOfSeparatorAfterRoot = indexOfRootStart + requestedRoot.length();
+    String fullPathToUrl = "file://" + resourceRoot + requestedUrl.substring(indexOfSeparatorAfterRoot);
+
+    return JSStringCreateWithUTF8CString(fullPathToUrl.utf8().data());
 }
 
 void LayoutTestController::queueLoad(JSStringRef url, JSStringRef target)