Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Issue 906193003: shouldBecomeEqual() behaves as shouldBe() if the testing expression returns the expected value

Created:
5 years, 10 months ago by grzegorz
Modified:
4 years, 3 months ago
Reviewers:
tony, yosin_UTC9
CC:
blink-reviews, groby+blinkspell_chromium.org, Xiaocheng
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

shouldBecomeEqual() behaves as synchronous shouldBe() if the testing expression returns the expected value First call of eval(expression) inside shouldBecomeEqual was always made synchronously. If the testing expression returns the same value as expected one then shouldBecomeEqual() will immediately report PASS, for example, shouldBecomeEqual(internals.hasSpellingMarker(document, "welllcome"), false); in consequence, assuming asynchronous path of spellchecking, spelling markers may appear after a while. The bug was caused by checking a condition at the beginning of shouldBecomeEqual(), before calling a timer. As a result, queued asynchronous events doesn't effect this checking. Since shouldBecomeEqual always checks condition asynchronously, the following layout tests need to be synchronized a bit: - editing/spelling/editing-multiple-words-with-markers.html - editing/spelling/spellcheck-paste-continuous-disabled.html BUG=456756 TEST=resources-tests/should-become-equal-test.html

Patch Set 1 #

Total comments: 21

Patch Set 2 : Add regression test #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+81 lines, -18 lines) Patch
M LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html View 1 chunk +7 lines, -6 lines 0 comments Download
M LayoutTests/editing/spelling/spellcheck-paste-disabled.html View 1 chunk +8 lines, -8 lines 0 comments Download
A LayoutTests/resources-tests/should-become-equal-test.html View 1 1 chunk +48 lines, -0 lines 2 comments Download
A LayoutTests/resources-tests/should-become-equal-test-expected.txt View 1 1 chunk +14 lines, -0 lines 0 comments Download
M LayoutTests/resources/js-test.js View 4 chunks +4 lines, -4 lines 2 comments Download

Messages

