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

Issue 8418015: Allow javascript unit tests using webui test_api framework. (Closed)

Created:
9 years, 1 month ago by Sheridan Rawlins
Modified:
9 years, 1 month ago
CC:
chromium-reviews, Paweł Hajdan Jr., garykac, Rick Byers, David Tseng, Mark Mentovai
Visibility:
Public.

Description

Allow javascript unit tests using webui test_api framework. I moved javascript2webui.js over to chrome/test/base/js2gtest.js and shared it across webui and unit tests with an extra parameter for test type, which governs the few differences, such as what to include/subclass from and the flavor of gtest (TEST_F v. IN_PROC_BROWSER_TEST_F). v8_unit_test implemented 2 main methods to make it work with the generated C++ - AddLibrary - loads the file in the test context - RunJavascriptF - launches the runTest with the testFixture and testName, coordinating with Error and ChromeSend to report results. Helper functions: - Error - watches for console.error, noting failure if seen. - ChromeSend - pulls apart the result from the test_api's call to chrome.send('testResult', [ok, msg]) R=arv@chromium.org BUG=87820 TEST=unit_tests --gtest_filter=FrameworkUnitTest.* Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=108391 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=108773

Patch Set 1 #

Patch Set 2 : Fix windows file path to ascii conversion. #

Patch Set 3 : AppendASCII #

Patch Set 4 : Refactored to share the same generator js2gtest.js #

Patch Set 5 : Cleanups and a few more tests. #

Patch Set 6 : Also check for successful runTest. #

Patch Set 7 : Don't double log errors (console.error). #

Total comments: 2

Patch Set 8 : Removed unnecessary parens. #

Total comments: 19

Patch Set 9 : Addressed James' review comments. #

Patch Set 10 : Rebase. #

Total comments: 2

Patch Set 11 : Use MaybeAsASCII() to get file path as recommended by mark@. #

Total comments: 4

Patch Set 12 : Address wrapping and commenting nits. #

Patch Set 13 : Added missing dependency on v8_shell. #

Total comments: 2

Patch Set 14 : Allow chrome.send to pass 1 arg, but check for "testResult". #

