Commit 00c0fe83 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Add Cloud Print deprecation warning under CrOS destination select

Add a deprecation warning message for Cloud and Privet printers under
the ChromeOS print preview destination select.

Screenshot of change: https://imgur.com/cZqYwba

Bug: 1112581
Change-Id: Idffd0ff25f3182db3546dca9f89b0dfd21d4bccf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2359159
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799500}
parent f6b6118a
<style include="print-preview-shared throbber md-select destination-select cr-hidden-style"> <style include="print-preview-shared throbber md-select destination-select cr-hidden-style">
:host([is-current-destination-cros-local_]) #statusText {
:host([is-current-destination-cros-local_]) #statusText { color: var(--google-red-600);
color: var(--google-red-600); font-size: calc(10 / 13 * 1em);
font-size: calc(10 / 13 * 1em); overflow: hidden;
padding: 0; padding: 0;
} text-overflow: ellipsis;
white-space: nowrap;
}
</style> </style>
<print-preview-settings-section> <print-preview-settings-section>
<span slot="title">$i18n{destinationLabel}</span> <span slot="title">$i18n{destinationLabel}</span>
...@@ -60,8 +61,7 @@ ...@@ -60,8 +61,7 @@
<div slot="title"></div> <div slot="title"></div>
<div slot="controls"> <div slot="controls">
<div id="statusText" class="destination-status" title="[[statusText_]]" <div id="statusText" class="destination-status" title="[[statusText_]]"
aria-hidden="true"> aria-hidden="[[isCurrentDestinationCrosLocal_]]">
[[statusText_]]
</div> </div>
</div> </div>
</print-preview-settings-section> </print-preview-settings-section>
......
...@@ -70,6 +70,7 @@ Polymer({ ...@@ -70,6 +70,7 @@ Polymer({
type: String, type: String,
computed: computed:
'computeStatusText_(destination, destination.printerStatusReason)', 'computeStatusText_(destination, destination.printerStatusReason)',
observer: 'onStatusTextSet_',
}, },
/** @private {string} */ /** @private {string} */
...@@ -351,9 +352,18 @@ Polymer({ ...@@ -351,9 +352,18 @@ Polymer({
// Cloudprint destinations contain their own status text. // Cloudprint destinations contain their own status text.
if (CloudOrigins.some(origin => origin === this.destination.origin)) { if (CloudOrigins.some(origin => origin === this.destination.origin)) {
return this.destination.shouldShowInvalidCertificateError ? if (this.destination.shouldShowInvalidCertificateError) {
this.i18n('noLongerSupportedFragment') : return this.i18n('noLongerSupportedFragment');
this.destination.connectionStatusText; }
if (this.destination.connectionStatusText) {
return this.destination.connectionStatusText;
}
}
if (this.destination.origin !== DestinationOrigin.CROS) {
return this.destination.shouldShowDeprecatedPrinterWarning ?
this.i18nAdvanced('printerNotSupportedWarning') :
'';
} }
// Only when the flag is enabled do we need to fetch a local printer status // Only when the flag is enabled do we need to fetch a local printer status
...@@ -372,6 +382,11 @@ Polymer({ ...@@ -372,6 +382,11 @@ Polymer({
return this.getErrorString_(printerStatusReason); return this.getErrorString_(printerStatusReason);
}, },
/** @private */
onStatusTextSet_() {
this.$$('#statusText').innerHTML = this.statusText_;
},
/** /**
* @param {!PrinterStatusReason} printerStatusReason * @param {!PrinterStatusReason} printerStatusReason
* @return {!string} * @return {!string}
......
...@@ -453,6 +453,10 @@ suite(destination_select_test_cros.suiteName, function() { ...@@ -453,6 +453,10 @@ suite(destination_select_test_cros.suiteName, function() {
'printer-not-supported'; 'printer-not-supported';
compareIcon(selectEl, dest3Icon); compareIcon(selectEl, dest3Icon);
// Update destination.
destinationSelect.destination = recentDestinationList[2];
compareIcon(selectEl, dest3Icon);
}); });
} }
...@@ -465,6 +469,7 @@ suite(destination_select_test_cros.suiteName, function() { ...@@ -465,6 +469,7 @@ suite(destination_select_test_cros.suiteName, function() {
function testUpdateStatus(cloudPrintDeprecationWarningsSuppressed) { function testUpdateStatus(cloudPrintDeprecationWarningsSuppressed) {
loadTimeData.overrideValues({ loadTimeData.overrideValues({
offline: 'offline', offline: 'offline',
printerNotSupportedWarning: 'printerNotSupportedWarning',
}); });
assertFalse(destinationSelect.$$('.throbber-container').hidden); assertFalse(destinationSelect.$$('.throbber-container').hidden);
...@@ -482,22 +487,26 @@ suite(destination_select_test_cros.suiteName, function() { ...@@ -482,22 +487,26 @@ suite(destination_select_test_cros.suiteName, function() {
destinationSelect.destination = getGoogleDriveDestination(account); destinationSelect.destination = getGoogleDriveDestination(account);
destinationSelect.updateDestination(); destinationSelect.updateDestination();
assertTrue(additionalInfoEl.hidden); assertTrue(additionalInfoEl.hidden);
assertEquals('', statusEl.innerHTML.trim()); assertEquals('', statusEl.innerHTML);
destinationSelect.destination = recentDestinationList[0]; destinationSelect.destination = recentDestinationList[0];
destinationSelect.updateDestination(); destinationSelect.updateDestination();
assertTrue(additionalInfoEl.hidden); assertTrue(additionalInfoEl.hidden);
assertEquals('', statusEl.innerHTML.trim()); assertEquals('', statusEl.innerHTML);
destinationSelect.destination = recentDestinationList[1]; destinationSelect.destination = recentDestinationList[1];
destinationSelect.updateDestination(); destinationSelect.updateDestination();
assertFalse(additionalInfoEl.hidden); assertFalse(additionalInfoEl.hidden);
assertEquals('offline', statusEl.innerHTML.trim()); assertEquals('offline', statusEl.innerHTML);
destinationSelect.destination = recentDestinationList[2]; destinationSelect.destination = recentDestinationList[2];
destinationSelect.updateDestination(); destinationSelect.updateDestination();
assertTrue(additionalInfoEl.hidden); assertEquals(
assertEquals('', statusEl.innerHTML.trim()); cloudPrintDeprecationWarningsSuppressed, additionalInfoEl.hidden);
const dest3Status = cloudPrintDeprecationWarningsSuppressed ?
'' :
'printerNotSupportedWarning';
assertEquals(dest3Status, statusEl.innerHTML);
} }
test(assert(destination_select_test_cros.TestNames.UpdateStatus), function() { test(assert(destination_select_test_cros.TestNames.UpdateStatus), function() {
......
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