Commit 18b2ef60 authored by Trent Apted's avatar Trent Apted Committed by Commit Bot

CrOS Gallery: Disable (hide) Edit and Print for <video>.

Bug: 850372
Test: GalleryBrowserTest.CheckAvailabilityOfEditAndPrintButtons
Cq-Include-Trybots: luci.chromium.try:closure_compilation
Change-Id: I5ce2e7e3adf1a3619d0cec18c9133f231c2749c0
Reviewed-on: https://chromium-review.googlesource.com/1114525Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Trent Apted <tapted@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570702}
parent 2405b447
......@@ -71,6 +71,12 @@ IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, OpenMultipleImagesOnDrive) {
StartTest();
}
IN_PROC_BROWSER_TEST_F(GalleryBrowserTest,
CheckAvailabilityOfEditAndPrintButtons) {
set_test_case_name("checkAvailabilityOfEditAndPrintButtons");
StartTest();
}
IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, TraverseSlideImagesOnDownloads) {
set_test_case_name("traverseSlideImagesOnDownloads");
StartTest();
......
......@@ -1081,13 +1081,9 @@ SlideMode.prototype.itemLoaded_ = function(
ImageUtil.getMetricName('FileType'), ext, ImageUtil.FILE_TYPES);
// Enable or disable buttons for editing and printing.
if (opt_error) {
this.editButton_.disabled = true;
this.printButton_.disabled = true;
} else {
this.editButton_.disabled = false;
this.printButton_.disabled = false;
}
let canEditAndPrint = !opt_error && item.isEditable();
this.editButton_.disabled = !canEditAndPrint;
this.printButton_.disabled = !canEditAndPrint;
// Saved label is hidden by default.
this.savedLabel_.hidden = true;
......
......@@ -137,6 +137,49 @@ function checkAvailabilityOfShareButton(testVolumeName, volumeType, available) {
});
}
/**
* Ensures edit and print buttons are available for images, disabled for video.
* @return {Promise} Promise to be fulfilled with on success.
*/
testcase.checkAvailabilityOfEditAndPrintButtons = function() {
var launchedPromise = launch(
'local', 'downloads', [ENTRIES.image3, ENTRIES.world], [ENTRIES.image3]);
var appId;
return launchedPromise
.then(function(result) {
appId = result.appId;
return gallery.waitForElement(appId, '.gallery[mode="slide"]');
})
.then(function() {
return gallery.callRemoteTestUtil(
'queryAllElements', appId,
['#top-toolbar > div > button.edit,button.print']);
})
.then(function(results) {
chrome.test.assertEq(2, results.length);
chrome.test.assertFalse('disabled' in results[0].attributes);
chrome.test.assertFalse('disabled' in results[0].attributes);
// Switch to the video.
return gallery.waitAndClickElement(appId, '.arrow.right');
})
.then(function() {
return gallery.waitForElement(appId, 'video');
})
.then(function() {
return gallery.callRemoteTestUtil(
'queryAllElements', appId,
['#top-toolbar > div > button.edit,button.print']);
})
.then(function(results) {
chrome.test.assertEq(2, results.length);
chrome.test.assertTrue('disabled' in results[0].attributes);
chrome.test.assertTrue('disabled' in results[0].attributes);
return true;
});
};
/**
* The traverseSlideImages test for Downloads.
* @return {Promise} Promise to be fulfilled with on success.
......
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