summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaksymilian Osowski <maxosowski@google.com>2010-08-31 18:08:06 +0100
committerMaksymilian Osowski <maxosowski@google.com>2010-09-01 10:22:45 +0100
commitf5929f20b546de2c377c9ae2be2f3d0054f1b3e0 (patch)
tree0aace3bb1dded9539b2e53d037ee1e534eee8591
parent0eb2314f8b27b9d07958b55fba1dc7d7264ae86a (diff)
downloadexternal_webkit-f5929f20b546de2c377c9ae2be2f3d0054f1b3e0.zip
external_webkit-f5929f20b546de2c377c9ae2be2f3d0054f1b3e0.tar.gz
external_webkit-f5929f20b546de2c377c9ae2be2f3d0054f1b3e0.tar.bz2
Added script to show the source of the test.
Change-Id: I192b0ecd7830f69193111ebf1d081dcd9495a51b
-rw-r--r--WebKitTools/DumpRenderTree/android/view_source.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/WebKitTools/DumpRenderTree/android/view_source.php b/WebKitTools/DumpRenderTree/android/view_source.php
new file mode 100644
index 0000000..dfe6d12
--- /dev/null
+++ b/WebKitTools/DumpRenderTree/android/view_source.php
@@ -0,0 +1,53 @@
+<?php
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+###############################################################################
+
+# Show the source of the test.
+#
+# Usage:
+# view_source.php?src=PATH
+# where
+# PATH - relative path in the LayoutTests dir
+
+ # Global variables
+ # The server document root is LayoutTests/http/tests. See run_apache2.py.
+ $rootDir = realpath($_SERVER['DOCUMENT_ROOT'] . '..' . DIRECTORY_SEPARATOR . '..');
+
+ function getAbsolutePath($relPath) {
+ global $rootDir;
+ return $rootDir . DIRECTORY_SEPARATOR . $relPath;
+ }
+
+ function main() {
+ global $rootDir;
+
+ # Very primitive check if path tries to go above DOCUMENT_ROOT or is absolute
+ if (strpos($_GET['src'], "..") !== False ||
+ substr($_GET['src'], 0, 1) == DIRECTORY_SEPARATOR) {
+ return;
+ }
+
+ #If we don't want realpath to append any prefixes we need to pass it an absolute path
+ $src = realpath(getAbsolutePath($_GET['src']));
+
+ echo "<html><body>";
+ # TODO: Add link following and syntax highlighting for html and js.
+ echo highlight_string(file_get_contents($src));
+ echo "</body></html>";
+ }
+
+ main();
+?>