Unified diffs Side-by-side diffs Delta from patch set Stats (+340 lines, -116 lines) Patch
D chrome/browser/ui/webui/javascript2webui.js View 1 2 3 1 chunk +0 lines, -68 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +44 lines, -9 lines 0 comments Download
A + chrome/test/base/js2gtest.js View 1 2 3 4 5 6 7 4 chunks +19 lines, -6 lines 0 comments Download
M chrome/test/base/v8_unit_test.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +44 lines, -12 lines 0 comments Download
M chrome/test/base/v8_unit_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +185 lines, -15 lines 0 comments Download
A chrome/test/data/unit/framework_unittest.js View 1 2 3 4 1 chunk +42 lines, -0 lines 0 comments Download
M tools/gypv8sh.py View 1 2 3 1 chunk +6 lines, -6 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
Sheridan Rawlins
All righty - I think this is ready for review. I moved javascript2webui.js over to ...
9 years, 1 month ago (2011-10-28 21:50:18 UTC) #1
Sheridan Rawlins
Adjusted the title to not have WIP and check one more boolean for the test ...
9 years, 1 month ago (2011-10-28 21:56:18 UTC) #2
arv (Not doing code reviews)
I would feel more comfortable if someone else could review the C++ part of this. ...
9 years, 1 month ago (2011-10-28 23:16:55 UTC) #3
Sheridan Rawlins
James, could you review the C++ changes? http://codereview.chromium.org/8418015/diff/1007/chrome/test/base/js2gtest.js File chrome/test/base/js2gtest.js (right): http://codereview.chromium.org/8418015/diff/1007/chrome/test/base/js2gtest.js#newcode47 chrome/test/base/js2gtest.js:47: var isAsyncParam ...
9 years, 1 month ago (2011-10-28 23:50:07 UTC) #4
James Hawkins
http://codereview.chromium.org/8418015/diff/16/chrome/test/base/v8_unit_test.cc File chrome/test/base/v8_unit_test.cc (right): http://codereview.chromium.org/8418015/diff/16/chrome/test/base/v8_unit_test.cc#newcode21 chrome/test/base/v8_unit_test.cc:21: namespace { Inconsistent: No blank line between namespace and ...
9 years, 1 month ago (2011-10-29 22:15:48 UTC) #5
Sheridan Rawlins
http://codereview.chromium.org/8418015/diff/16/chrome/test/base/v8_unit_test.cc File chrome/test/base/v8_unit_test.cc (right): http://codereview.chromium.org/8418015/diff/16/chrome/test/base/v8_unit_test.cc#newcode21 chrome/test/base/v8_unit_test.cc:21: namespace { On 2011/10/29 22:15:48, James Hawkins wrote: > ...
9 years, 1 month ago (2011-10-30 17:04:20 UTC) #6
Sheridan Rawlins
Back to green after rebase (forcing trybot revision to 108019 to pick up the fix ...
9 years, 1 month ago (2011-11-01 21:48:45 UTC) #7
Paweł Hajdan Jr.
http://codereview.chromium.org/8418015/diff/12001/chrome/test/base/v8_unit_test.cc File chrome/test/base/v8_unit_test.cc (right): http://codereview.chromium.org/8418015/diff/12001/chrome/test/base/v8_unit_test.cc#newcode16 chrome/test/base/v8_unit_test.cc:16: #define FILE_PATH_TO_ASCII(FP) WideToASCII((FP).value()) I'm not sure if that's an ...
9 years, 1 month ago (2011-11-02 08:27:40 UTC) #8
Sheridan Rawlins
http://codereview.chromium.org/8418015/diff/12001/chrome/test/base/v8_unit_test.cc File chrome/test/base/v8_unit_test.cc (right): http://codereview.chromium.org/8418015/diff/12001/chrome/test/base/v8_unit_test.cc#newcode16 chrome/test/base/v8_unit_test.cc:16: #define FILE_PATH_TO_ASCII(FP) WideToASCII((FP).value()) Mark recommended using MaybeAsASCII() in gchat ...
9 years, 1 month ago (2011-11-02 18:35:51 UTC) #9
James Hawkins
LGTM with nits. http://codereview.chromium.org/8418015/diff/18001/chrome/test/base/v8_unit_test.h File chrome/test/base/v8_unit_test.h (right): http://codereview.chromium.org/8418015/diff/18001/chrome/test/base/v8_unit_test.h#newcode31 chrome/test/base/v8_unit_test.h:31: // Add a custom helper JS ...
9 years, 1 month ago (2011-11-02 22:53:37 UTC) #10
Sheridan Rawlins
http://codereview.chromium.org/8418015/diff/18001/chrome/test/base/v8_unit_test.h File chrome/test/base/v8_unit_test.h (right): http://codereview.chromium.org/8418015/diff/18001/chrome/test/base/v8_unit_test.h#newcode31 chrome/test/base/v8_unit_test.h:31: // Add a custom helper JS library for your ...
9 years, 1 month ago (2011-11-02 23:16:19 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/scr@chromium.org/8418015/10002
9 years, 1 month ago (2011-11-02 23:17:07 UTC) #12
commit-bot: I haz the power
Change committed as 108391
9 years, 1 month ago (2011-11-03 01:25:32 UTC) #13
Ryan Sleevi
Mac fixes LGTM. May want to run with a -c on the try-runs for -clobber, ...
9 years, 1 month ago (2011-11-03 03:42:07 UTC) #14
Sheridan Rawlins
FYI I did a try with -c -t unit_tests and it passed. On 2011/11/03 03:42:07, ...
9 years, 1 month ago (2011-11-03 15:55:01 UTC) #15
arv (Not doing code reviews)
This looks great in general. I found one bug and a learned a lot about ...
9 years, 1 month ago (2011-11-03 17:30:03 UTC) #16
Sheridan Rawlins
I'm not sure I'd say it's a bug, but thanks for pointing it out - ...
9 years, 1 month ago (2011-11-03 19:18:14 UTC) #17
Sheridan Rawlins
Just a little more context/clarification of this patch's purpose and why I didn't consider it ...
9 years, 1 month ago (2011-11-05 01:04:44 UTC) #18
arv1
LGTM Thanks for the clarification. It wasn't clear to me that the only calls to ...
9 years, 1 month ago (2011-11-05 01:11:48 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/scr@chromium.org/8418015/26001
9 years, 1 month ago (2011-11-05 02:58:44 UTC) #20
commit-bot: I haz the power
9 years, 1 month ago (2011-11-05 04:24:22 UTC) #21
Change committed as 108773

Powered by Google App Engine
This is Rietveld 408576698