diff options
author | scr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 00:17:36 +0000 |
---|---|---|
committer | scr@chromium.org <scr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-12 00:17:36 +0000 |
commit | bf8feaad4973013b788d5cd0a57ae976edc22468 (patch) | |
tree | 00ccf8b625486b3bf05c447f16bf4171c57ae673 /tools/gypv8sh.py | |
parent | 839f4172be712f8ba62cdcb29cc3301ee2c7f3f9 (diff) | |
download | chromium_src-bf8feaad4973013b788d5cd0a57ae976edc22468.zip chromium_src-bf8feaad4973013b788d5cd0a57ae976edc22468.tar.gz chromium_src-bf8feaad4973013b788d5cd0a57ae976edc22468.tar.bz2 |
Added options browser_tests using the generator and js handler framework.
This patch turned out to be fairly large. Let me describe the ultimate goal:
- To write WebUI tests in javascript, with as little C++ as possible for the simple case, yet powerful enough to support more complicated cases. options.js illustrates the simple case, and print_preview.js illustrates the complicated case.
Original changes:
- Refactored test_tab_strip_observer into test_navigation_observer so that it could be used by itself without needing the TabInsertedAt logic, which PrintPreview needs when there's no TabContentsWrapper available.
- Added assertEqualsArray for comparing two arrays shallowly (javascript == fails).
- Provided logic in WebUIBrowserTest and in the javascript2webui.js generation script to allow browsing to a url with preload of injected javascript.
- Corrected test_navigation_observer to wait for the right notification before calling callback (which runs after the page's javascript is loaded but before its onload).
- Added guts to define OS_* ifdefs for javascript to test for disabling tests.
- Moved the handler from settings_browsertest.cc to settings.js
- use __proto__ when overriding chrome to allow other members to be seen (commandLineString, e.g.)
Additions made during review:
- Switched to generative mechanism: TEST_F, GEN, which output during generation, and register during runtime.
- JS fixtures provide configuration members
- Add configuration hooks to generate in C++ test function
- Output directly to .cc file rather than needing hand-made .cc file which includes the generated file.
- Changed preload to take testFixture and testName.
- include and use mock4js to ensure handler methods are called.
- auto-generate the typedef WebUIBrowserTest testFixture unless overridden.
R=jhawkins@chromium.org,dtseng@chromium.org
BUG=None
TEST=browser_tests --gtest_filter=SettingsWebUITest.*
Review URL: http://codereview.chromium.org/7237030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/gypv8sh.py')
-rw-r--r-- | tools/gypv8sh.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tools/gypv8sh.py b/tools/gypv8sh.py index ed47649..edb1402 100644 --- a/tools/gypv8sh.py +++ b/tools/gypv8sh.py @@ -7,7 +7,8 @@ argument lists and to generate inlinable tests. Usage: - python tools/gypv8sh.py v8_shell js2webui.js inputfile outputfile + python tools/gypv8sh.py v8_shell mock.js test_api.js js2webui.js \ + inputfile outputfile """ try: @@ -21,17 +22,19 @@ import sys def main (): parser = optparse.OptionParser() - parser.set_usage("%prog v8_shell js2webui.js inputfile outputfile") + parser.set_usage( + "%prog v8_shell mock.js test_api.js js2webui.js inputfile outputfile") parser.add_option('-v', '--verbose', action='store_true') parser.add_option('-n', '--impotent', action='store_true', help="don't execute; just print (as if verbose)") (opts, args) = parser.parse_args() - if len(args) != 4: + if len(args) != 6: parser.error('all arguments are required.') - v8_shell, js2webui, inputfile, outputfile = args + v8_shell, mock_js, test_api, js2webui, inputfile, outputfile = args arguments = [js2webui, inputfile, os.path.basename(inputfile), outputfile] - cmd = [v8_shell, '-e', "arguments=" + json.dumps(arguments), js2webui] + cmd = [v8_shell, '-e', "arguments=" + json.dumps(arguments), mock_js, + test_api, js2webui] if opts.verbose or opts.impotent: print cmd if not opts.impotent: |