Skip to content

Commit

Permalink
[CrOS Settings] Check-in modulized code for a11y/crostini tests
Browse files Browse the repository at this point in the history
We no longer need to generate modulized versions of the JS test files
(`.m.js`) at build time. Instead, we can check-in the modulized version
and then use the test source files directly in
`os_settings_v3_browsertest.js`.

Bug: chromium:1180979
Test: out/Default/browser_tests --gtest_filter='*OSSettings*'
Change-Id: Id25f01a25bfed5dd3efb235d342109d93499fd6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3564626
Reviewed-by: Xiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Wes Okuhara <wesokuhara@google.com>
Cr-Commit-Position: refs/heads/main@{#988573}
  • Loading branch information
Wes Okuhara authored and Chromium LUCI CQ committed Apr 4, 2022
1 parent 19e7a5a commit d5f361d
Show file tree
Hide file tree
Showing 21 changed files with 518 additions and 611 deletions.
17 changes: 0 additions & 17 deletions chrome/test/data/webui/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,6 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/nearby_share/shared/nearby_onboarding_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/nearby_share/shared/nearby_page_template_test.m.js",
"$root_gen_dir/chrome/test/data/webui/nearby_share/shared/nearby_visibility_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/crostini_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/crostini_extra_containers_subpage_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_test_utils.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/cups_printer_landing_page_tests.m.js",
Expand All @@ -287,11 +285,7 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/onc_mojo_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/kerberos_accounts_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/kerberos_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/manage_accessibility_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_about_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_edit_dictionary_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_files_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_languages_page_v2_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/settings_scheduler_slider_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_settings_main_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_settings_ui_test.m.js",
Expand All @@ -306,28 +300,17 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_settings_search_box_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_settings_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/quick_unlock_authenticate_browsertest_chromeos.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/smart_inputs_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/smart_privacy_subpage_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/smb_shares_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/os_a11y_page_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/search_subpage_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/search_engine_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/switch_access_action_assignment_dialog_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/switch_access_setup_guide_dialog_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/switch_access_subpage_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_about_page_browser_proxy_chromeos.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_crostini_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_cups_printers_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_os_languages_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_kerberos_accounts_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_os_languages_metrics_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_os_lifetime_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_os_reset_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_personalization_hub_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/test_wallpaper_browser_proxy.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/tether_connection_dialog_test.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/text_to_speech_subpage_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/settings/chromeos/tts_subpage_test.m.js",
]
}
defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
Expand Down
17 changes: 0 additions & 17 deletions chrome/test/data/webui/settings/chromeos/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ js_library("fake_settings_search_handler") {

js_modulizer("modulize") {
input_files = [
"crostini_page_test.js",
"crostini_extra_containers_subpage_test.js",
"cups_printer_entry_tests.js",
"cups_printer_landing_page_tests.js",
"cups_printer_page_tests.js",
Expand All @@ -47,13 +45,8 @@ js_modulizer("modulize") {
"fingerprint_browsertest_chromeos.js",
"kerberos_accounts_test.js",
"kerberos_page_test.js",
"manage_accessibility_page_tests.js",
"onc_mojo_test.js",
"os_a11y_page_tests.js",
"os_about_page_tests.js",
"os_edit_dictionary_page_test.js",
"os_files_page_test.js",
"os_languages_page_v2_tests.js",
"os_reset_page_test.js",
"os_printing_page_tests.js",
"os_privacy_page_test.js",
Expand All @@ -71,26 +64,16 @@ js_modulizer("modulize") {
"search_engine_test.js",
"settings_scheduler_slider_test.js",
"settings_traffic_counters_test.js",
"smart_inputs_page_test.js",
"smart_privacy_subpage_tests.js",
"smb_shares_page_tests.js",
"switch_access_action_assignment_dialog_test.js",
"switch_access_setup_guide_dialog_test.js",
"switch_access_subpage_tests.js",
"test_about_page_browser_proxy_chromeos.js",
"test_crostini_browser_proxy.js",
"test_cups_printers_browser_proxy.js",
"test_device_name_browser_proxy.js",
"test_kerberos_accounts_browser_proxy.js",
"test_os_languages_browser_proxy.js",
"test_os_languages_metrics_proxy.js",
"test_os_lifetime_browser_proxy.js",
"test_os_reset_browser_proxy.js",
"test_personalization_hub_browser_proxy.js",
"test_wallpaper_browser_proxy.js",
"tether_connection_dialog_test.js",
"text_to_speech_subpage_tests.js",
"tts_subpage_test.js",
]
namespace_rewrites =
os_settings_namespace_rewrites + os_test_namespace_rewrites +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// clang-format off
// #import {TestCrostiniBrowserProxy} from './test_crostini_browser_proxy.m.js';
// #import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
// #import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js';
// #import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {Router, routes} from 'chrome://os-settings/chromeos/os_settings.js';
// #import {flushTasks} from 'chrome://test/test_util.js';
// #import {CrostiniBrowserProxy, CrostiniBrowserProxyImpl} from 'chrome://os-settings/chromeos/lazy_load.js';
// clang-format on
import {TestCrostiniBrowserProxy} from './test_crostini_browser_proxy.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
import {assertEquals, assertFalse, assertTrue} from '../../chai_assert.js';
import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
import {Router, routes} from 'chrome://os-settings/chromeos/os_settings.js';
import {flushTasks} from 'chrome://test/test_util.js';
import {CrostiniBrowserProxyImpl} from 'chrome://os-settings/chromeos/lazy_load.js';

suite('CrostiniExtraContainersSubpageTests', function() {
/** @type {?SettingsCrostiniPageElement} */
Expand All @@ -33,7 +31,7 @@ suite('CrostiniExtraContainersSubpageTests', function() {

setup(async function() {
crostiniBrowserProxy = new TestCrostiniBrowserProxy();
settings.CrostiniBrowserProxyImpl.instance_ = crostiniBrowserProxy;
CrostiniBrowserProxyImpl.instance_ = crostiniBrowserProxy;
crostiniPage = document.createElement('settings-crostini-page');
document.body.appendChild(crostiniPage);
testing.Test.disableAnimationsAndTransitions();
Expand All @@ -42,11 +40,11 @@ suite('CrostiniExtraContainersSubpageTests', function() {
enabled: {value: true},
},
};
Polymer.dom.flush();
settings.Router.getInstance().navigateTo(
settings.routes.CROSTINI_EXTRA_CONTAINERS);
flush();
Router.getInstance().navigateTo(
routes.CROSTINI_EXTRA_CONTAINERS);

await test_util.flushTasks();
await flushTasks();
subpage = crostiniPage.$$('settings-crostini-extra-containers');
assertTrue(!!subpage);

Expand All @@ -64,7 +62,7 @@ suite('CrostiniExtraContainersSubpageTests', function() {
];
subpage.$$('#create').click();

await test_util.flushTasks();
await flushTasks();
subpage = subpage.$$('settings-crostini-create-container-dialog');

containerNameInput = subpage.root.querySelector('#containerNameInput');
Expand All @@ -74,7 +72,7 @@ suite('CrostiniExtraContainersSubpageTests', function() {

teardown(function() {
crostiniPage.remove();
settings.Router.getInstance().resetRouteForTesting();
Router.getInstance().resetRouteForTesting();
});


Expand Down

0 comments on commit d5f361d

Please sign in to comment.