Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 29367522: Issue #4688, #3595 - Web request use scheduled threads; unit tests terminate

Created:
Dec. 14, 2016, 8:38 p.m. by Eric
Modified:
Dec. 19, 2016, 7:51 p.m.
Reviewers:
sergei, Felix Dahlke
Visibility:
Public.

Description

Issue #4688, #3595 - Web request use scheduled threads; unit tests terminate For #3595, change the web request object to use scheduled threads and not detached ones. This had caused unit tests to hang, because the unit tests were defective. One of the tasks in the unit tests contained an infinite loop and any thread that ran it never terminated, thus blocking eternally when joined. For #4688, replace the infinite loop with a condition variable. Introduce the class `LazyWaiter` to encapsulate this behavior. Add a member of this type to `LazyWebRequest` and expose a `Cancel()` function. Add `TearDown()` functions to unit tests as appropriate and call `Cancel()` within them. Fix some miscellaneous problems in 'test/Prefs.cpp' that were throwing errors when running the unit tests.

Patch Set 1 #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+61 lines, -12 lines) Patch
M src/WebRequestJsObject.cpp View 2 chunks +3 lines, -2 lines 0 comments Download
M test/BaseJsTest.h View 2 chunks +38 lines, -2 lines 1 comment Download
M test/FilterEngine.cpp View 1 chunk +12 lines, -1 line 0 comments Download
M test/Prefs.cpp View 3 chunks +3 lines, -7 lines 1 comment Download
M test/UpdateCheck.cpp View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 1
Eric
Dec. 14, 2016, 8:53 p.m. (2016-12-14 20:53:56 UTC) #1
This finishes #4688 completely and finishes remaining easy case for #3595. See
also this review, upon which this one is based:
    https://codereview.adblockplus.org/29367507/#msg1

The unit tests all pass, but there's a lot of new messages written to the test
runner console. They're various kinds of JavaScript error messages with
tracebacks. I haven't filed an issue for these, but it looks like there's some
JavaScript exception handling that's missing.

https://codereview.adblockplus.org/29367522/diff/29367523/test/BaseJsTest.h
File test/BaseJsTest.h (right):

https://codereview.adblockplus.org/29367522/diff/29367523/test/BaseJsTest.h#n...
test/BaseJsTest.h:152: mutable LazyWaiter w;
Declared mutable because `GET()` is declared `const`. It's overriding a virtual
method, so we can't change the function declaration.

https://codereview.adblockplus.org/29367522/diff/29367523/test/Prefs.cpp
File test/Prefs.cpp (left):

https://codereview.adblockplus.org/29367522/diff/29367523/test/Prefs.cpp#oldc...
test/Prefs.cpp:20: #include "../src/Thread.h"
Don't know how this snuck through previous compilations.

Powered by Google App Engine
This is Rietveld