summaryrefslogtreecommitdiffstats
path: root/tools/gypv8sh.py
Commit message (Collapse)AuthorAgeFilesLines
* Allow javascript unit tests using webui test_api framework.scr@chromium.org2011-11-051-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Review URL: http://codereview.chromium.org/8418015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108773 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 108391 - Broke 'compile' on Mac clobber builderrsleevi@chromium.org2011-11-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.* Review URL: http://codereview.chromium.org/8418015 TBR=scr@chromium.org Review URL: http://codereview.chromium.org/8440060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108407 0039d316-1c4b-4281-b951-d872f2087c98
* Allow javascript unit tests using webui test_api framework.scr@chromium.org2011-11-031-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.* Review URL: http://codereview.chromium.org/8418015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108391 0039d316-1c4b-4281-b951-d872f2087c98
* Allow generator javascript test files to go anywhere in the source treescr@chromium.org2011-10-221-7/+12
| | | | | | | | | | | | | | - Allow javascript files anywhere in the source tree - specifically in the same directory as the implementation files. - Copy the files to '<(PRODUCT_DIR)/test_data/...' so that cros can copy these where they need to go for cross-platform testing using 'ebuild' R=jhawkins@chromium.org BUG=90907,89337 TEST=browser_tests --gtest_filter=OptionsWebUITest.* Review URL: http://codereview.chromium.org/8333013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106833 0039d316-1c4b-4281-b951-d872f2087c98
* Added options browser_tests using the generator and js handler framework.scr@chromium.org2011-07-121-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Support automatic javascript test registry in gtest when creating WebUI tests.scr@chromium.org2011-07-011-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Review URL: http://codereview.chromium.org/7087014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91358 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 89605 - Support automatic javascript test registry in gtest when ↵scr@chromium.org2011-06-181-74/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)); } WEB_UI_BROWSER_TEST_JS_FALSE(WebUIBrowserTest, TestJSFail, FILE_PATH_LITERAL("sample_failing.js")) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); } http://www.chromium.org/Home/domui-testing In order to support linker init time, I had to modify path_service to support Unregistration, and chrome_paths to allow multiple invocations. 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 Review URL: http://codereview.chromium.org/7087014 TBR=scr@chromium.org Review URL: http://codereview.chromium.org/7189052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89607 0039d316-1c4b-4281-b951-d872f2087c98
* Support automatic javascript test registry in gtest when creating WebUI tests.scr@chromium.org2011-06-181-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)); } WEB_UI_BROWSER_TEST_JS_FALSE(WebUIBrowserTest, TestJSFail, FILE_PATH_LITERAL("sample_failing.js")) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); } http://www.chromium.org/Home/domui-testing In order to support linker init time, I had to modify path_service to support Unregistration, and chrome_paths to allow multiple invocations. 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 Review URL: http://codereview.chromium.org/7087014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89605 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 89453 - Support automatic javascript test registry in gtest when ↵joth@chromium.org2011-06-171-74/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | creating WebUI tests. - gypv8sh.py is breaking on Mac http://build.chromium.org/p/chromium/builders/Mac10.5%20Tests%20%281%29/builds/8563/steps/update/logs/stdio File "/b/build/slave/Mac10_5_Tests__1_/build/src/tools/gyp/pylib/gyp/input.py", line 1017, in ProcessVariablesAndConditionsInList expanded = ExpandVariables(item, is_late, variables, build_file) File "/b/build/slave/Mac10_5_Tests__1_/build/src/tools/gyp/pylib/gyp/input.py", line 684, in ExpandVariables (contents, p.returncode)) Exception: Call to 'python ../tools/gypv8sh.py -i' returned exit status 1. while loading dependencies of src/chrome/browser/sync/tools/sync_tools.gyp while loading dependencies of src/build/all.gyp while trying to load src/build/all.gyp Error: /System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python src/build/gyp_chromium in /b/build/slave/Mac10_5_Tests__1_/build returned 1 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)); } WEB_UI_BROWSER_TEST_JS_FALSE(WebUIBrowserTest, TestJSFail, FILE_PATH_LITERAL("sample_failing.js")) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); } http://www.chromium.org/Home/domui-testing In order to support linker init time, I had to modify path_service to support Unregistration, and chrome_paths to allow multiple invocations. BUG=82437 R=estade@chromium.org,jhawkins@chromium.org TEST=browser_tests --gtest_filter=WebUIBrowserTest* Review URL: http://codereview.chromium.org/7087014 TBR=scr@chromium.org Review URL: http://codereview.chromium.org/7193030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89460 0039d316-1c4b-4281-b951-d872f2087c98
* Support automatic javascript test registry in gtest when creating WebUI tests.scr@chromium.org2011-06-171-0/+74
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)); } WEB_UI_BROWSER_TEST_JS_FALSE(WebUIBrowserTest, TestJSFail, FILE_PATH_LITERAL("sample_failing.js")) { ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIDownloadsURL)); } http://www.chromium.org/Home/domui-testing In order to support linker init time, I had to modify path_service to support Unregistration, and chrome_paths to allow multiple invocations. BUG=82437 R=estade@chromium.org,jhawkins@chromium.org TEST=browser_tests --gtest_filter=WebUIBrowserTest* Review URL: http://codereview.chromium.org/7087014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89453 0039d316-1c4b-4281-b951-d872f2087c98