Total messages: 29 (6 generated)
grzegorz
5 years, 10 months ago (2015-02-09 12:24:50 UTC) #2
Dirk Pranke
I know nothing about these tests ... +yosin, maybe?
5 years, 10 months ago (2015-02-09 21:02:56 UTC) #3
groby-ooo-7-16
Rouslan for spellcheck tests
5 years, 10 months ago (2015-02-09 21:42:47 UTC) #6
grzegorz
Additionally, we need to add "meagesga" to MockSpellCheck::misspelled_words as a newly added test expects it ...
5 years, 10 months ago (2015-02-10 08:45:23 UTC) #7
please use gerrit instead
Since you're modifying the original tests from http://trac.webkit.org/changeset/168426 so much, you don't need to stick ...
5 years, 10 months ago (2015-02-10 22:32:52 UTC) #9
please use gerrit instead
Thank you for the patch! Adding a failing test and immediately disabling it is dangerous, ...
5 years, 10 months ago (2015-02-10 22:55:42 UTC) #10
please use gerrit instead
https://codereview.chromium.org/906193003/diff/1/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html File LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html (right): https://codereview.chromium.org/906193003/diff/1/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html#newcode30 LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html:30: shouldBecomeEqual('internals.hasSpellingMarker(document, 0, 2)', 'true', function() { If this fixes ...
5 years, 10 months ago (2015-02-10 22:57:50 UTC) #11
please use gerrit instead
https://codereview.chromium.org/906193003/diff/1/LayoutTests/resources/js-test.js File LayoutTests/resources/js-test.js (right): https://codereview.chromium.org/906193003/diff/1/LayoutTests/resources/js-test.js#newcode316 LayoutTests/resources/js-test.js:316: setTimeout(_waitForCondition, 5, _condition, _failureTime, _completionHandler, _failureHandler); This is not ...
5 years, 10 months ago (2015-02-10 22:59:20 UTC) #12
grzegorz
https://codereview.chromium.org/906193003/diff/1/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html File LayoutTests/editing/spelling/editing-multiple-words-with-markers.html (right): https://codereview.chromium.org/906193003/diff/1/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html#newcode27 LayoutTests/editing/spelling/editing-multiple-words-with-markers.html:27: typeText(textArea, "it's a meagesga meagesga "); On 2015/02/10 22:55:42, ...
5 years, 10 months ago (2015-02-11 10:54:23 UTC) #13
grzegorz
https://codereview.chromium.org/906193003/diff/1/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html File LayoutTests/editing/spelling/editing-multiple-words-with-markers.html (right): https://codereview.chromium.org/906193003/diff/1/LayoutTests/editing/spelling/editing-multiple-words-with-markers.html#newcode27 LayoutTests/editing/spelling/editing-multiple-words-with-markers.html:27: typeText(textArea, "it's a meagesga meagesga "); On 2015/02/11 10:54:23, ...
5 years, 10 months ago (2015-02-11 11:53:28 UTC) #14
grzegorz
On 2015/02/10 22:55:42, Rouslan Solomakhin wrote: > Thank you for the patch! Adding a failing ...
5 years, 10 months ago (2015-02-11 12:07:15 UTC) #15
please use gerrit instead
I would approve changes to shouldBecomeEqual that fix a problem with shouldBecomeEqual, only if you ...
5 years, 10 months ago (2015-02-11 21:53:38 UTC) #16
grzegorz
On 2015/02/11 21:53:38, Rouslan Solomakhin wrote: > I would approve changes to shouldBecomeEqual that fix ...
5 years, 10 months ago (2015-02-12 13:38:30 UTC) #17
grzegorz
Any comments on this?
5 years, 10 months ago (2015-02-17 08:39:37 UTC) #18
please use gerrit instead
What do Blink people think? I'm concerned that this change slows down by 5 seconds ...
5 years, 10 months ago (2015-02-17 16:28:48 UTC) #19
Dirk Pranke
I apologize, in that I already punted out of this CL once by disclaiming any ...
5 years, 10 months ago (2015-02-17 22:09:49 UTC) #20
please use gerrit instead
I would agree that we need to discard this approach. If there's a problem, we ...
5 years, 10 months ago (2015-02-17 22:11:26 UTC) #21
grzegorz
On 2015/02/17 16:28:48, Rouslan Solomakhin wrote: > What do Blink people think? I'm concerned that ...
5 years, 10 months ago (2015-02-18 15:32:00 UTC) #22
please use gerrit instead
Ah, 5 ms. Sorry I misread your code. That's not as bad. Still, I would ...
5 years, 10 months ago (2015-02-18 15:57:18 UTC) #23
yosin_UTC9
On 2015/02/18 15:57:18, Rouslan Solomakhin wrote: > Ah, 5 ms. Sorry I misread your code. ...
5 years, 10 months ago (2015-02-19 04:53:20 UTC) #24
grzegorz
On 2015/02/19 04:53:20, Yosi_UTC9 wrote: > On 2015/02/18 15:57:18, Rouslan Solomakhin wrote: > > Ah, ...
5 years, 10 months ago (2015-02-19 15:31:02 UTC) #25
please use gerrit instead
> As for testing side, we do > not have any callbacks to notify us ...
5 years, 10 months ago (2015-02-19 15:38:46 UTC) #26
yosin_UTC9
4 years, 3 months ago (2016-09-01 01:49:07 UTC) #29
https://codereview.chromium.org/906193003/diff/20001/LayoutTests/resources-te...
File LayoutTests/resources-tests/should-become-equal-test.html (right):

https://codereview.chromium.org/906193003/diff/20001/LayoutTests/resources-te...
LayoutTests/resources-tests/should-become-equal-test.html:1: <html>
Could you use w3c test harness to test |shouldBecomeEqual()|?
https://github.com/w3c/testharness.js/blob/master/docs/api.md

BTW, ideal solution is using |asyn_test()| in w3c test harness.
At this time there are 70 files using |shouldBecomeEqual()|,
it is too far away to reach ideal world. :-<

https://codereview.chromium.org/906193003/diff/20001/LayoutTests/resources/js...
File LayoutTests/resources/js-test.js (right):

https://codereview.chromium.org/906193003/diff/20001/LayoutTests/resources/js...
LayoutTests/resources/js-test.js:316: setTimeout(_waitForCondition, 5,
_condition, _failureTime, _completionHandler, _failureHandler);
On 2015/02/17 at 16:28:48, rouslan wrote:
> I'm still quite queasy about this change. We are slowing down each one of our
tests by 5 seconds? That's bad.

It is "5ms" instead of "5s".
https://developer.mozilla.org/en-US/docs/Web/API/WindowTimers/setTimeout

Could you have |const| variable to describe unit of delay?
e.g. const kDelayMilliseconds = 5;

BTW, 5ms is too small, since frame rate is 60Hz. 16ms may be enough.

Powered by Google App Engine
This is Rietveld 408576698