diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-23 09:28:44 +0200 |
commit | 815f1ed417bd26fbe2abbdf20ac5d3423b30796c (patch) | |
tree | 923c9a9e2834ccab60f5caecfb8f0ac410c1dd9e /Tools/DumpRenderTree | |
parent | b4ad5d9d2b96baacd0180ead50de5195ca78af2d (diff) | |
download | qtwebkit-815f1ed417bd26fbe2abbdf20ac5d3423b30796c.tar.gz |
Imported WebKit commit e65cbc5b6ac32627c797e7fc7f46eb7794410c92 (http://svn.webkit.org/repository/webkit/trunk@123308)
New snapshot with better configure tests
Diffstat (limited to 'Tools/DumpRenderTree')
20 files changed, 258 insertions, 116 deletions
diff --git a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp index 4fc5468f2..29773fb35 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp +++ b/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp @@ -424,7 +424,7 @@ }, }], }], - ['os_posix==1 and OS!="mac" and gcc_version==46', { + ['os_posix==1 and OS!="mac" and gcc_version>=46', { 'target_defaults': { # Disable warnings about c++0x compatibility, as some names (such # as nullptr) conflict with upcoming c++0x types. diff --git a/Tools/DumpRenderTree/DumpRenderTree.gypi b/Tools/DumpRenderTree/DumpRenderTree.gypi index 61e6a138f..e11f40ecd 100644 --- a/Tools/DumpRenderTree/DumpRenderTree.gypi +++ b/Tools/DumpRenderTree/DumpRenderTree.gypi @@ -14,6 +14,8 @@ 'chromium/MockGrammarCheck.h', 'chromium/MockSpellCheck.cpp', 'chromium/MockSpellCheck.h', + 'chromium/MockWebKitPlatformSupport.cpp', + 'chromium/MockWebKitPlatformSupport.h', 'chromium/MockWebPrerenderingSupport.cpp', 'chromium/MockWebPrerenderingSupport.h', 'chromium/MockWebSpeechInputController.cpp', @@ -84,7 +86,6 @@ 'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURL.cpp', 'TestNetscapePlugIn/Tests/GetURLWithJavaScriptURLDestroyingPlugin.cpp', 'TestNetscapePlugIn/Tests/GetUserAgentWithNullNPPFromNPPNew.cpp', - 'TestNetscapePlugIn/Tests/LeakWindowScriptableObject.cpp', 'TestNetscapePlugIn/Tests/NPRuntimeObjectFromDestroyedPlugin.cpp', 'TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp', 'TestNetscapePlugIn/Tests/NullNPPGetValuePointer.cpp', diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp index a3e97831b..65dcaecd3 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.cpp @@ -208,11 +208,6 @@ void PluginTest::NPN_ReleaseObject(NPObject* npObject) browser->releaseobject(npObject); } -bool PluginTest::NPN_GetProperty(NPObject* npObject, NPIdentifier propertyName, NPVariant* value) -{ - return browser->getproperty(m_npp, npObject, propertyName, value); -} - bool PluginTest::NPN_RemoveProperty(NPObject* npObject, NPIdentifier propertyName) { return browser->removeproperty(m_npp, npObject, propertyName); diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h index e7cd90326..e83e82cfe 100644 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h +++ b/Tools/DumpRenderTree/TestNetscapePlugIn/PluginTest.h @@ -65,6 +65,7 @@ public: virtual NPError NPP_DestroyStream(NPStream*, NPReason); virtual int32_t NPP_WriteReady(NPStream*); virtual int32_t NPP_Write(NPStream*, int32_t offset, int32_t len, void* buffer); + virtual int16_t NPP_HandleEvent(void* event); virtual bool NPP_URLNotify(const char* url, NPReason, void* notifyData); virtual NPError NPP_GetValue(NPPVariable, void* value); @@ -86,7 +87,6 @@ public: NPObject* NPN_CreateObject(NPClass*); NPObject* NPN_RetainObject(NPObject*); void NPN_ReleaseObject(NPObject*); - bool NPN_GetProperty(NPObject*, NPIdentifier propertyName, NPVariant* value); bool NPN_RemoveProperty(NPObject*, NPIdentifier propertyName); #ifdef XP_MACOSX diff --git a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/LeakWindowScriptableObject.cpp b/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/LeakWindowScriptableObject.cpp deleted file mode 100644 index 93f52a28e..000000000 --- a/Tools/DumpRenderTree/TestNetscapePlugIn/Tests/LeakWindowScriptableObject.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "PluginTest.h" - -using namespace std; - -class LeakWindowScriptableObject : public PluginTest { -public: - LeakWindowScriptableObject(NPP npp, const string& identifier) - : PluginTest(npp, identifier) - { - } - -private: - virtual NPError NPP_New(NPMIMEType pluginType, uint16_t mode, int16_t argc, char *argn[], char *argv[], NPSavedData *saved) - { - // Get a new reference to the window script object. - NPObject* window; - if (NPN_GetValue(NPNVWindowNPObject, &window) != NPERR_NO_ERROR) { - log("Fail: Cannot fetch window script object"); - return NPERR_NO_ERROR; - } - - // Get another reference to the same object via window.self. - NPIdentifier self_name = NPN_GetStringIdentifier("self"); - NPVariant window_self_variant; - if (!NPN_GetProperty(window, self_name, &window_self_variant)) { - log("Fail: Cannot query window.self"); - return NPERR_NO_ERROR; - } - if (!NPVARIANT_IS_OBJECT(window_self_variant)) { - log("Fail: window.self is not an object"); - return NPERR_NO_ERROR; - } - - // Leak both references to the window script object. - return NPERR_NO_ERROR; - } -}; - -static PluginTest::Register<LeakWindowScriptableObject> leakWindowScriptableObject("leak-window-scriptable-object"); diff --git a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp index 789aa877f..e589df2bf 100644 --- a/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/chromium/DumpRenderTree.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "MockWebKitPlatformSupport.h" #include "TestShell.h" #include "WebCompositor.h" #include "webkit/support/webkit_support.h" @@ -72,7 +73,7 @@ class WebKitSupportTestEnvironment { public: WebKitSupportTestEnvironment() { - webkit_support::SetUpTestEnvironment(); + webkit_support::SetUpTestEnvironment(MockWebKitPlatformSupport::create()); } ~WebKitSupportTestEnvironment() { diff --git a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp new file mode 100644 index 000000000..d487b88aa --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "MockWebKitPlatformSupport.h" + +#include <wtf/Assertions.h> + +using namespace WebKit; + +Platform* MockWebKitPlatformSupport::create() +{ + return new MockWebKitPlatformSupport(); +} + +MockWebKitPlatformSupport::MockWebKitPlatformSupport() +{ +} + +void MockWebKitPlatformSupport::cryptographicallyRandomValues(unsigned char*, size_t) +{ + CRASH(); +} + +WebMediaStreamCenter* MockWebKitPlatformSupport::createMediaStreamCenter(WebMediaStreamCenterClient*) +{ + return 0; +} diff --git a/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h new file mode 100644 index 000000000..c5daa6f0f --- /dev/null +++ b/Tools/DumpRenderTree/chromium/MockWebKitPlatformSupport.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef MockWebKitPlatformSupport_h +#define MockWebKitPlatformSupport_h + +#include <public/Platform.h> + +class MockWebKitPlatformSupport : public WebKit::Platform { +public: + static WebKit::Platform* create(); + + virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) OVERRIDE; + + virtual WebKit::WebMediaStreamCenter* createMediaStreamCenter(WebKit::WebMediaStreamCenterClient*) OVERRIDE; + +private: + MockWebKitPlatformSupport(); +}; + +#endif // MockWebKitPlatformSupport_h diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp index 5cfb2c2f8..c0d532a07 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.cpp @@ -34,24 +34,58 @@ #include "GamepadController.h" #include "platform/WebString.h" +#include <wtf/OwnPtr.h> + using WebKit::WebFrame; using WebKit::WebString; -TestInterfaces::TestInterfaces() +class TestInterfaces::Internal { +public: + Internal(); + ~Internal(); + + void bindTo(WebFrame*); + void resetAll(); + +private: + OwnPtr<GamepadController> m_gamepadController; +}; + +TestInterfaces::Internal::Internal() { m_gamepadController = adoptPtr(new GamepadController()); } +TestInterfaces::Internal::~Internal() +{ +} + +void TestInterfaces::Internal::bindTo(WebFrame* frame) +{ + m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController")); +} + +void TestInterfaces::Internal::resetAll() +{ + m_gamepadController->reset(); +} + +TestInterfaces::TestInterfaces() + : m_internal(new TestInterfaces::Internal()) +{ +} + TestInterfaces::~TestInterfaces() { + delete m_internal; } void TestInterfaces::bindTo(WebFrame* frame) { - m_gamepadController->bindToJavascript(frame, WebString::fromUTF8("gamepadController")); + m_internal->bindTo(frame); } void TestInterfaces::resetAll() { - m_gamepadController->reset(); + m_internal->resetAll(); } diff --git a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h index e2404ad6d..16ed5a69e 100644 --- a/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h +++ b/Tools/DumpRenderTree/chromium/TestRunner/TestInterfaces.h @@ -31,14 +31,10 @@ #ifndef TestInterfaces_h #define TestInterfaces_h -#include <wtf/OwnPtr.h> - namespace WebKit { class WebFrame; } -class GamepadController; - class TestInterfaces { public: TestInterfaces(); @@ -48,7 +44,8 @@ public: void resetAll(); private: - OwnPtr<GamepadController> m_gamepadController; + class Internal; + Internal* m_internal; }; #endif // TestInterfaces_h diff --git a/Tools/DumpRenderTree/chromium/TestShellWin.cpp b/Tools/DumpRenderTree/chromium/TestShellWin.cpp index 850e5de81..083d54a1b 100644 --- a/Tools/DumpRenderTree/chromium/TestShellWin.cpp +++ b/Tools/DumpRenderTree/chromium/TestShellWin.cpp @@ -78,7 +78,7 @@ unsigned int __stdcall watchDogThread(void* arg) void TestShell::waitTestFinished() { - DCHECK(!m_testIsPending) << "cannot be used recursively"; + ASSERT(!m_testIsPending); m_testIsPending = true; @@ -89,7 +89,7 @@ void TestShell::waitTestFinished() // timeout, it can't do anything except terminate the test // shell, which is unfortunate. m_finishedEvent = CreateEvent(0, TRUE, FALSE, 0); - DCHECK(m_finishedEvent); + ASSERT(m_finishedEvent); HANDLE threadHandle = reinterpret_cast<HANDLE>(_beginthreadex( 0, @@ -98,7 +98,7 @@ void TestShell::waitTestFinished() this, 0, 0)); - DCHECK(threadHandle); + ASSERT(threadHandle); // TestFinished() will post a quit message to break this loop when the page // finishes loading. diff --git a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp index 13b798284..065df4f52 100755 --- a/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp +++ b/Tools/DumpRenderTree/chromium/WebThemeControlDRTWin.cpp @@ -43,6 +43,7 @@ #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkRect.h" +#include <algorithm> #include <wtf/Assertions.h> using namespace std; @@ -74,8 +75,8 @@ static SkIRect validate(const SkIRect& rect, WebThemeControlDRTWin::Type ctype) // The maximum width and height is 13. // Center the square in the passed rectangle. const int maxControlSize = 13; - int controlSize = min(rect.width(), rect.height()); - controlSize = min(controlSize, maxControlSize); + int controlSize = std::min(rect.width(), rect.height()); + controlSize = std::min(controlSize, maxControlSize); retval.fLeft = rect.fLeft + (rect.width() / 2) - (controlSize / 2); retval.fRight = retval.fLeft + controlSize - 1; diff --git a/Tools/DumpRenderTree/chromium/config.h b/Tools/DumpRenderTree/chromium/config.h index 57b3a54fc..ef418aec0 100644 --- a/Tools/DumpRenderTree/chromium/config.h +++ b/Tools/DumpRenderTree/chromium/config.h @@ -31,17 +31,6 @@ #ifndef config_h #define config_h -// To avoid confict of LOG in wtf/Assertions.h and LOG in base/logging.h, -// skip base/loggin.h by defining BASE_LOGGING_H_ and define some macros -// provided by base/logging.h. -// FIXME: Remove this hack! -#include <iostream> -#define BASE_LOGGING_H_ -#define CHECK(condition) while (false && (condition)) std::cerr -#define DCHECK(condition) while (false && (condition)) std::cerr -#define DCHECK_EQ(a, b) while (false && (a) == (b)) std::cerr -#define DCHECK_NE(a, b) while (false && (a) != (b)) std::cerr - #include <wtf/Platform.h> #include <wtf/ExportMacros.h> diff --git a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp index ee26356ac..752945410 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTree.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTree.cpp @@ -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)) { diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp index 8a901c41d..cc2f05bc2 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp @@ -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); @@ -359,16 +401,23 @@ static CString descriptionSuitableForTestResult(const Ewk_Frame_Resource_Respons static CString descriptionSuitableForTestResult(Ewk_Frame_Load_Error* error) { - String ret = "<NSError domain "; - ret += error->domain; - ret += ", code "; - ret += String::number(error->code); - if (error->failing_url && *error->failing_url != '\0') { - ret += ", failing URL \""; - ret += error->failing_url; - ret += "\""; + const char* errorDomain = error->domain; + int errorCode = error->code; + + // We need to do some error mapping here to match + // the test expectations. + if (!strcmp(error->domain, "WebKitNetworkError")) { + errorDomain = "NSURLErrorDomain"; + errorCode = -999; } - ret += ">"; + + if (!strcmp(errorDomain, "WebKitPolicyError")) + errorDomain = "WebKitErrorDomain"; + + String ret = makeString("<NSError domain ", errorDomain, ", code ", String::number(errorCode)); + if (error->failing_url && *error->failing_url != '\0') + ret = makeString(ret, ", failing URL \"", error->failing_url, "\""); + ret = makeString(ret, ">"); return ret.utf8(); } @@ -619,6 +668,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()) { diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h index 9e2f32372..db3b19760 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.h @@ -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*); diff --git a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp index 32f4c39b3..732ad28c2 100644 --- a/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp +++ b/Tools/DumpRenderTree/efl/DumpRenderTreeView.cpp @@ -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); diff --git a/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp b/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp index 3352fe678..6bf963542 100644 --- a/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp +++ b/Tools/DumpRenderTree/efl/LayoutTestControllerEfl.cpp @@ -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) diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp index bc88cb48f..e35f900ad 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp @@ -94,10 +94,8 @@ void LayoutTestController::reset() DumpRenderTreeSupportQt::resetGeolocationMock(m_drt->webPage()); setIconDatabaseEnabled(false); clearAllDatabases(); -#if QT_VERSION >= 0x040800 // The default state for DRT is to block third-party cookies, mimicing the Mac port setAlwaysAcceptCookies(false); -#endif emit hidePage(); } @@ -977,7 +975,6 @@ void LayoutTestController::setTextDirection(const QString& directionName) m_drt->webPage()->triggerAction(QWebPage::SetTextDirectionLeftToRight); } -#if QT_VERSION >= 0x040800 void LayoutTestController::setAlwaysAcceptCookies(bool accept) { QWebSettings* globalSettings = QWebSettings::globalSettings(); @@ -997,7 +994,6 @@ void LayoutTestController::setAlwaysBlockCookies(bool block) else globalSettings->setThirdPartyCookiePolicy(QWebSettings::AlwaysAllowThirdPartyCookies); } -#endif const unsigned LayoutTestController::maxViewWidth = 800; const unsigned LayoutTestController::maxViewHeight = 600; diff --git a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h index b54f2f7e8..7e7018e1d 100644 --- a/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h +++ b/Tools/DumpRenderTree/qt/LayoutTestControllerQt.h @@ -275,10 +275,8 @@ public slots: void setTextDirection(const QString& directionName); void goBack(); void setDefersLoading(bool); -#if QT_VERSION >= 0x040800 void setAlwaysAcceptCookies(bool); void setAlwaysBlockCookies(bool); -#endif private slots: void processWork(); |