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

Issue 7087014: Support automatic javascript test registry in gtest when creating WebUI tests. (Closed)

Created:
9 years, 7 months ago by Sheridan Rawlins
Modified:
9 years, 5 months ago
CC:
chromium-reviews, brettw-cc_chromium.org, arv (Not doing code reviews), Lei Zhang, Evan Stade, cevans, akalin
Visibility:
Public.

Description

Support automatic javascript test registry in gtest when creating WebUI tests. The goal was to support something as simple as the following, where the tests in the javascript files would be 1st class GTESTs, supporting FLAKY_, DISABLED_, etc, and registered at linker_initialization time. WEB_UI_BROWSER_TEST_JS(WebUIBrowserTest, TestJSPass, FILE_PATH_LITERAL("sample_passing.js")) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); } This solution ended up being fairly fragile, and I ended up with a script to parse javascript (with the help of v8_shell) and generate an includable ...-inl.h file with the following for every test in the .js file specified in the |rules| section of tools/js2webui.py IN_PROC_BROWSER_TEST_F(WebUIBrowserTestPass, testHelper) { AddLibrary(FilePath(FILE_PATH_LITERAL("sample_pass.js"))); ASSERT_TRUE(RunJavascriptTest("testHelper")); } http://www.chromium.org/Home/domui-testing BUG=82437 R=estade@chromium.org,jhawkins@chromium.org TEST=browser_tests --gtest_filter=WebUIBrowserTest* Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=89453 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=89605 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=89626 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=91358

Patch Set 1 #

Total comments: 4

Patch Set 2 : Fix kSimpleProviderPath type (use FILE_PATH_LITERAL). #

Patch Set 3 : Added example of helper functions which aren't included as tests. #

Total comments: 11

Patch Set 4 : Simplify inlined js using v8 to reflect on properties. #

Patch Set 5 : Defer Javascript parsing until runtime for non-linux platforms. #

Patch Set 6 : Remove initialization code previously required to parse javascript at linker-initialization. #

Patch Set 7 : Removed unused includes. #

Patch Set 8 : Remove unused bool |linker_initialized|. #

Patch Set 9 : Added extra mac initialization for pool, bundling and path. #

Patch Set 10 : Reset the cached state of AmIBundled. #

Patch Set 11 : Comments. #

Patch Set 12 : Trying with relative path for mac. #

Patch Set 13 : Walk up to find the src dir without needing PathService. #

Patch Set 14 : Adjusted comments and PathService replacement. #

Total comments: 2

Patch Set 15 : Try with code-generating the existing macros. #

Patch Set 16 : undid sorting of .gitignore #

Total comments: 9

Patch Set 17 : python cleanup and no failing tests. #

Patch Set 18 : fixing FAILS_ test. #

Total comments: 4

Patch Set 19 : Python review. #

Patch Set 20 : Added help text to optparse rules. #

Patch Set 21 : Updated comments about indices, and fixed set_add to take separate args; not array. #

Total comments: 8

Patch Set 22 : Made -p PRODUCT_DIR mandatory. #

Total comments: 2

Patch Set 23 : Added comment to WebUIBrowserTestPass and use optparse.exit instead of exit. #

Total comments: 6

Patch Set 24 : Create dummy WebUI Page to be clear about what we're navigating to, & other nits. #

Patch Set 25 : Rebase. #

Total comments: 2

Patch Set 26 : Address Pawel's comments for LG. #

Total comments: 28

Patch Set 27 : Use simplejson when needed to build on systems with python2.5, chmod -x #

Patch Set 28 : Addressed Maruel's comments. #

Patch Set 29 : Remove need for secondary javascript script by parsing the ast in python. #

Total comments: 6

Patch Set 30 : Depend on v8_shell#host & use the javascript script instead of experimental v8_shell switches. #

Patch Set 31 : Use rules instead of actions to output into gen dir and include_dir. #

Patch Set 32 : Don't depend on v8_shell#host when the target_arch is arm. #

Total comments: 2

