Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6058)

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js

Issue 334623002: Add gallery browser tests to delete an image in the slide mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_manager_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js
index 7cb3c0f25968036f66fe887976e5819d14ff342c..186ffe862a5447d22f70250609655e142ddd3c53 100644
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js
@@ -33,6 +33,19 @@ function waitForSlideImage(document, width, height, name) {
}
/**
+ * Shorthand for clicking an element.
+ * @param {AppWindow} appWindow application window.
+ * @param {string} query Query for the element.
+ * @param {Promise} Promise to be fulfilled with the clicked element.
+ */
+function waitAndClickElement(appWindow, query) {
+ return waitForElement(appWindow, query).then(function(element) {
+ element.click();
+ return element;
+ });
+}
+
+/**
* Runs a test to traverse images in the slide mode.
*
* @param {string} testVolumeName Test volume name passed to the addEntries
@@ -45,23 +58,22 @@ function traverseSlideImages(testVolumeName, volumeType) {
var launchedPromise = launchWithTestEntries(
testVolumeName, volumeType, testEntries, testEntries.slice(0, 1));
var appWindow;
- var clickElement = function(element) { element.click(); };
return launchedPromise.then(function(args) {
appWindow = args.appWindow;
return waitForSlideImage(appWindow.contentWindow.document,
800, 600, 'My Desktop Background');
}).then(function() {
- return waitForElement(appWindow, '.arrow.right').then(clickElement);
+ return waitAndClickElement(appWindow, '.arrow.right');
}).then(function() {
return waitForSlideImage(appWindow.contentWindow.document,
1024, 768, 'image2');
}).then(function() {
- return waitForElement(appWindow, '.arrow.right').then(clickElement);
+ return waitAndClickElement(appWindow, '.arrow.right');
}).then(function() {
return waitForSlideImage(appWindow.contentWindow.document,
640, 480, 'image3');
}).then(function() {
- return waitForElement(appWindow, '.arrow.right').then(clickElement);
+ return waitAndClickElement(appWindow, '.arrow.right');
}).then(function() {
return waitForSlideImage(appWindow.contentWindow.document,
800, 600, 'My Desktop Background');
@@ -101,6 +113,36 @@ function renameImage(testVolumeName, volumeType) {
}
/**
+ * Runs a test to delete an image.
+ *
+ * @param {string} testVolumeName Test volume name passed to the addEntries
+ * function. Either 'drive' or 'local'.
+ * @param {VolumeManagerCommon.VolumeType} volumeType Volume type.
+ * @return {Promise} Promise to be fulfilled with on success.
+ */
+function deleteImage(testVolumeName, volumeType) {
+ var launchedPromise = launchWithTestEntries(
+ testVolumeName, volumeType, [ENTRIES.desktop]);
+ var appWindow;
+ return launchedPromise.then(function(args) {
+ appWindow = args.appWindow;
+ return waitForSlideImage(appWindow.contentWindow.document,
+ 800, 600, 'My Desktop Background');
+ }).then(function() {
+ return waitAndClickElement(appWindow, 'button.delete').
+ then(waitAndClickElement.bind(null, appWindow, '.cr-dialog-ok'));
+ }).then(function() {
+ return repeatUntil(function() {
+ return getFilesUnderVolume(volumeType, ['New Image Name.png']).then(
+ function() {
+ return pending('"New Image Name.png" is still there.');
+ },
+ function() { return true; });
+ });
+ });
+}
+
+/**
* The traverseSlideImages test for Downloads.
* @return {Promise} Promise to be fulfilled with on success.
*/
@@ -131,3 +173,19 @@ function renameImageOnDownloads() {
function renameImageOnDrive() {
return renameImage('drive', VolumeManagerCommon.VolumeType.DRIVE);
}
+
+/**
+ * The deleteImage test for Downloads.
+ * @return {Promise} Promise to be fulfilled with on success.
+ */
+function deleteImageOnDownloads() {
+ return deleteImage('local', VolumeManagerCommon.VolumeType.DOWNLOADS);
+}
+
+/**
+ * The deleteImage test for Google Drive.
+ * @return {Promise} Promise to be fulfilled with on success.
+ */
+function deleteImageOnDrive() {
+ return deleteImage('drive', VolumeManagerCommon.VolumeType.DRIVE);
+}
« no previous file with comments | « chrome/browser/chromeos/file_manager/file_manager_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698