Bug 73922 - [Qt] Public API watch dog auto test.
Summary: [Qt] Public API watch dog auto test.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jocelyn Turcotte
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-06 07:18 PST by Jocelyn Turcotte
Modified: 2012-01-20 02:05 PST (History)
4 users (show)

See Also:


Attachments
Patch (11.52 KB, patch)
2011-12-06 07:22 PST, Jocelyn Turcotte
no flags Details | Formatted Diff | Diff
Patch (9.71 KB, patch)
2012-01-19 04:43 PST, Jocelyn Turcotte
no flags Details | Formatted Diff | Diff
Patch (9.71 KB, patch)
2012-01-19 06:55 PST, Jocelyn Turcotte
hausmann: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jocelyn Turcotte 2011-12-06 07:18:31 PST
[Qt] Public API watch dog auto test.
Comment 1 Jocelyn Turcotte 2011-12-06 07:22:10 PST
Created attachment 118048 [details]
Patch
Comment 2 WebKit Review Bot 2011-12-06 07:35:23 PST
Attachment 118048 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'ChangeLog', u'Source/WebKit2/ChangeLog', u..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:111:  Line contains only semicolon. If this should be an empty statement, use { } instead.  [whitespace/semicolon] [5]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jocelyn Turcotte 2011-12-06 07:47:00 PST
(In reply to comment #2)
> Attachment 118048 [details] did not pass style-queue:

Please ignore that one, it's on its own line to make editing the list easier.
Comment 4 Simon Hausmann 2011-12-07 11:56:17 PST
Comment on attachment 118048 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=118048&action=review

> Source/WebKit2/UIProcess/API/qt/tests/publicapi/publicapi.pro:3
> +DEFINES += IMPORT_DIR=\"\\\"$${ROOT_BUILD_DIR}$${QMAKE_DIR_SEP}imports\\\"\"

Would it make sense to have this in tests.pri shared with qmltests?

> Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:126
> +    QVariant val = property.read(obj);
> +    if (val.type() == QVariant::UserType) {
> +        QObject* childObj = *reinterpret_cast<QObject**>(val.data());
> +        if (childObj)

I think you can write this as

    if (QObject* childObj = qvariant_cast<QObject*>(val)) {
    }

Even if that doesn't work I'm almost sure there's a nicer way instead of using a reinterpret_cast on val.data() :)
</nitpick>

> Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:157
> +    view.setSource(QUrl(QUICK_TEST_SOURCE_DIR "/tst_publicapi.qml"));

I think instead of a separate file you can also use a data url here. Saves you the dummy external file :). I think some other auto-test uses that. Or no, I think Qt WTR uses that trick :)
Comment 5 Jocelyn Turcotte 2012-01-19 04:43:08 PST
Created attachment 123107 [details]
Patch

Updated the patch to work with the latest API.
A signal now contains a QWebNavigationRequest which wasn't possible to check just with the root item.
The approach is now to manually keep a list of types to check and access their ::staticMetaObject directly.
Firing up a WebView in a QQuickView or accessing a QVariant value isn't necessary anymore.
The semicolon style error is intentional to make copy-pasting the API in the source file easier.
Comment 6 WebKit Review Bot 2012-01-19 04:47:08 PST
Attachment 123107 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'ChangeLog', u'Source/WebKit2/ChangeLog', u..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:77:  Line contains only semicolon. If this should be an empty statement, use { } instead.  [whitespace/semicolon] [5]
Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:108:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 2 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Jocelyn Turcotte 2012-01-19 06:55:57 PST
Created attachment 123121 [details]
Patch

Add the style fix that was lying in my working tree.
Comment 8 WebKit Review Bot 2012-01-19 07:00:27 PST
Attachment 123121 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'ChangeLog', u'Source/WebKit2/ChangeLog', u..." exit_code: 1

Source/WebKit2/UIProcess/API/qt/tests/publicapi/tst_publicapi.cpp:77:  Line contains only semicolon. If this should be an empty statement, use { } instead.  [whitespace/semicolon] [5]
Total errors found: 1 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Jocelyn Turcotte 2012-01-20 02:05:07 PST
Committed r105498: <http://trac.webkit.org/changeset/105498>