WebUI: cr_elements: Add missing tests |
|||||
Issue descriptionSome of the elements in ui/webui/resources/cr_elements are sparsely tested or untested. We should audit and implement missing tests. In particular, the following have no tests at all: cr_dialog cr_expand_button cr_search_field cr_toolbar cr_network_* cr_policy_network_indicator cr_policy_pref_indicator
,
Jan 19 2017
Would it be reasonable to always hide your usage of private extension APIs behind a "browser proxy"? Then you could create a TestBrowserProxy for your test and never have to load the real thing (there are already plenty examples of this, except that they wrap chrome.send calls, not extension API calls).
,
Jan 19 2017
BTW here is an example of a browser proxy wrapping calls to private extension APIs, https://cs.chromium.org/chromium/src/chrome/browser/resources/settings/appearance_page/appearance_browser_proxy.js?l=45.
,
Jan 21 2017
conversely, we could probably make a specific C++ test fixture that enables the extension APIs for these tests.
,
Jan 21 2017
,
Feb 16 2017
,
Feb 17 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8 commit 5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8 Author: stevenjb <stevenjb@chromium.org> Date: Fri Feb 17 06:34:18 2017 WebUI: Add cr-policy-pref-indicator tests This adds some tests for cr-policy-pref-indicator. It also fixes a potential issue if a pref property changes but not the entire pref. BUG= 679561 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2624003003 Cr-Commit-Position: refs/heads/master@{#451248} [modify] https://crrev.com/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8/chrome/test/data/webui/cr_elements/cr_elements_browsertest.js [add] https://crrev.com/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8/chrome/test/data/webui/cr_elements/cr_policy_pref_indicator_tests.js [modify] https://crrev.com/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8/ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.js [modify] https://crrev.com/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8/ui/webui/resources/cr_elements/policy/cr_policy_pref_behavior.js [modify] https://crrev.com/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8/ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.html [modify] https://crrev.com/5f4f1ed5c5e0c32bda1b5da16f4f4dab37e276b8/ui/webui/resources/cr_elements/policy/cr_policy_pref_indicator.js
,
Mar 7 2017
FYI, https://codereview.chromium.org/2700063002 added some tests for cr-dialog.
,
Mar 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/0c3256d22e6966598c8d5cd101cd7e827b0f42b9 commit 0c3256d22e6966598c8d5cd101cd7e827b0f42b9 Author: stevenjb <stevenjb@chromium.org> Date: Thu Mar 09 19:37:43 2017 WebUI: Add cr_policy_network_indicator_tests.js This also makes indicatorType private for cr-policy-network-indicator and switches existing usage to cr-policy-pref-indicator (which now correctly supports indicator-type). BUG= 679561 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2625213002 Cr-Commit-Position: refs/heads/master@{#455830} [modify] https://crrev.com/0c3256d22e6966598c8d5cd101cd7e827b0f42b9/chrome/browser/resources/settings/internet_page/internet_detail_page.html [modify] https://crrev.com/0c3256d22e6966598c8d5cd101cd7e827b0f42b9/chrome/test/data/webui/cr_elements/cr_elements_browsertest.js [add] https://crrev.com/0c3256d22e6966598c8d5cd101cd7e827b0f42b9/chrome/test/data/webui/cr_elements/cr_policy_network_indicator_tests.js [modify] https://crrev.com/0c3256d22e6966598c8d5cd101cd7e827b0f42b9/ui/webui/resources/cr_elements/network/cr_network_list_item.html [modify] https://crrev.com/0c3256d22e6966598c8d5cd101cd7e827b0f42b9/ui/webui/resources/cr_elements/policy/cr_policy_network_indicator.js
,
Mar 9 2017
Added tests for: cr_dialog cr_policy_network_indicator cr_policy_pref_indicator Tests also do exist for cr_search_field_behavior / cr_toolbar in cr_toolbar_search_field_tests.js. cr_expand_button is a fairly trivial wrapper around paper-icon-button and should probably be replaced with some CSS eventually. Created issue 700121 to track testing for internet_page and cr_network_* tests.
,
Apr 5 2017
closing it for now. please reopen if tests are not working as excepted. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by steve...@chromium.org
, Jan 19 2017I sent an email to the settings and extensions teams, but for anyone else paying attention to this issue (and for future reference), work on this for policy/* and network/* is currently blocked on the following problem: Some of our elements have extension API dependencies, specifically ones in policy/ (chrome.settingsPrivate) and network/ (chrome.networkingPrivate). In cr_elements_browsertest.js we set, e.g., browsePreload: 'chrome://resources/cr_elements/policy/cr_policy_pref_indicator.html'. This does not (as near as I can tell) cause chrome to load any extension APIs. We can kind of work around this by adding, e.g. settings_private.js as an extra library: extraLibraries: CrElementsBrowserTest.prototype.extraLibraries.concat([ '../../../../../third_party/closure_compiler/externs/settings_private.js', 'cr_policy_pref_indicator_tests.js', ]), However this winds up executing externs, which we don't want to do. Does anyone have any thoughts on how to load e.g. settingsPrivate and networkingPrivate for chrome://resources/cr_elements/* (or perhaps for specific subdirs or files)? Or even loading all extension apis (slower presumably, but it's already a browser test). The only alternative I can think of would be to modify the externs generator to generate a fake implementation with types just for tests, which would be kind of a heavyweight solution (but might simplify some of our existing fakes).