[EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2012 12:50:15 +0000 (12:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2012 12:50:15 +0000 (12:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=87935

Patch by Seokju Kwon <seokju.kwon@samsung.com> on 2012-07-18
Reviewed by Andreas Kling.

Source/WebKit/efl:

Add implementation of DumpRenderTreeSupportEfl::evaluateInWebInspector().
Some scripts for test should be evaluated in frontend.

* WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
(DumpRenderTreeSupportEfl::evaluateInWebInspector):
* WebCoreSupport/DumpRenderTreeSupportEfl.h:

Tools:

Web Inspector will be shown when path or url contains "inspector/".
Dumprendertree should wait util web inspector resources are loaded totally
and handle the signals for creating or removing a view of web inspector.
("inspector,view,create" and "inspector,view,close")

* DumpRenderTree/efl/DumpRenderTree.cpp:
(shouldOpenWebInspector):
(createLayoutTestController):
* DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
(DumpRenderTreeChrome::createView):
(DumpRenderTreeChrome::createWebInspectorView):
(DumpRenderTreeChrome::removeWebInspectorView):
(DumpRenderTreeChrome::waitInspectorLoadFinished):
(DumpRenderTreeChrome::onInspectorViewCreate):
(DumpRenderTreeChrome::onInspectorViewClose):
(DumpRenderTreeChrome::onInspectorFrameLoadFinished):
* DumpRenderTree/efl/DumpRenderTreeChrome.h:
(DumpRenderTreeChrome):
* DumpRenderTree/efl/DumpRenderTreeView.cpp:
(onConsoleMessage):
* DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
(LayoutTestController::showWebInspector):
(LayoutTestController::closeWebInspector):
(LayoutTestController::evaluateInWebInspector):

LayoutTests:

Remove the following tests from Skipped list.
LayoutTests/inspector
LayoutTests/http/test/inspector
LayoutTests/http/test/inspector-enabled
LayoutTests/http/tests/inspector/network/ping.html

* platform/efl/Skipped:

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

LayoutTests/ChangeLog
LayoutTests/platform/efl/Skipped
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.cpp
Source/WebKit/efl/WebCoreSupport/DumpRenderTreeSupportEfl.h
Tools/ChangeLog
Tools/DumpRenderTree/efl/DumpRenderTree.cpp
Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp
Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h
Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp
Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp

index 45fe009..a6d2bf4 100644 (file)
@@ -1,3 +1,18 @@
+2012-07-18  Seokju Kwon  <seokju.kwon@samsung.com>
+
+        [EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT
+        https://bugs.webkit.org/show_bug.cgi?id=87935
+
+        Reviewed by Andreas Kling.
+
+        Remove the following tests from Skipped list.
+        LayoutTests/inspector
+        LayoutTests/http/test/inspector
+        LayoutTests/http/test/inspector-enabled
+        LayoutTests/http/tests/inspector/network/ping.html
+
+        * platform/efl/Skipped:
+
 2012-07-18  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Unreviewed chromium gardening, unskipped tests.
index c957e1a..03f64a1 100644 (file)
@@ -234,11 +234,6 @@ plugins
 # The EFL port has no support for accessibility features
 accessibility
 
-# The EFL port has no support for the web inspector
-inspector
-http/tests/inspector
-http/tests/inspector-enabled
-
 # The EFL port has no support for device motion and orientation
 fast/dom/DeviceMotion
 fast/dom/DeviceOrientation
@@ -541,7 +536,6 @@ fast/events/tab-focus-anchor.html
 fast/history/back-forward-reset-after-error-handling.html
 fast/repaint/no-caret-repaint-in-non-content-editable-element.html
 http/tests/canvas/webgl/origin-clean-conformance.html
-http/tests/inspector/network/ping.html
 http/tests/navigation/go-back-to-error-page.html
 loader/go-back-to-different-window-size.html
 userscripts/user-script-plugin-document.html
index 7d313e3..e173531 100644 (file)
@@ -1,3 +1,17 @@
+2012-07-18  Seokju Kwon  <seokju.kwon@samsung.com>
+
+        [EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT
+        https://bugs.webkit.org/show_bug.cgi?id=87935
+
+        Reviewed by Andreas Kling.
+
+        Add implementation of DumpRenderTreeSupportEfl::evaluateInWebInspector().
+        Some scripts for test should be evaluated in frontend.
+
+        * WebCoreSupport/DumpRenderTreeSupportEfl.cpp:
+        (DumpRenderTreeSupportEfl::evaluateInWebInspector):
+        * WebCoreSupport/DumpRenderTreeSupportEfl.h:
+
 2012-07-17  Christophe Dumez  <christophe.dumez@intel.com>
 
         [EFL] Replace 0 by NULL in public headers documentation
index 485db7f..bc0dc61 100644 (file)
@@ -520,6 +520,18 @@ bool DumpRenderTreeSupportEfl::isTargetItem(const Ewk_History_Item* ewkHistoryIt
     return historyItem->isTargetItem();
 }
 
+void DumpRenderTreeSupportEfl::evaluateInWebInspector(const Evas_Object* ewkView, long callId, const String& script)
+{
+#if ENABLE(INSPECTOR)
+    WebCore::Page* page = EWKPrivate::corePage(ewkView);
+    if (!page)
+        return;
+
+    if (page->inspectorController())
+        page->inspectorController()->evaluateForTestInFrontend(callId, script);
+#endif
+}
+
 void DumpRenderTreeSupportEfl::evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script)
 {
     WebCore::Frame* coreFrame = EWKPrivate::coreFrame(ewkFrame);
index 611f3c8..eaf11d3 100644 (file)
@@ -94,6 +94,7 @@ public:
     static HistoryItemChildrenVector childHistoryItems(const Ewk_History_Item*);
     static String historyItemTarget(const Ewk_History_Item*);
     static bool isTargetItem(const Ewk_History_Item*);
+    static void evaluateInWebInspector(const Evas_Object* ewkView, long callId, const String& script);
     static void evaluateScriptInIsolatedWorld(const Evas_Object* ewkFrame, int worldID, JSObjectRef globalObject, const String& script);
     static JSGlobalContextRef globalContextRefForFrame(const Evas_Object* ewkFrame);
 
index 5ed428b..af3318d 100644 (file)
@@ -1,3 +1,35 @@
+2012-07-18  Seokju Kwon  <seokju.kwon@samsung.com>
+
+        [EFL][DRT] Add support for Web Inspector in WebKit-EFL DRT
+        https://bugs.webkit.org/show_bug.cgi?id=87935
+
+        Reviewed by Andreas Kling.
+
+        Web Inspector will be shown when path or url contains "inspector/".
+        Dumprendertree should wait util web inspector resources are loaded totally
+        and handle the signals for creating or removing a view of web inspector.
+        ("inspector,view,create" and "inspector,view,close")
+
+        * DumpRenderTree/efl/DumpRenderTree.cpp:
+        (shouldOpenWebInspector):
+        (createLayoutTestController):
+        * DumpRenderTree/efl/DumpRenderTreeChrome.cpp:
+        (DumpRenderTreeChrome::createView):
+        (DumpRenderTreeChrome::createWebInspectorView):
+        (DumpRenderTreeChrome::removeWebInspectorView):
+        (DumpRenderTreeChrome::waitInspectorLoadFinished):
+        (DumpRenderTreeChrome::onInspectorViewCreate):
+        (DumpRenderTreeChrome::onInspectorViewClose):
+        (DumpRenderTreeChrome::onInspectorFrameLoadFinished):
+        * DumpRenderTree/efl/DumpRenderTreeChrome.h:
+        (DumpRenderTreeChrome):
+        * DumpRenderTree/efl/DumpRenderTreeView.cpp:
+        (onConsoleMessage):
+        * DumpRenderTree/efl/LayoutTestControllerEfl.cpp:
+        (LayoutTestController::showWebInspector):
+        (LayoutTestController::closeWebInspector):
+        (LayoutTestController::evaluateInWebInspector):
+
 2012-07-18  Simon Hausmann  <simon.hausmann@nokia.com>
 
         [ANGLE] On QT, use Bison and Flex during ANGLE build
index ee26356..7529454 100644 (file)
@@ -148,6 +148,11 @@ static bool shouldDumpAsText(const String& pathOrURL)
     return pathOrURL.contains("dumpAsText/");
 }
 
+static bool shouldOpenWebInspector(const String& pathOrURL)
+{
+    return pathOrURL.contains("inspector/");
+}
+
 static void sendPixelResultsEOF()
 {
     puts("#EOF");
@@ -251,6 +256,9 @@ static void createLayoutTestController(const String& testURL, const String& expe
         gLayoutTestController->setDumpFrameLoadCallbacks(true);
 
     gLayoutTestController->setDeveloperExtrasEnabled(true);
+    if (shouldOpenWebInspector(testURL))
+        gLayoutTestController->showWebInspector();
+
     gLayoutTestController->setDumpHistoryDelegateCallbacks(isGlobalHistoryTest(testURL));
 
     if (shouldDumpAsText(testURL)) {
index 8a901c4..b72a722 100644 (file)
@@ -114,6 +114,8 @@ Evas_Object* DumpRenderTreeChrome::createView() const
     evas_object_smart_callback_add(view, "perform,server,redirect", onWebViewServerRedirect, 0);
     evas_object_smart_callback_add(view, "perform,client,redirect", onWebViewClientRedirect, 0);
     evas_object_smart_callback_add(view, "populate,visited,links", onWebViewPopulateVisitedLinks, 0);
+    evas_object_smart_callback_add(view, "inspector,view,create", onInspectorViewCreate, 0);
+    evas_object_smart_callback_add(view, "inspector,view,close", onInspectorViewClose, 0);
 
     connectEditingCallbacks(view);
 
@@ -135,6 +137,46 @@ Evas_Object* DumpRenderTreeChrome::createView() const
     return view;
 }
 
+Evas_Object* DumpRenderTreeChrome::createWebInspectorView()
+{
+    Evas_Object* inspectorView = drtViewAdd(m_evas);
+    if (!inspectorView)
+        return 0;
+
+    ewk_view_theme_set(inspectorView, DATA_DIR"/default.edj");
+
+    Evas_Object* mainFrame = ewk_view_frame_main_get(inspectorView);
+    evas_object_smart_callback_add(mainFrame, "load,finished", onInspectorFrameLoadFinished, 0);
+
+    evas_object_resize(inspectorView, LayoutTestController::maxViewWidth, LayoutTestController::maxViewHeight);
+    evas_object_show(inspectorView);
+    evas_object_focus_set(inspectorView, true);
+
+    return inspectorView;
+}
+
+void DumpRenderTreeChrome::removeWebInspectorView()
+{
+    Evas_Object* inspectorView = ewk_view_web_inspector_view_get(mainView());
+    if (!inspectorView)
+        return;
+
+    Evas_Object* mainFrame = ewk_view_frame_main_get(inspectorView);
+    evas_object_smart_callback_del(mainFrame, "load,finished", onInspectorFrameLoadFinished);
+
+    evas_object_del(inspectorView);
+    ewk_view_web_inspector_view_set(mainView(), 0);
+}
+
+void DumpRenderTreeChrome::waitInspectorLoadFinished()
+{
+    // Waits until the page has finished loading.
+    // Because it can't complete loading inspector.html before loading testURL.
+    Evas_Object* inspectorView = ewk_view_web_inspector_view_get(mainView());
+    if (inspectorView)
+        ecore_main_loop_begin();
+}
+
 void DumpRenderTreeChrome::removeWindow(Evas_Object* view)
 {
     const size_t pos = m_extraViews.find(view);
@@ -619,6 +661,25 @@ void DumpRenderTreeChrome::onWebViewPopulateVisitedLinks(void*, Evas_Object* ewk
     printf("Asked to populate visited links for WebView \"%s\"\n", ewk_view_uri_get(ewkView));
 }
 
+void DumpRenderTreeChrome::onInspectorViewCreate(void*, Evas_Object*, void*)
+{
+    Evas_Object* inspectorView = browser->createWebInspectorView();
+    if (inspectorView)
+        ewk_view_web_inspector_view_set(browser->mainView(), inspectorView);
+}
+
+void DumpRenderTreeChrome::onInspectorViewClose(void*, Evas_Object*, void*)
+{
+    browser->removeWebInspectorView();
+}
+
+void DumpRenderTreeChrome::onInspectorFrameLoadFinished(void*, Evas_Object*, void*)
+{
+    Evas_Object* inspectorView = ewk_view_web_inspector_view_get(browser->mainView());
+    if (inspectorView)
+        ecore_main_loop_quit();
+}
+
 void DumpRenderTreeChrome::onFrameProvisionalLoad(void*, Evas_Object* frame, void*)
 {
     if (!done && gLayoutTestController->dumpFrameLoadCallbacks()) {
index 9e2f323..db3b197 100644 (file)
@@ -48,6 +48,10 @@ public:
     Evas_Object* createNewWindow();
     void removeWindow(Evas_Object*);
 
+    Evas_Object* createWebInspectorView();
+    void removeWebInspectorView();
+    void waitInspectorLoadFinished();
+
     const Vector<Evas_Object*>& extraViews() const;
     void clearExtraViews();
 
@@ -105,6 +109,12 @@ private:
 
     static void onFrameCreated(void*, Evas_Object*, void*);
 
+    static void onInspectorViewCreate(void*, Evas_Object*, void*);
+
+    static void onInspectorViewClose(void*, Evas_Object*, void*);
+
+    static void onInspectorFrameLoadFinished(void*, Evas_Object*, void*);
+
     static void onFrameIconChanged(void*, Evas_Object*, void*);
 
     static void onFrameProvisionalLoad(void*, Evas_Object*, void*);
index 32f4c39..732ad28 100644 (file)
@@ -65,6 +65,10 @@ static void onConsoleMessage(Ewk_View_Smart_Data*, const char* message, unsigned
             newMessage = newMessage.left(fileProtocol) + urlSuitableForTestResult(newMessage.substring(fileProtocol));
     }
 
+    // Ignore simple translation-related messages and unnecessary messages
+    if (newMessage.contains("Localized string") || newMessage.contains("Protocol Error: the message is for non-existing domain 'Profiler'"))
+        return;
+
     printf("CONSOLE MESSAGE: ");
     if (lineNumber)
         printf("line %u: ", lineNumber);
index 3352fe6..6bf9635 100644 (file)
@@ -765,17 +765,18 @@ void LayoutTestController::setAsynchronousSpellCheckingEnabled(bool)
 
 void LayoutTestController::showWebInspector()
 {
-    notImplemented();
+    ewk_view_web_inspector_show(browser->mainView());
+    browser->waitInspectorLoadFinished();
 }
 
 void LayoutTestController::closeWebInspector()
 {
-    notImplemented();
+    ewk_view_web_inspector_close(browser->mainView());
 }
 
-void LayoutTestController::evaluateInWebInspector(long, JSStringRef)
+void LayoutTestController::evaluateInWebInspector(long callId, JSStringRef script)
 {
-    notImplemented();
+    DumpRenderTreeSupportEfl::evaluateInWebInspector(browser->mainView(), callId, String(script->ustring().impl()));
 }
 
 void LayoutTestController::evaluateScriptInIsolatedWorldAndReturnValue(unsigned, JSObjectRef, JSStringRef)