Commit bc2634bf authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Print Preview: Add Cloud Print deprecation warning icons

Add a deprecation warning icon for Cloud and Privet printers in the
destinations dialog.

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

Bug: 1112581
Change-Id: I61eb58920eb16bf9b3f6f0db389ee3db80a7d9dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2350118
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797911}
parent b70fb092
......@@ -656,6 +656,16 @@ export class Destination {
return this.certificateStatus_ === DestinationCertificateStatus.NO;
}
/**
* @return {boolean} Whether the destination's description and icon should
* warn that it is a deprecated printer.
*/
get shouldShowDeprecatedPrinterWarning() {
return !this.cloudPrintDeprecationWarningsSuppressed_ &&
this.id_ !== Destination.GooglePromotedId.DOCS &&
(this.isPrivet || CloudOrigins.includes(this.origin_));
}
/**
* @return {boolean} Whether the destination should display an invalid
* certificate UI warning in the selection dialog and cause a UI
......@@ -734,6 +744,9 @@ export class Destination {
if (this.shouldShowSaveToDriveWarning) {
return 'print-preview:save-to-drive-not-supported';
}
if (this.shouldShowDeprecatedPrinterWarning) {
return 'print-preview:printer-not-supported';
}
if (this.id_ === Destination.GooglePromotedId.DOCS) {
return 'print-preview:save-to-drive';
}
......
......@@ -16,6 +16,11 @@
</g>
<!-- Custom SVGs (shuom) -->
<g id="printer-not-supported" viewBox="0 0 20 18" aria-label="$i18n{destinationNotSupportedWarning}">
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 18H19.5L14 8L8 18ZM14.5453 16.6616H13.4544V15.5789H14.5453V16.6616ZM13.4544 14.4962H14.5453V12.3308H13.4544V14.4962Z" fill="#E8710A"></path>
<path d="M3 5H17C18.66 5 20 6.34 20 8V14H18.5L14 6L11 11H6V16H8L6.8 18H4V14H0V8C0 6.34 1.34 5 3 5Z"></path>
<path d="M16 0H4V4H16V0Z"></path>
</g>
<g id="save-to-drive-not-supported" viewBox="0 0 19 15">
<path d="M6.8 0H1.7C0.765 0 0.0085 0.7875 0.0085 1.75L0 12.25C0 13.2125 0.765 14 1.7 14H6.2L13 3L17 9.5V3.5C17 2.5375 16.235 1.75 15.3 1.75H8.5L6.8 0Z"></path>
<path fill-rule="evenodd" clip-rule="evenodd" d="M19 15L13 5L7 15H19ZM13.5453 13.6616H12.4544V12.5789H13.5453V13.6616ZM12.4544 11.4962H13.5453V9.33075H12.4544V11.4962Z" fill="#E8710A"></path>
......
......@@ -117,19 +117,27 @@ suite(destination_select_test.suiteName, function() {
destinationSelect, `ID2/${cookieOrigin}/${account}`);
})
.then(() => {
const dest2Icon = cloudPrintDeprecationWarningsSuppressed ?
'printer-shared' :
'printer-not-supported';
// Should already be updated.
compareIcon(selectEl, 'printer-shared');
compareIcon(selectEl, dest2Icon);
// Update destination.
destinationSelect.destination = recentDestinationList[1];
compareIcon(selectEl, 'printer-shared');
compareIcon(selectEl, dest2Icon);
// Select a destination with a standard printer icon.
return selectOption(
destinationSelect, `ID3/${cookieOrigin}/${account}`);
})
.then(() => {
compareIcon(selectEl, 'print');
const dest3Icon = cloudPrintDeprecationWarningsSuppressed ?
'print' :
'printer-not-supported';
compareIcon(selectEl, dest3Icon);
});
}
......
......@@ -326,6 +326,7 @@ destination_select_test_cros.suiteName = 'DestinationSelectTestCros';
destination_select_test_cros.TestNames = {
UpdateStatus: 'update status',
ChangeIcon: 'change icon',
ChangeIconDeprecationWarnings: 'change icon deprecation warnings',
EulaIsDisplayed: 'eula is displayed',
SelectDriveDestination: 'select drive destination',
};
......@@ -387,9 +388,11 @@ suite(destination_select_test_cros.suiteName, function() {
/**
* Test that changing different destinations results in the correct icon being
* shown.
* @param {boolean} cloudPrintDeprecationWarningsSuppressed Whether cloud
* print deprecation warnings should be suppressed.
* @return {!Promise} Promise that resolves when the test finishes.
*/
function testChangeIcon() {
function testChangeIcon(cloudPrintDeprecationWarningsSuppressed) {
const cookieOrigin = DestinationOrigin.COOKIES;
let selectEl;
......@@ -422,19 +425,27 @@ suite(destination_select_test_cros.suiteName, function() {
destinationSelect, `ID2/${cookieOrigin}/${account}`);
})
.then(() => {
const dest2Icon = cloudPrintDeprecationWarningsSuppressed ?
'printer-shared' :
'printer-not-supported';
// Should already be updated.
compareIcon(selectEl, 'printer-shared');
compareIcon(selectEl, dest2Icon);
// Update destination.
destinationSelect.destination = recentDestinationList[1];
compareIcon(selectEl, 'printer-shared');
compareIcon(selectEl, dest2Icon);
// Select a destination with a standard printer icon.
return selectOption(
destinationSelect, `ID3/${cookieOrigin}/${account}`);
})
.then(() => {
compareIcon(selectEl, 'print');
const dest3Icon = cloudPrintDeprecationWarningsSuppressed ?
'print' :
'printer-not-supported';
compareIcon(selectEl, dest3Icon);
});
}
......@@ -458,9 +469,25 @@ suite(destination_select_test_cros.suiteName, function() {
});
test(assert(destination_select_test_cros.TestNames.ChangeIcon), function() {
return testChangeIcon();
loadTimeData.overrideValues(
{cloudPrintDeprecationWarningsSuppressed: true});
// Repopulate |recentDestinationList| to have
// |cloudPrintDeprecationWarningsSuppressed| take effect during creation of
// new Destinations.
populateRecentDestinationList();
destinationSelect.recentDestinationList = recentDestinationList;
return testChangeIcon(true);
});
test(
assert(
destination_select_test_cros.TestNames.ChangeIconDeprecationWarnings),
function() {
return testChangeIcon(false);
});
/**
* Tests that destinations with a EULA will display the EULA URL.
*/
......
......@@ -1119,6 +1119,13 @@ TEST_F('PrintPreviewDestinationSelectTestCrOS', 'ChangeIcon', function() {
this.runMochaTest(destination_select_test_cros.TestNames.ChangeIcon);
});
TEST_F(
'PrintPreviewDestinationSelectTestCrOS', 'ChangeIconDeprecationWarnings',
function() {
this.runMochaTest(
destination_select_test_cros.TestNames.ChangeIconDeprecationWarnings);
});
TEST_F('PrintPreviewDestinationSelectTestCrOS', 'EulaIsDisplayed', function() {
this.runMochaTest(destination_select_test_cros.TestNames.EulaIsDisplayed);
});
......
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