Patch Set 33 : Move the include of the generated dir to the condition for ! 'arm'. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+155 lines, -9 lines) Patch
M chrome/browser/ui/webui/javascript2webui.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +9 lines, -5 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 20 21 22 23 24 25 26 27 28 29 30 31 3 chunks +49 lines, -3 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 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 3 chunks +30 lines, -0 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 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +2 lines, -1 line 0 comments Download
A chrome/test/data/webui/sample_pass.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +19 lines, -0 lines 0 comments Download
A tools/gypv8sh.py View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +46 lines, -0 lines 0 comments Download

Messages

Total messages: 37 (0 generated)
Sheridan Rawlins
Please review this framework patch, which should make writing domui tests much easier. Sample run ...
9 years, 7 months ago (2011-05-28 01:40:29 UTC) #1
Paweł Hajdan Jr.
Drive-by with a testing comment (chrome/test/OWNERS). Please let me do another review before this gets ...
9 years, 7 months ago (2011-05-28 08:03:55 UTC) #2
Sheridan Rawlins
http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h File chrome/browser/ui/webui/web_ui_browsertest.h (right): http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h#newcode26 chrome/browser/ui/webui/web_ui_browsertest.h:26: #define WEB_UI_BROWSER_TEST_JS_(test_case_name, test_name, parent_class, \ Thanks for the drive ...
9 years, 7 months ago (2011-05-28 14:26:30 UTC) #3
Paweł Hajdan Jr.
http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h File chrome/browser/ui/webui/web_ui_browsertest.h (right): http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h#newcode26 chrome/browser/ui/webui/web_ui_browsertest.h:26: #define WEB_UI_BROWSER_TEST_JS_(test_case_name, test_name, parent_class, \ On 2011/05/28 14:26:30, Sheridan ...
9 years, 6 months ago (2011-05-30 17:17:58 UTC) #4
David Tseng
Awesome! Thanks so much for doing this. A few comments. http://codereview.chromium.org/7087014/diff/5001/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7087014/diff/5001/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode83 ...
9 years, 6 months ago (2011-05-30 20:44:49 UTC) #5
Sheridan Rawlins
http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h File chrome/browser/ui/webui/web_ui_browsertest.h (right): http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h#newcode26 chrome/browser/ui/webui/web_ui_browsertest.h:26: #define WEB_UI_BROWSER_TEST_JS_(test_case_name, test_name, parent_class, \ Short answer: This macro ...
9 years, 6 months ago (2011-05-31 23:15:00 UTC) #6
David Tseng
LGTM wrt my comments. On 5/31/11, scr@chromium.org <scr@chromium.org> wrote: > > http://codereview.chromium.org/7087014/diff/1/chrome/browser/ui/webui/web_ui_browsertest.h > File chrome/browser/ui/webui/web_ui_browsertest.h ...
9 years, 6 months ago (2011-06-01 00:11:23 UTC) #7
Sheridan Rawlins
Got the green trybots now for Mac & Windows. Changes from original design: - Because ...
9 years, 6 months ago (2011-06-08 14:24:45 UTC) #8
Paweł Hajdan Jr.
http://codereview.chromium.org/7087014/diff/31001/chrome/browser/ui/webui/web_ui_browsertest.h File chrome/browser/ui/webui/web_ui_browsertest.h (right): http://codereview.chromium.org/7087014/diff/31001/chrome/browser/ui/webui/web_ui_browsertest.h#newcode26 chrome/browser/ui/webui/web_ui_browsertest.h:26: #define WEB_UI_BROWSER_TEST_JS_(test_case_name, test_name, parent_class, \ Sorry, this is still ...
9 years, 6 months ago (2011-06-08 14:48:43 UTC) #9
Sheridan Rawlins
Ok, how's this? http://codereview.chromium.org/7087014/diff/31001/chrome/browser/ui/webui/web_ui_browsertest.h File chrome/browser/ui/webui/web_ui_browsertest.h (right): http://codereview.chromium.org/7087014/diff/31001/chrome/browser/ui/webui/web_ui_browsertest.h#newcode26 chrome/browser/ui/webui/web_ui_browsertest.h:26: #define WEB_UI_BROWSER_TEST_JS_(test_case_name, test_name, parent_class, \ How ...
9 years, 6 months ago (2011-06-10 06:16:43 UTC) #10
Paweł Hajdan Jr.
Mostly minor comments, the approach looks fine. http://codereview.chromium.org/7087014/diff/33001/chrome/browser/ui/webui/javascript2webui.js File chrome/browser/ui/webui/javascript2webui.js (right): http://codereview.chromium.org/7087014/diff/33001/chrome/browser/ui/webui/javascript2webui.js#newcode1 chrome/browser/ui/webui/javascript2webui.js:1: #!tools/v8sh.py I'm ...
9 years, 6 months ago (2011-06-10 07:38:29 UTC) #11
Sheridan Rawlins
Nicholas, would you be able to review the python script gypv8sh.py? It needs to populate ...
9 years, 6 months ago (2011-06-11 18:07:19 UTC) #12
nsylvain
Looked only at the .py file. If possible, you should use optparse for the arguments. ...
9 years, 6 months ago (2011-06-12 21:13:18 UTC) #13
Sheridan Rawlins
Also updated to use optparse. http://codereview.chromium.org/7087014/diff/28010/tools/gypv8sh.py File tools/gypv8sh.py (right): http://codereview.chromium.org/7087014/diff/28010/tools/gypv8sh.py#newcode18 tools/gypv8sh.py:18: import getopt On 2011/06/12 ...
9 years, 6 months ago (2011-06-13 15:40:44 UTC) #14
Paweł Hajdan Jr.
http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode209 chrome/browser/ui/webui/web_ui_browsertest.cc:209: virtual void SetUpOnMainThread() { Shouldn't you call parent's SetUpOnMainThread ...
9 years, 6 months ago (2011-06-13 19:38:40 UTC) #15
Sheridan Rawlins
http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode209 chrome/browser/ui/webui/web_ui_browsertest.cc:209: virtual void SetUpOnMainThread() { This is not a test. ...
9 years, 6 months ago (2011-06-13 22:18:53 UTC) #16
nsylvain
python lgtm
9 years, 6 months ago (2011-06-14 16:55:26 UTC) #17
Paweł Hajdan Jr.
http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode209 chrome/browser/ui/webui/web_ui_browsertest.cc:209: virtual void SetUpOnMainThread() { On 2011/06/13 22:18:54, Sheridan Rawlins ...
9 years, 6 months ago (2011-06-14 20:23:17 UTC) #18
Sheridan Rawlins
I added a comment for you, which should explain that WebUIBrowserTest doesn't provide SetUpOnMainThread and ...
9 years, 6 months ago (2011-06-14 22:39:26 UTC) #19
Paweł Hajdan Jr.
http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc File chrome/browser/ui/webui/web_ui_browsertest.cc (right): http://codereview.chromium.org/7087014/diff/33004/chrome/browser/ui/webui/web_ui_browsertest.cc#newcode209 chrome/browser/ui/webui/web_ui_browsertest.cc:209: virtual void SetUpOnMainThread() { On 2011/06/14 22:39:26, Sheridan Rawlins ...
9 years, 6 months ago (2011-06-15 08:12:31 UTC) #20
Sheridan Rawlins
Addressed 2 out of 3 of your concerns & expressed my stance on the third. ...
9 years, 6 months ago (2011-06-15 23:54:32 UTC) #21
Paweł Hajdan Jr.
LGTM with comments. http://codereview.chromium.org/7087014/diff/41001/tools/gypv8sh.py File tools/gypv8sh.py (right): http://codereview.chromium.org/7087014/diff/41001/tools/gypv8sh.py#newcode63 tools/gypv8sh.py:63: parser.exit(status=-1); On 2011/06/15 23:54:32, Sheridan Rawlins ...
9 years, 6 months ago (2011-06-16 17:50:10 UTC) #22
Sheridan Rawlins
Trying trybots, then I'll commit. http://codereview.chromium.org/7087014/diff/41001/tools/gypv8sh.py File tools/gypv8sh.py (right): http://codereview.chromium.org/7087014/diff/41001/tools/gypv8sh.py#newcode63 tools/gypv8sh.py:63: parser.exit(status=-1); As it turns ...
9 years, 6 months ago (2011-06-17 00:44:55 UTC) #23
commit-bot: I haz the power
Change committed as 89453
9 years, 6 months ago (2011-06-17 08:00:07 UTC) #24
joth
On 2011/06/17 08:00:07, I haz the power (commit-bot) wrote: > Change committed as 89453 Looks ...
9 years, 6 months ago (2011-06-17 08:13:34 UTC) #25
Timur Iskhodzhanov
Looks like this has broken the build on Mac. Mind reverting?
9 years, 6 months ago (2011-06-17 08:30:14 UTC) #26
joth
I can't contact scr, so I'm just reverting it now. (alas I just fixed the ...
9 years, 6 months ago (2011-06-17 08:33:52 UTC) #27
joth
On 2011/06/17 08:33:52, joth wrote: > I can't contact scr, so I'm just reverting it ...
9 years, 6 months ago (2011-06-17 08:35:11 UTC) #28
joth
FYI looks like this patch was the probable cause of chromeos compile failure (haven't investigated ...
9 years, 6 months ago (2011-06-17 08:47:25 UTC) #29
M-A Ruel
Drive-by http://codereview.chromium.org/7087014/diff/49002/tools/gypv8sh.py File tools/gypv8sh.py (right): http://codereview.chromium.org/7087014/diff/49002/tools/gypv8sh.py#newcode1 tools/gypv8sh.py:1: #!/usr/bin/python #!/usr/bin/env python Don't forget your BSD friends. ...
9 years, 6 months ago (2011-06-17 18:15:36 UTC) #30
Sheridan Rawlins
http://codereview.chromium.org/7087014/diff/49002/tools/gypv8sh.py File tools/gypv8sh.py (right): http://codereview.chromium.org/7087014/diff/49002/tools/gypv8sh.py#newcode1 tools/gypv8sh.py:1: #!/usr/bin/python On 2011/06/17 18:15:36, Marc-Antoine Ruel wrote: > #!/usr/bin/env ...
9 years, 6 months ago (2011-06-18 00:03:11 UTC) #31
M-A Ruel
python lgtm. http://codereview.chromium.org/7087014/diff/59001/tools/js2webui.py File tools/js2webui.py (right): http://codereview.chromium.org/7087014/diff/59001/tools/js2webui.py#newcode35 tools/js2webui.py:35: """Run the program""" Please remove. http://codereview.chromium.org/7087014/diff/59001/tools/js2webui.py#newcode57 tools/js2webui.py:57: ...
9 years, 6 months ago (2011-06-20 16:38:45 UTC) #32
Sheridan Rawlins
Ok, based on comments from v8 team, reverted patchset 29 to use the v8_shell to ...
9 years, 6 months ago (2011-06-22 06:49:22 UTC) #33
Sheridan Rawlins
After a great conversation with gyp guru Brad Nelson, I was able to convert this ...
9 years, 5 months ago (2011-06-29 22:44:42 UTC) #34
cmp
lgtm with ifdef-out-on-arm changes with nit (assuming previous reviews' lgtms carry over) http://codereview.chromium.org/7087014/diff/71001/chrome/chrome_tests.gypi File chrome/chrome_tests.gypi ...
9 years, 5 months ago (2011-07-01 00:33:22 UTC) #35
Sheridan Rawlins
Thanks. Waiting for manual build on Arm from Jeff Bailey, before commit, hopefully before lunch ...
9 years, 5 months ago (2011-07-01 05:24:36 UTC) #36
cmp
9 years, 5 months ago (2011-07-01 17:56:56 UTC) #37
lgtm, thanks for the update

Powered by Google App Engine
This is Rietveld 408576698