Commit 0ddffb0f authored by James Cook's avatar James Cook Committed by Commit Bot

SplitSettings: Port settings main page tests for OS settings page

Ports most of //c/test/data/webui/settings/settings_main_test.js to
the OS settings page.

Initializes CrOncStrings in the test because the test does not load
os_settings_ui.js, but the global must exist for the network page.

Adds assertions for CrOncStrings to make this failure more obvious
in the future (otherwise the error is just "reading property of
undefined" without a useful line number).

Bug: 967910
Test: browser_tests

Change-Id: Ia86483a2c204d82387a6c771a02075f76acc3681
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1642249Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666308}
parent 7cae49dd
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<link rel="import" href="chrome://resources/cr_components/chromeos/network/network_siminfo.html"> <link rel="import" href="chrome://resources/cr_components/chromeos/network/network_siminfo.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html"> <link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html"> <link rel="import" href="chrome://resources/cr_elements/cr_toggle/cr_toggle.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html"> <link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html">
......
...@@ -367,6 +367,7 @@ Polymer({ ...@@ -367,6 +367,7 @@ Polymer({
* @private * @private
*/ */
getTitleText_: function() { getTitleText_: function() {
assert(CrOncStrings);
return this.networkTitleText || return this.networkTitleText ||
CrOncStrings['OncType' + this.activeNetworkState.Type]; CrOncStrings['OncType' + this.activeNetworkState.Type];
}, },
......
...@@ -70,6 +70,29 @@ TEST_F('OSSettingsSmbPageTest', 'MAYBE_All', function() { ...@@ -70,6 +70,29 @@ TEST_F('OSSettingsSmbPageTest', 'MAYBE_All', function() {
mocha.run(); mocha.run();
}); });
// Test fixture for the main settings page.
// eslint-disable-next-line no-var
var OSSettingsMainTest = class extends OSSettingsBrowserTest {
/** @override */
get browsePreload() {
return super.browsePreload +
'chromeos/os_settings_main/os_settings_main.html';
}
/** @override */
get extraLibraries() {
return super.extraLibraries.concat([
BROWSER_SETTINGS_PATH + 'test_util.js',
BROWSER_SETTINGS_PATH + '../test_browser_proxy.js',
'os_settings_main_test.js',
]);
}
};
TEST_F('OSSettingsMainTest', 'MAYBE_All', function() {
mocha.run();
});
// Tests for the side-nav menu. // Tests for the side-nav menu.
// eslint-disable-next-line no-var // eslint-disable-next-line no-var
var OSSettingsMenuTest = class extends OSSettingsBrowserTest { var OSSettingsMenuTest = class extends OSSettingsBrowserTest {
......
...@@ -475,6 +475,7 @@ CrOnc.getNetworkName = function(properties) { ...@@ -475,6 +475,7 @@ CrOnc.getNetworkName = function(properties) {
const name = CrOnc.getStateOrActiveString(properties.Name); const name = CrOnc.getStateOrActiveString(properties.Name);
const type = CrOnc.getStateOrActiveString(properties.Type); const type = CrOnc.getStateOrActiveString(properties.Type);
if (!name) { if (!name) {
assert(CrOncStrings);
return CrOncStrings['OncType' + type]; return CrOncStrings['OncType' + type];
} }
if (type == 'VPN' && properties.VPN) { if (type == 'VPN' && properties.VPN) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment