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

Issue 112023010: Make EventHandler::ActiveIntervalTimer mockable. (Closed)

Created:
7 years ago by Zeeshan Qureshi
Modified:
6 years, 5 months ago
Reviewers:
jamesr, Rick Byers, eseidel
CC:
blink-reviews, arv+blink, dglazkov+blink, eae+blinkwatch, Inactive, watchdog-blink-watchlist_google.com, jamesr, abarth-chromium
Visibility:
Public.

Description

Current layout tests for ActiveIntervalTimer use setTimeout, this would enable it to be suspended and fired manually for testing as well as eliminate flakiness. A more generalized solution for testing Timers would require adding some sort of reflection and/or a mocked system clock. BUG=319529

Patch Set 1 #

Total comments: 8

Patch Set 2 : Rename methods and handle pending fires #

Total comments: 14

Patch Set 3 : Address comments #

Patch Set 4 : Rebase ToT #

Patch Set 5 : Remove FINAL from Timer declaration. #

Total comments: 2

Patch Set 6 : Naming change #

Unified diffs Side-by-side diffs Delta from patch set Stats (+225 lines, -55 lines) Patch
M LayoutTests/fast/events/touch/gesture/gesture-tap-active-state.html View 1 2 4 chunks +8 lines, -26 lines 0 comments Download
M LayoutTests/fast/events/touch/gesture/gesture-tap-active-state-expected.txt View 1 chunk +1 line, -0 lines 0 comments Download
M LayoutTests/fast/events/touch/gesture/gesture-tap-active-state-iframe.html View 1 2 2 chunks +10 lines, -11 lines 0 comments Download
M LayoutTests/fast/events/touch/gesture/gesture-tap-active-state-iframe-expected.txt View 1 chunk +1 line, -0 lines 0 comments Download
M LayoutTests/fast/events/touch/gesture/gesture-tap-hover-clear.html View 1 2 3 chunks +8 lines, -16 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/page/EventHandler.h View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M Source/core/page/EventHandler.cpp View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.h View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.cpp View 1 2 3 4 5 1 chunk +15 lines, -0 lines 0 comments Download
M Source/core/testing/Internals.idl View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
A Source/core/testing/TimerTest.cpp View 1 2 1 chunk +122 lines, -0 lines 0 comments Download
M Source/platform/Timer.h View 1 2 3 4 5 2 chunks +45 lines, -1 line 0 comments Download

Messages

Total messages: 17 (0 generated)
Zeeshan Qureshi
Rick, can you do a first pass, there's a few things I'm not sure of. ...
7 years ago (2013-12-13 02:05:58 UTC) #1
Rick Byers
I think this is a reasonable approach. The challenge here is striking a pragmatic balance ...
7 years ago (2013-12-13 22:52:25 UTC) #2
Zeeshan Qureshi
Rick, tried to address your comments. https://codereview.chromium.org/112023010/diff/1/Source/platform/Timer.h File Source/platform/Timer.h (right): https://codereview.chromium.org/112023010/diff/1/Source/platform/Timer.h#newcode141 Source/platform/Timer.h:141: void suspend() { ...
6 years, 11 months ago (2014-01-07 19:35:09 UTC) #3
Rick Byers
Sorry for the delay! This is looking good! Just a couple minor suggestions. https://codereview.chromium.org/112023010/diff/20001/Source/core/testing/Internals.idl File ...
6 years, 11 months ago (2014-01-10 21:46:49 UTC) #4
Zeeshan Qureshi
https://codereview.chromium.org/112023010/diff/20001/Source/core/testing/Internals.idl File Source/core/testing/Internals.idl (right): https://codereview.chromium.org/112023010/diff/20001/Source/core/testing/Internals.idl#newcode136 Source/core/testing/Internals.idl:136: [RaisesException] void suspendActiveIntervalTimer(Document document); On 2014/01/10 21:46:50, Rick Byers ...
6 years, 11 months ago (2014-01-10 22:20:41 UTC) #5
Rick Byers
https://codereview.chromium.org/112023010/diff/20001/Source/core/testing/Internals.idl File Source/core/testing/Internals.idl (right): https://codereview.chromium.org/112023010/diff/20001/Source/core/testing/Internals.idl#newcode136 Source/core/testing/Internals.idl:136: [RaisesException] void suspendActiveIntervalTimer(Document document); On 2014/01/10 22:20:41, Zeeshan Qureshi ...
6 years, 11 months ago (2014-01-10 22:24:35 UTC) #6
Zeeshan Qureshi
6 years, 11 months ago (2014-01-13 18:54:16 UTC) #7
Rick Byers
lgtm update subject/description to remove 'WIP' and also add a bit more discussion about the ...
6 years, 11 months ago (2014-01-13 21:53:36 UTC) #8
Zeeshan Qureshi
eseidel@chromium.org: Please review changes in Timer.h
6 years, 11 months ago (2014-01-14 18:13:24 UTC) #9
eseidel
This feels like a very odd layer to hook in at. But I support the ...
6 years, 11 months ago (2014-01-14 22:12:14 UTC) #10
Zeeshan Qureshi
> This feels like a very odd layer to hook in at. > > But ...
6 years, 11 months ago (2014-01-14 23:33:55 UTC) #11
Rick Byers
On 2014/01/14 23:33:55, Zeeshan Qureshi wrote: > > This feels like a very odd layer ...
6 years, 11 months ago (2014-01-15 14:32:11 UTC) #12
Rick Byers
On 2014/01/15 14:32:11, Rick Byers wrote: > On 2014/01/14 23:33:55, Zeeshan Qureshi wrote: > > ...
6 years, 11 months ago (2014-01-16 20:44:42 UTC) #13
jamesr
I think you misunderstood. A full mock time is hard, of course, but mocking time ...
6 years, 11 months ago (2014-01-16 20:46:41 UTC) #14
Rick Byers
On 2014/01/16 20:46:41, jamesr wrote: > I think you misunderstood. A full mock time is ...
6 years, 11 months ago (2014-01-16 21:35:54 UTC) #15
eseidel
I'm OK with this, as long as there is a larger plan to use this ...
6 years, 11 months ago (2014-01-21 21:24:41 UTC) #16
Zeeshan Qureshi
6 years, 11 months ago (2014-01-21 21:56:53 UTC) #17
On 2014/01/21 21:24:41, eseidel wrote:
> I'm OK with this, as long as there is a larger plan to use this for more
things.
>  As a one-off it's somewhat expensive, but I can see that it enables a testing
> use case we previously didn't cover.

We're certainly going to add more tests soon covering :active, :hover and
related actions.

>
https://codereview.chromium.org/112023010/diff/510001/Source/core/page/EventH...
> File Source/core/page/EventHandler.h (right):
> 
>
https://codereview.chromium.org/112023010/diff/510001/Source/core/page/EventH...
> Source/core/page/EventHandler.h:152: MockableTimer<EventHandler>*
> getActiveIntervalTimerForTesting();
> Normally we don't use "get" in our getters in Blink.

Done.


> https://codereview.chromium.org/112023010/diff/510001/Source/platform/Timer.h
> File Source/platform/Timer.h (right):
> 
>
https://codereview.chromium.org/112023010/diff/510001/Source/platform/Timer.h...
> Source/platform/Timer.h:130: // a mocked system clock that would make this
> unnecessary.
> If this is no longer the plan, we should update this comment.

Removed, I'm still going to take a stab at it later and see what happens.
Considering that we pause blink while debugging, having the blink clock out of
sync for tests might not be a big issue.

Powered by Google App Engine
This is Rietveld 408576698