Bug 84961 - [GTK] and [Win] TestWebKitAPI/WebKit2/TestSpacebarScrolling fails
Summary: [GTK] and [Win] TestWebKitAPI/WebKit2/TestSpacebarScrolling fails
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Roger Fong
Keywords: Gtk
Depends on:
Reported: 2012-04-26 07:54 PDT by Carlos Garcia Campos
Modified: 2017-03-11 10:54 PST (History)
6 users (show)

See Also:

patch (1.30 KB, patch)
2012-09-28 15:17 PDT, Roger Fong
no flags Details | Formatted Diff | Diff
patch (1.34 KB, patch)
2012-10-01 14:55 PDT, Roger Fong
andersca: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 2012-04-26 07:54:07 PDT
We need to look at it in detail, I don't know why it fails
Comment 1 Carlos Garcia Campos 2012-04-26 07:58:03 PDT
[ FATAL ] ../Source/ThirdParty/gtest/include/gtest/internal/gtest-port.h:1059:: pthread_mutex_destroy(&mutex_)failed with error 16
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from WebKit2
[ RUN      ] WebKit2.SpacebarScrolling
../Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:92: Failure
JS expression: isDocumentScrolled()
       Actual: false
     Expected: true
Tests failed: Programs/TestWebKitAPI/WebKit2/TestSpacebarScrolling
Comment 2 Roger Fong 2012-09-28 14:58:03 PDT
This also breaks on the Apple Windows port.

I got it to work by adding the second call to EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()") to after the call to isDocumentScrolled. At least on Windows if you don't re-enter the javascript context first after simulating the space bar key press the document won't actually scroll.

I thought it could have been a timing thing at first so I put a nice long loop into the SpaceBarScrolling.cpp could right before the failing EXPECT_JS_TRUE to see if it the page just didn't have time to scroll before the check. It still failed. So there's probably something goofy going on with the Windows TestWebKitAPI support, but for now, just switching the two lines will make the test pass. 

Maybe it will work on gtk as well...
Comment 3 Roger Fong 2012-09-28 15:15:17 PDT
Same behaviour can be observed earlier in the test right after the first space press is simulated. 


    EXPECT_JS_FALSE(webView.page(), "isDocumentScrolled()");
    EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()");

If you switch the second two lines to:


    EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()");
    EXPECT_JS_FALSE(webView.page(), "isDocumentScrolled()");
the test will fail on the first EXPECT_JS_TRUE because the spacebarkeypress has not yet actually happened.

The patch I'll land is a work around for this test but I'll file a new bug for the larger problem at hand.
Comment 4 Roger Fong 2012-09-28 15:17:46 PDT
Created attachment 166322 [details]
Comment 5 Tim Horton 2012-10-01 11:37:14 PDT
Comment on attachment 166322 [details]

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

> Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:92
> +    EXPECT_JS_TRUE(webView.page(), "textFieldContainsSpace()");

I think it would be interesting to know why this needs to happen before isDocumentScrolled() returns the correct value.

You should see if a 0-delay timeout also fixes this, and then it would be interesting to know what's different between Win/Mac wrt. isDocumentScrolled and spinning the runloop.
Comment 6 Roger Fong 2012-10-01 14:33:52 PDT
Disregard the patch. It defeats the purpose of the test. Making a new test that just disables the failing line on Win using an #if
Comment 7 Roger Fong 2012-10-01 14:39:58 PDT
Bug to track the larger problem at hand:
Comment 8 Roger Fong 2012-10-01 14:55:38 PDT
Created attachment 166552 [details]
Comment 9 Roger Fong 2012-10-01 17:17:35 PDT
Hmm can I get an r+/- from someone?
Comment 10 Anders Carlsson 2012-10-02 14:16:38 PDT
Comment on attachment 166552 [details]

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

> Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:92

You should put a comment here with the link to the relevant bugzilla bug here.
Comment 11 Roger Fong 2012-10-02 15:41:19 PDT
Comment added,
committed here: http://trac.webkit.org/changeset/130221

Leaving bug open in case GTK wants to do the same...
Comment 12 Eric Seidel (no email) 2013-01-04 00:52:47 PST
Attachment 166552 [details] was posted by a committer and has review+, assigning to Roger Fong for commit.