Title: [119946] trunk
Revision
119946
Author
[email protected]
Date
2012-06-10 14:36:29 -0700 (Sun, 10 Jun 2012)

Log Message

Expose layoutTestController as testRunner
https://bugs.webkit.org/show_bug.cgi?id=88210

Reviewed by Darin Adler.

Tools:

* DumpRenderTree/LayoutTestController.cpp:
(LayoutTestController::makeWindowObject):
* DumpRenderTree/chromium/TestShell.cpp:
(TestShell::bindJSObjectsToWindow):
* DumpRenderTree/qt/DumpRenderTreeQt.cpp:
(WebCore::DumpRenderTree::initJSObjects):
* WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
(WTR::LayoutTestController::makeWindowObject):

LayoutTests:

Add a test for testRunner object.

* fast/harness/testrunner-object-expected.txt: Added.
* fast/harness/testrunner-object.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (119945 => 119946)


--- trunk/LayoutTests/ChangeLog	2012-06-10 20:18:36 UTC (rev 119945)
+++ trunk/LayoutTests/ChangeLog	2012-06-10 21:36:29 UTC (rev 119946)
@@ -1,3 +1,15 @@
+2012-06-10  Ryosuke Niwa  <[email protected]>
+
+        Expose layoutTestController as testRunner
+        https://bugs.webkit.org/show_bug.cgi?id=88210
+
+        Reviewed by Darin Adler.
+
+        Add a test for testRunner object.
+
+        * fast/harness/testrunner-object-expected.txt: Added.
+        * fast/harness/testrunner-object.html: Added.
+
 2012-06-10  Pablo Flouret  <[email protected]>
 
         Access control allow lists starting with a comma are parsed incorrectly (CORS)

Added: trunk/LayoutTests/fast/harness/testrunner-object-expected.txt (0 => 119946)


--- trunk/LayoutTests/fast/harness/testrunner-object-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/harness/testrunner-object-expected.txt	2012-06-10 21:36:29 UTC (rev 119946)
@@ -0,0 +1,3 @@
+PASS - window.testRunner exists
+Done
+

Added: trunk/LayoutTests/fast/harness/testrunner-object.html (0 => 119946)


--- trunk/LayoutTests/fast/harness/testrunner-object.html	                        (rev 0)
+++ trunk/LayoutTests/fast/harness/testrunner-object.html	2012-06-10 21:36:29 UTC (rev 119946)
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<body>
+<pre><script>
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+if (window.testRunner)
+    testRunner.dumpAsText();
+
+document.writeln(window.testRunner ? "PASS - window.testRunner exists" : "FAIL - window.testRunner doesn't");
+if (window.layoutTestController) {
+    for (var property in window.testRunner) {
+        if (!(property in window.layoutTestController))
+            document.write("Property " + property + " exists on testRunner but doesn't exist on layoutTestController");
+    }
+    for (var property in window.layoutTestController) {
+        if (!(property in window.testRunner))
+            document.write("Property " + property + " exists on layoutTestController but doesn't exist on testRunner");
+    }
+}
+
+document.writeln('Done');
+
+</script></pre>
+</body>
+</html>

Modified: trunk/Tools/ChangeLog (119945 => 119946)


--- trunk/Tools/ChangeLog	2012-06-10 20:18:36 UTC (rev 119945)
+++ trunk/Tools/ChangeLog	2012-06-10 21:36:29 UTC (rev 119946)
@@ -1,3 +1,19 @@
+2012-06-10  Ryosuke Niwa  <[email protected]>
+
+        Expose layoutTestController as testRunner
+        https://bugs.webkit.org/show_bug.cgi?id=88210
+
+        Reviewed by Darin Adler.
+
+        * DumpRenderTree/LayoutTestController.cpp:
+        (LayoutTestController::makeWindowObject):
+        * DumpRenderTree/chromium/TestShell.cpp:
+        (TestShell::bindJSObjectsToWindow):
+        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
+        (WebCore::DumpRenderTree::initJSObjects):
+        * WebKitTestRunner/InjectedBundle/LayoutTestController.cpp:
+        (WTR::LayoutTestController::makeWindowObject):
+
 2012-06-09  Dominic Cooney  <[email protected]>
 
         [Chromium] Remove _javascript_Core dependencies from gyp

Modified: trunk/Tools/DumpRenderTree/LayoutTestController.cpp (119945 => 119946)


--- trunk/Tools/DumpRenderTree/LayoutTestController.cpp	2012-06-10 20:18:36 UTC (rev 119945)
+++ trunk/Tools/DumpRenderTree/LayoutTestController.cpp	2012-06-10 21:36:29 UTC (rev 119946)
@@ -2244,13 +2244,16 @@
 void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
 {
     JSRetainPtr<JSStringRef> layoutTestContollerStr(Adopt, JSStringCreateWithUTF8CString("layoutTestController"));
+    JSRetainPtr<JSStringRef> testRunnerStr(Adopt, JSStringCreateWithUTF8CString("testRunner"));
     ref();
+    ref();
 
     JSClassRef classRef = getJSClass();
     JSValueRef layoutTestContollerObject = JSObjectMake(context, classRef, this);
     JSClassRelease(classRef);
 
     JSObjectSetProperty(context, windowObject, layoutTestContollerStr.get(), layoutTestContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+    JSObjectSetProperty(context, windowObject, testRunnerStr.get(), layoutTestContollerObject, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
 }
 
 JSClassRef LayoutTestController::getJSClass()

Modified: trunk/Tools/DumpRenderTree/chromium/TestShell.cpp (119945 => 119946)


--- trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-06-10 20:18:36 UTC (rev 119945)
+++ trunk/Tools/DumpRenderTree/chromium/TestShell.cpp	2012-06-10 21:36:29 UTC (rev 119946)
@@ -726,6 +726,7 @@
     m_accessibilityController->bindToJavascript(frame, WebString::fromUTF8("accessibilityController"));
     m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController"));
     m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("layoutTestController"));
+    m_layoutTestController->bindToJavascript(frame, WebString::fromUTF8("testRunner"));
     m_eventSender->bindToJavascript(frame, WebString::fromUTF8("eventSender"));
     m_textInputController->bindToJavascript(frame, WebString::fromUTF8("textInputController"));
 }

Modified: trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp (119945 => 119946)


--- trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-06-10 20:18:36 UTC (rev 119945)
+++ trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp	2012-06-10 21:36:29 UTC (rev 119946)
@@ -743,6 +743,7 @@
     QWebFrame *frame = qobject_cast<QWebFrame*>(sender());
     Q_ASSERT(frame);
     frame->addToJavaScriptWindowObject(QLatin1String("layoutTestController"), m_controller);
+    frame->addToJavaScriptWindowObject(QLatin1String("testRunner"), m_controller);
     frame->addToJavaScriptWindowObject(QLatin1String("eventSender"), m_eventSender);
     frame->addToJavaScriptWindowObject(QLatin1String("textInputController"), m_textInputController);
     frame->addToJavaScriptWindowObject(QLatin1String("GCController"), m_gcController);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp (119945 => 119946)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-06-10 20:18:36 UTC (rev 119945)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/LayoutTestController.cpp	2012-06-10 21:36:29 UTC (rev 119946)
@@ -459,6 +459,7 @@
 void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef windowObject, JSValueRef* exception)
 {
     setProperty(context, windowObject, "layoutTestController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
+    setProperty(context, windowObject, "testRunner", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
 }
 
 void LayoutTestController::showWebInspector()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to