2011-02-06 Maciej Stachowiak <mjs@apple.com>
[WebKit.git] / Tools / WebKitTestRunner / InjectedBundle / LayoutTestController.cpp
index 13c7b10cb791a9f77cfb8805ecd1356892f1579c..4707ed8b58f99437192e92524649ccff4ca95cc3 100644 (file)
@@ -32,6 +32,7 @@
 #include <WebKit2/WKBundleBackForwardList.h>
 #include <WebKit2/WKBundleFrame.h>
 #include <WebKit2/WKBundleFramePrivate.h>
+#include <WebKit2/WKBundleInspector.h>
 #include <WebKit2/WKBundlePagePrivate.h>
 #include <WebKit2/WKBundleScriptWorld.h>
 #include <WebKit2/WKBundlePrivate.h>
@@ -96,6 +97,7 @@ LayoutTestController::LayoutTestController()
     , m_waitToDump(false)
     , m_testRepaint(false)
     , m_testRepaintSweepHorizontally(false)
+    , m_willSendRequestReturnsNull(false)
 {
     platformInitialize();
 }
@@ -309,6 +311,27 @@ void LayoutTestController::makeWindowObject(JSContextRef context, JSObjectRef wi
     setProperty(context, windowObject, "layoutTestController", this, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete, exception);
 }
 
+void LayoutTestController::showWebInspector()
+{
+    WKBundleInspectorShow(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()));
+}
+
+void LayoutTestController::closeWebInspector()
+{
+    WKBundleInspectorClose(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()));
+}
+
+void LayoutTestController::evaluateInWebInspector(long callID, JSStringRef script)
+{
+    WKRetainPtr<WKStringRef> scriptWK = toWK(script);
+    WKBundleInspectorEvaluateScriptForTest(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()), callID, scriptWK.get());
+}
+
+void LayoutTestController::setTimelineProfilingEnabled(bool enabled)
+{
+    WKBundleInspectorSetPageProfilingEnabled(WKBundlePageGetInspector(InjectedBundle::shared().page()->page()), enabled);
+}
+
 typedef WTF::HashMap<unsigned, WKRetainPtr<WKBundleScriptWorldRef> > WorldMap;
 static WorldMap& worldMap()
 {
@@ -349,4 +372,11 @@ void LayoutTestController::evaluateScriptInIsolatedWorld(JSContextRef context, u
     JSEvaluateScript(jsContext, script, 0, 0, 0, 0); 
 }
 
+void LayoutTestController::setPOSIXLocale(JSStringRef locale)
+{
+    char localeBuf[32];
+    JSStringGetUTF8CString(locale, localeBuf, sizeof(localeBuf));
+    setlocale(LC_ALL, localeBuf);
+}
+
 } // namespace WTR