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

Issue 7576024: Provide ability for WebUIBrowserTests to run asynchronous tests. (Closed)

Created:
9 years, 4 months ago by Sheridan Rawlins
Modified:
9 years, 4 months ago
CC:
chromium-reviews, dpapad
Visibility:
Public.

Description

Provide ability for WebUIBrowserTests to run asynchronous tests. BUG=91737 R=mmenke@chromium.org,dtseng@chromium.org TEST=browser_tests --gtest_filter=WebUIBrowserAsyncTest.* Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=96620

Patch Set 1 #

Patch Set 2 : Added isAsyncTestDone. #

Patch Set 3 : Added currentTestFunction & currentTestArguments for asyncTestDone. #

Patch Set 4 : Don't need to expose isAsyncTestDone. #

Total comments: 6

Patch Set 5 : Address Mark's comments. #

Patch Set 6 : corrected case testing async is done. #

Patch Set 7 : Added log for quitting the message loop and quit first. #

Patch Set 8 : Added some tests for async behavior. #

Patch Set 9 : Added comments, and mock to ensure that test passing works. #

Patch Set 10 : Added tests to verify pass-pass and pass-fail work. #

Total comments: 11

Patch Set 11 : Moved |errors| around and do errors.splice only when completing results. #

Total comments: 2

Patch Set 12 : Added test to ensure early asyncTestDone still terminates when calling WaitForAsyncResult(). #

Patch Set 13 : Ditched WaitForAsyncResult - rolled async stuff into WaitForResult. #

Patch Set 14 : Added failure and test when asyncTestDone() is called for non-async tests. #

Total comments: 15

Patch Set 15 : More review cleanups and comments. #

Patch Set 16 : Logic to handle multiple events coming on one RunMessageLoop() call. #

Total comments: 23

Patch Set 17 : More comment/test updates. #

Patch Set 18 : Some more comment updates. #

Patch Set 19 : test_api always sends testResult message (by calling testDone() when !isAsync). #

Patch Set 20 : Rebase. #

Total comments: 7

Patch Set 21 : Review comments, fixed chrome.send passthrough, fixed assertion tests to use runTestFunction. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+530 lines, -65 lines) Patch
M .gitignore View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/ui/webui/web_ui_browsertest.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +16 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/web_ui_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 9 chunks +252 lines, -6 lines 0 comments Download
M chrome/browser/ui/webui/web_ui_test_handler.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +29 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/web_ui_test_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +62 lines, -11 lines 0 comments Download
M chrome/test/data/webui/assertions.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 3 chunks +9 lines, -3 lines 0 comments Download
A chrome/test/data/webui/async.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +66 lines, -0 lines 0 comments Download
M chrome/test/data/webui/test_api.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 chunks +95 lines, -39 lines 0 comments Download

Messages

Total messages: 33 (0 generated)
Sheridan Rawlins
Mark will take this patch and amend his changes in http://codereview.chromium.org/7553009/ to use the WebUI ...
9 years, 4 months ago (2011-08-05 00:33:57 UTC) #1
mmenke
http://codereview.chromium.org/7576024/diff/3002/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/3002/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode40 chrome/browser/ui/webui/web_ui_test_handler.cc:40: ui_test_utils::RunMessageLoop(); You need to check |test_done_async_| here, and not ...
9 years, 4 months ago (2011-08-05 00:47:22 UTC) #2
Sheridan Rawlins
http://codereview.chromium.org/7576024/diff/3002/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/3002/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode40 chrome/browser/ui/webui/web_ui_test_handler.cc:40: ui_test_utils::RunMessageLoop(); On 2011/08/05 00:47:22, Matt Menke wrote: > You ...
9 years, 4 months ago (2011-08-05 01:15:48 UTC) #3
Sheridan Rawlins
FYI, I added a few tests in web_ui_browsertests.cc to demonstrate how this can be used ...
9 years, 4 months ago (2011-08-05 07:37:06 UTC) #4
David Tseng
http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode46 chrome/browser/ui/webui/web_ui_test_handler.cc:46: bool WebUITestHandler::WaitForAsyncResult() { This looks virtually identical to WaitForResult. ...
9 years, 4 months ago (2011-08-05 13:45:40 UTC) #5
mmenke
http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode67 chrome/browser/ui/webui/web_ui_test_handler.cc:67: test_done_async_ = true; On 2011/08/05 13:45:40, David Tseng wrote: ...
9 years, 4 months ago (2011-08-05 13:54:18 UTC) #6
David Tseng
On 8/5/11, mmenke@chromium.org <mmenke@chromium.org> wrote: > > http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc > File chrome/browser/ui/webui/web_ui_test_handler.cc (right): > > http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode67 ...
9 years, 4 months ago (2011-08-05 14:30:08 UTC) #7
Sheridan Rawlins
http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/10007/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode46 chrome/browser/ui/webui/web_ui_test_handler.cc:46: bool WebUITestHandler::WaitForAsyncResult() { The distinction is that our "normal" ...
9 years, 4 months ago (2011-08-05 15:41:58 UTC) #8
mmenke
You should update the "TEST=" part of the CL description. http://codereview.chromium.org/7576024/diff/10007/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): http://codereview.chromium.org/7576024/diff/10007/chrome/test/data/webui/test_api.js#newcode499 ...
9 years, 4 months ago (2011-08-05 16:08:28 UTC) #9
Sheridan Rawlins
http://codereview.chromium.org/7576024/diff/10007/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): http://codereview.chromium.org/7576024/diff/10007/chrome/test/data/webui/test_api.js#newcode499 chrome/test/data/webui/test_api.js:499: var errors = []; On 2011/08/05 16:08:28, Matt Menke ...
9 years, 4 months ago (2011-08-05 16:59:56 UTC) #10
David Tseng
I'm aware of what the goal/interaction is (basically adding back the way I used to ...
9 years, 4 months ago (2011-08-05 17:41:56 UTC) #11
Sheridan Rawlins
On 2011/08/05 17:41:56, David Tseng wrote: > I'm aware of what the goal/interaction is (basically ...
9 years, 4 months ago (2011-08-05 18:07:09 UTC) #12
David Tseng
> > I'd really like to prefer the maintainability of supporting non-flaky tests > over ...
9 years, 4 months ago (2011-08-05 18:14:39 UTC) #13
Paweł Hajdan Jr.
Drive-by with a testing suggestion. http://codereview.chromium.org/7576024/diff/12003/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/12003/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode15 chrome/browser/ui/webui/web_ui_test_handler.cc:15: WebUITestHandler::WebUITestHandler() Have you considered ...
9 years, 4 months ago (2011-08-05 18:17:14 UTC) #14
mmenke
On 2011/08/05 18:07:09, Sheridan Rawlins wrote: > On 2011/08/05 17:41:56, David Tseng wrote: > > ...
9 years, 4 months ago (2011-08-05 18:41:06 UTC) #15
Sheridan Rawlins
On 2011/08/05 18:14:39, David Tseng wrote: > ...I'm not sure increasing the types of wait* ...
9 years, 4 months ago (2011-08-05 18:42:06 UTC) #16
Sheridan Rawlins
http://codereview.chromium.org/7576024/diff/12003/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/12003/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode15 chrome/browser/ui/webui/web_ui_test_handler.cc:15: WebUITestHandler::WebUITestHandler() David considered this some time ago. I don't ...
9 years, 4 months ago (2011-08-05 18:51:12 UTC) #17
mmenke
On second thought, looking at the mock stuff, I think I can get away with ...
9 years, 4 months ago (2011-08-05 18:59:50 UTC) #18
Sheridan Rawlins
On 2011/08/05 18:59:50, Matt Menke wrote: > On second thought, looking at the mock stuff, ...
9 years, 4 months ago (2011-08-05 21:44:52 UTC) #19
David Tseng
> > I disagree. Observe is called by receiving a message on the message loop ...
9 years, 4 months ago (2011-08-06 22:29:34 UTC) #20
Sheridan Rawlins
On 2011/08/06 22:29:34, David Tseng wrote: > Right, but the reason why we ditched this ...
9 years, 4 months ago (2011-08-07 17:08:29 UTC) #21
mmenke
http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode370 chrome/browser/ui/webui/web_ui_browsertest.cc:370: EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"), RunJavascriptAsyncTestNoReturn? http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode61 chrome/browser/ui/webui/web_ui_test_handler.cc:61: HandleTestResult(test_result, ...
9 years, 4 months ago (2011-08-08 16:38:25 UTC) #22
Sheridan Rawlins
http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode370 chrome/browser/ui/webui/web_ui_browsertest.cc:370: EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"), On 2011/08/08 16:38:25, Matt Menke wrote: > RunJavascriptAsyncTestNoReturn? ...
9 years, 4 months ago (2011-08-10 01:58:53 UTC) #23
mmenke
http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode370 chrome/browser/ui/webui/web_ui_browsertest.cc:370: EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"), On 2011/08/10 01:58:53, Sheridan Rawlins wrote: > On ...
9 years, 4 months ago (2011-08-10 04:17:53 UTC) #24
Sheridan Rawlins
http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7576024/diff/15003/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode370 chrome/browser/ui/webui/web_ui_browsertest.cc:370: EXPECT_FATAL_FAILURE(RunJavascriptTestNoReturn("FAILS_BogusFunctionName"), On 2011/08/10 04:17:53, Matt Menke wrote: > In ...
9 years, 4 months ago (2011-08-10 05:41:06 UTC) #25
mmenke
Want to give it a final once over, once you've updated your comments, but looking ...
9 years, 4 months ago (2011-08-10 17:23:34 UTC) #26
Sheridan Rawlins
Thanks for all of your comments - I'm glad I'm getting to share the knowledge ...
9 years, 4 months ago (2011-08-11 01:58:44 UTC) #27
mmenke
LGTM. One thing you might want to think about, in this CL or another, is ...
9 years, 4 months ago (2011-08-11 15:16:15 UTC) #28
Sheridan Rawlins
I _really_ like that suggestion. It is a nice marriage of the WebUI chrome.send() message ...
9 years, 4 months ago (2011-08-12 05:08:35 UTC) #29
Sheridan Rawlins
On 2011/08/12 05:08:35, Sheridan Rawlins wrote: > I _really_ like that suggestion. It is a ...
9 years, 4 months ago (2011-08-12 05:11:45 UTC) #30
mmenke
LGTM http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode108 chrome/browser/ui/webui/web_ui_test_handler.cc:108: ui_test_utils::RunMessageLoop(); I had hoped we could get rid ...
9 years, 4 months ago (2011-08-12 14:28:17 UTC) #31
mmenke
http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web_ui_test_handler.cc File chrome/browser/ui/webui/web_ui_test_handler.cc (right): http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web_ui_test_handler.cc#newcode60 chrome/browser/ui/webui/web_ui_test_handler.cc:60: SCOPED_TRACE("WebUITestHandler::HandleAsyncTestResult"); nit: Remove Async.
9 years, 4 months ago (2011-08-12 14:36:43 UTC) #32
Sheridan Rawlins
9 years, 4 months ago (2011-08-12 18:02:09 UTC) #33
Wow, the trybots uncovered a pre-existing bug with the chrome.send passthrough
case to C++ (this never affected you, Matt, because you weren't using javascript
handler mocks, and us, because we weren't mixing both C++ & javascript
handlers).  I added a comment to the line which needed a fix.  Also, this shift
required the assertion tests to have a facility to reset the test state (errors
+ testIsDone) because the assertion tests run a recursive runTestFunction which
they check for the format of the errors.

http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web...
File chrome/browser/ui/webui/web_ui_test_handler.cc (right):

http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web...
chrome/browser/ui/webui/web_ui_test_handler.cc:60:
SCOPED_TRACE("WebUITestHandler::HandleAsyncTestResult");
On 2011/08/12 14:36:44, Matt Menke wrote:
> nit:  Remove Async.

Done.

http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web...
chrome/browser/ui/webui/web_ui_test_handler.cc:108:
ui_test_utils::RunMessageLoop();
On 2011/08/12 14:28:17, Matt Menke wrote:
> I had hoped we could get rid of this, but does seem the safest way to handle
> WebUITestHandler::Observe.

Alas, this is the case given your earlier observations that we don't know if
we'll get both messages in one invocation of RunMessageLoop() or two.

http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web...
File chrome/browser/ui/webui/web_ui_test_handler.h (right):

http://codereview.chromium.org/7576024/diff/32003/chrome/browser/ui/webui/web...
chrome/browser/ui/webui/web_ui_test_handler.h:60: // Test code finished
executing.
On 2011/08/12 14:28:17, Matt Menke wrote:
> nit:  Might want a note that if the test is unable to execute the Javascript,
> still set to true.

Done.

http://codereview.chromium.org/7576024/diff/32003/chrome/test/data/webui/test...
File chrome/test/data/webui/test_api.js (right):

http://codereview.chromium.org/7576024/diff/32003/chrome/test/data/webui/test...
chrome/test/data/webui/test_api.js:225:
this.__proto__.send.apply(this.__proto__, args);
Need to include the messageName in the passthrough case.

Powered by Google App Engine
This is Rietveld 408576698