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

Issue 7645007: WebUI Testing: async support - global mocking, deferred runs, continued run. (Closed)

Created:
9 years, 4 months ago by Sheridan Rawlins
Modified:
9 years, 4 months ago
CC:
chromium-reviews, Paweł Hajdan Jr., Lei Zhang, dpapad
Visibility:
Public.

Description

- Add ability to save all matched args and call a function with them in mock.will() - Add ability to mock globals - Add ability to call global with savedArgs - Add ability to reuse savedArgs - Add ability to continue an async test - Add ability for test fixture's SetUp to defer RunTest until conditions are right and call function. - Add tests for generated async test - Add one print preview test to expect a global function to be called. - Defer TearDown to testDone so async tests aren't torn down until they're complete. - Try the SetUp call so errors are shown. R=mmenke@chromium.org,dtseng@chromium.org,arv@chromium.org BUG=91737 TEST=browser_tests --gtest_filter=PrintPreviewWebUITest.TestPrinterChangeUpdatesPreview Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=98341

Patch Set 1 #

Patch Set 2 : Added ability to mock globals. #

Patch Set 3 : Use savedArgs and ditch @this comment. #

Patch Set 4 : Added runAllActions and runAllActionsAsync, which allow calling global, then running more tests. #

Patch Set 5 : Added ability to make async tests from generated code (isAsync member). #

Patch Set 6 : More test examples. #

Patch Set 7 : Comments. #

Patch Set 8 : Repair chained constructor for CallGlobalAction. #

Patch Set 9 : Add out-of-line constructor/desctructor for clang. #

Patch Set 10 : Added ability to defer RunTest. #

Total comments: 46

Patch Set 11 : Addressed Matt & Arv's comments. #

Patch Set 12 : Ditch assertions-inl.h now that its functionality is provided in web_ui_browsertest.* #

Patch Set 13 : Create an enum to describe when testDone should be called. #

Total comments: 16

Patch Set 14 : Test runAllActionsAsync with various combinations of arguments. #

Total comments: 9

Patch Set 15 : Allow global mocking after DOMContentLoaded. #

Patch Set 16 : Added print preview-like test to defer TestRun until a global function is called. #

Patch Set 17 : Made testDone get called as long as its not NEVER. #

Patch Set 18 : Rebase. #

Patch Set 19 : Share the code for registering global overrides in function overrideGlobals(). #

Patch Set 20 : Pass list instead of flattening args to be more similar to C++ mocks. #

Patch Set 21 : Minor comment fix. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1134 lines, -296 lines) Patch
M chrome/browser/ui/webui/javascript2webui.js View 1 2 3 4 2 chunks +4 lines, -2 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 2 chunks +10 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 6 chunks +35 lines, -33 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +2 lines, -1 line 0 comments Download
M chrome/test/data/webui/assertions.js View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -9 lines 0 comments Download
D chrome/test/data/webui/assertions-inl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -56 lines 0 comments Download
A chrome/test/data/webui/async_gen.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +319 lines, -0 lines 0 comments Download
A chrome/test/data/webui/async_gen-inl.h View 1 2 3 4 5 6 7 8 10 11 12 13 1 chunk +53 lines, -0 lines 0 comments Download
M chrome/test/data/webui/options.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +7 lines, -7 lines 0 comments Download
M chrome/test/data/webui/print_preview.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 11 chunks +52 lines, -28 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 36 chunks +651 lines, -157 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Sheridan Rawlins
This CL should pave the way for print preview async testing of things such as ...
9 years, 4 months ago (2011-08-13 07:56:33 UTC) #1
Sheridan Rawlins
I've extended the CL to tackle some of Matt's async use cases, and adjusted the ...
9 years, 4 months ago (2011-08-19 14:51:21 UTC) #2
mmenke
I think your code is basically fine, but a lot of the test_api.js function comments ...
9 years, 4 months ago (2011-08-22 16:26:44 UTC) #3
arv (Not doing code reviews)
http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/async_gen.js File chrome/test/data/webui/async_gen.js (right): http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/async_gen.js#newcode22 chrome/test/data/webui/async_gen.js:22: TearDown: function() { this should have been tearDown. Only ...
9 years, 4 months ago (2011-08-22 20:57:18 UTC) #4
Sheridan Rawlins
http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/async_gen.js File chrome/test/data/webui/async_gen.js (right): http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/async_gen.js#newcode22 chrome/test/data/webui/async_gen.js:22: TearDown: function() { On 2011/08/22 20:57:18, arv wrote: > ...
9 years, 4 months ago (2011-08-23 01:06:15 UTC) #5
mmenke
http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/test_api.js#newcode1119 chrome/test/data/webui/test_api.js:1119: testDone(); On 2011/08/23 01:06:15, Sheridan Rawlins wrote: > I ...
9 years, 4 months ago (2011-08-23 01:36:09 UTC) #6
Sheridan Rawlins
http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/test_api.js#newcode1119 chrome/test/data/webui/test_api.js:1119: testDone(); Ok. I added a whenTestDone enum to describe ...
9 years, 4 months ago (2011-08-23 05:52:18 UTC) #7
mmenke
http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/test_api.js File chrome/test/data/webui/test_api.js (right): http://codereview.chromium.org/7645007/diff/10011/chrome/test/data/webui/test_api.js#newcode1119 chrome/test/data/webui/test_api.js:1119: testDone(); On 2011/08/23 05:52:18, Sheridan Rawlins wrote: > Ok. ...
9 years, 4 months ago (2011-08-23 15:26:28 UTC) #8
Sheridan Rawlins
http://codereview.chromium.org/7645007/diff/17002/chrome/test/data/webui/async_gen.js File chrome/test/data/webui/async_gen.js (right): http://codereview.chromium.org/7645007/diff/17002/chrome/test/data/webui/async_gen.js#newcode56 chrome/test/data/webui/async_gen.js:56: GEN(' ~AsyncWebUIMessageHandler() {}'); Sadly, clang bots hork it up ...
9 years, 4 months ago (2011-08-24 02:33:53 UTC) #9
mmenke
LGTM, with the two "Important" comments addressed. http://codereview.chromium.org/7645007/diff/17002/chrome/test/data/webui/async_gen.js File chrome/test/data/webui/async_gen.js (right): http://codereview.chromium.org/7645007/diff/17002/chrome/test/data/webui/async_gen.js#newcode56 chrome/test/data/webui/async_gen.js:56: GEN(' ~AsyncWebUIMessageHandler() ...
9 years, 4 months ago (2011-08-24 15:27:50 UTC) #10
Sheridan Rawlins
Thanks so much for your review! It's really been great to think these cases through. ...
9 years, 4 months ago (2011-08-24 21:15:45 UTC) #11
mmenke
And still LGTM, though I suggest you have the two locations were you overwrite global ...
9 years, 4 months ago (2011-08-24 21:33:30 UTC) #12
Sheridan Rawlins
Done. On 2011/08/24 21:33:30, Matt Menke wrote: > And still LGTM, though I suggest you ...
9 years, 4 months ago (2011-08-25 00:42:59 UTC) #13
arv (Not doing code reviews)
9 years, 4 months ago (2011-08-25 22:54:20 UTC) #14
LGTM

Powered by Google App Engine
This is Rietveld 408576698