Skip to content

Commit

Permalink
Diagnostics: Update network disabled string
Browse files Browse the repository at this point in the history
- Changes message for disabled network device to "{network_type} is
  off".
- Changes reconnect link text to "To reconnect, go to Settings".
- Adds "Join network" string and SHA.
- Tests for correct troubleshooting link based on network type and
  state.
- Updates SHA for related strings.

Strings Diagnostics app link: http://go/cros-diagnostics-strings
Screenshot: http://shortn/_bLFe7J3Ykq

  --gtest_filter=DiagnosticsApp*'

Bug: 1197335
Test: testing/xvfb.py out/Default/browser_tests
Change-Id: I6810da25a6ebcc382a74fb0d397f2a352cfa2939
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3219850
Auto-Submit: Ashley Prasad <ashleydp@google.com>
Commit-Queue: Ashley Prasad <ashleydp@google.com>
Reviewed-by: Zentaro Kavanagh <zentaro@chromium.org>
Cr-Commit-Position: refs/heads/main@{#931064}
  • Loading branch information
Ashley Prasad authored and Chromium LUCI CQ committed Oct 13, 2021
1 parent 659a582 commit c68d15b
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 8 deletions.
1 change: 1 addition & 0 deletions ash/webui/diagnostics_ui/diagnostics_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ void AddDiagnosticsStrings(content::WebUIDataSource* html_source) {
IDS_NETWORK_DIAGNOSTICS_IP_CONFIG_INFO_DRAWER_SUBNET_MASK},
{"ipConfigInfoDrawerTitle",
IDS_NETWORK_DIAGNOSTICS_IP_CONFIG_INFO_DRAWER_TITLE},
{"joinNetworkLinkText", IDS_DIAGNOSTICS_JOIN_NETWORK_LINK_TEXT},
{"lanConnectivityFailedText",
IDS_DIAGNOSTICS_LAN_CONNECTIVITY_FAILED_TEXT},
{"lanConnectivityGroupText", IDS_NETWORK_DIAGNOSTICS_CONNECTION_GROUP},
Expand Down
9 changes: 6 additions & 3 deletions ash/webui/diagnostics_ui/resources/network_card.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,10 +264,13 @@ Polymer({
* @return {!TroubleshootingInfo}
*/
getDisabledTroubleshootingInfo_() {
const linkText =
this.network && this.network.type === NetworkType.kCellular ?
this.i18n('reconnectLinkText') :
this.i18n('joinNetworkLinkText', this.networkType_);
return {
header: this.i18n('disabledText', this.networkType_),
linkText: this.i18n('reconnectLinkText'),
url: SETTINGS_URL,
header: this.i18n('disabledText', this.networkType_), linkText,
url: SETTINGS_URL,
}
},

Expand Down
20 changes: 19 additions & 1 deletion chrome/test/data/webui/chromeos/diagnostics/network_card_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import 'chrome://diagnostics/network_card.js';

import {fakeCellularNetwork, fakeCellularWithIpConfigNetwork, fakeConnectingEthernetNetwork, fakeDisconnectedEthernetNetwork, fakeDisconnectedWifiNetwork, fakeEthernetNetwork, fakeNetworkGuidInfoList, fakePortalWifiNetwork, fakeWifiNetwork, fakeWifiNetworkDisabled, fakeWifiNetworkInvalidNameServers, fakeWifiNetworkNoIpAddress} from 'chrome://diagnostics/fake_data.js';
import {fakeCellularDisabledNetwork, fakeCellularNetwork, fakeCellularWithIpConfigNetwork, fakeConnectingEthernetNetwork, fakeDisconnectedEthernetNetwork, fakeDisconnectedWifiNetwork, fakeEthernetNetwork, fakeNetworkGuidInfoList, fakePortalWifiNetwork, fakeWifiNetwork, fakeWifiNetworkDisabled, fakeWifiNetworkInvalidNameServers, fakeWifiNetworkNoIpAddress} from 'chrome://diagnostics/fake_data.js';
import {FakeNetworkHealthProvider} from 'chrome://diagnostics/fake_network_health_provider.js';
import {setNetworkHealthProviderForTesting} from 'chrome://diagnostics/mojo_interface_provider.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js';
Expand Down Expand Up @@ -60,6 +60,8 @@ export function networkCardTestSuite() {
'wifiGuidNoIpAddress', [fakeWifiNetworkNoIpAddress]);
provider.setFakeNetworkState(
'cellularWithIpConfigGuid', [fakeCellularWithIpConfigNetwork]);
provider.setFakeNetworkState(
'cellularDisabledGuid', [fakeCellularDisabledNetwork]);
// Add the network info to the DOM.
networkCardElement = /** @type {!NetworkCardElement} */ (
document.createElement('network-card'));
Expand Down Expand Up @@ -195,6 +197,9 @@ export function networkCardTestSuite() {
assertTrue(isVisible(getTroubleConnectingElement()));
assertFalse(isVisible(getNetworkInfoElement()));
assertFalse(isVisible(getIpConfigDrawerElement()));
assertEquals(
networkCardElement.i18n('joinNetworkLinkText', 'Wi-Fi'),
getTroubleshootingLinkText());
});
});

Expand Down Expand Up @@ -331,4 +336,17 @@ export function networkCardTestSuite() {
assertTrue(isVisible(getIpConfigDrawerElement()));
});
});

test('CardTitleCellularDisabledInitializedCorrectly', () => {
return initializeNetworkCard('cellularDisabledGuid').then(() => {
dx_utils.assertElementContainsText(
networkCardElement.$$('#cardTitle'), 'Mobile data');
assertTrue(isVisible(getTroubleConnectingElement()));
assertFalse(isVisible(getNetworkInfoElement()));
assertFalse(isVisible(getIpConfigDrawerElement()));
assertEquals(
networkCardElement.i18n('reconnectLinkText'),
getTroubleshootingLinkText());
});
});
}
7 changes: 5 additions & 2 deletions chromeos/chromeos_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -989,10 +989,13 @@ Try tapping the mic to ask me anything.
other {Name servers}}
</message>
<message name="IDS_DIAGNOSTICS_DISABLED_TEXT" desc="The label for the text displaed when a network has been disabled.">
<ph name="NETWORK_NAME">$1<ex>Wi-Fi</ex></ph> has been disabled
<ph name="NETWORK_NAME">$1<ex>Wi-Fi</ex></ph> is off
</message>
<message name="IDS_DIAGNOSTICS_RECONNECT_LINK_TEXT" desc="The text contains a link to the settings page to allow users to reconnect their network.">
Visit Settings to reconnect
To reconnect, go to Settings
</message>
<message name="IDS_DIAGNOSTICS_JOIN_NETWORK_LINK_TEXT" desc="The text contains a link to the settings page to allow users to reconnect their network.">
To join a <ph name="NETWORK_NAME">$1<ex>Wi-Fi</ex></ph> network, go to Settings
</message>
<message name="IDS_DIAGNOSTICS_NETWORK_TYPE_CELLULAR" desc="Label used to describe Cellular networks.">
Mobile data
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6d094a435368dbce4b199b041be35540888b1779
d42029b5adb299a042b858d55999d0ca38c1c5af
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f0fd50ed46070f1183ef95461d25d5fa446704fe
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6d094a435368dbce4b199b041be35540888b1779
d31ac54b7437a0495c489bc3be3459cdfc7c2e75

0 comments on commit c68d15b

Please sign in to comment.