OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * Prepares the photo editor. | 8 * Prepares the photo editor. |
9 * | 9 * |
10 * @param {string} testVolumeName Test volume name passed to the addEntries | 10 * @param {string} testVolumeName Test volume name passed to the addEntries |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 * function. Either 'drive' or 'local'. | 130 * function. Either 'drive' or 'local'. |
131 * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. | 131 * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. |
132 * @return {Promise} Promise to be fulfilled with on success. | 132 * @return {Promise} Promise to be fulfilled with on success. |
133 */ | 133 */ |
134 function exposureImage(testVolumeName, volumeType) { | 134 function exposureImage(testVolumeName, volumeType) { |
135 var launchedPromise = setupPhotoEditor(testVolumeName, volumeType); | 135 var launchedPromise = setupPhotoEditor(testVolumeName, volumeType); |
136 return launchedPromise.then(function(args) { | 136 return launchedPromise.then(function(args) { |
137 var appId = args.appId; | 137 var appId = args.appId; |
138 var url = args.urls[0]; | 138 var url = args.urls[0]; |
139 var buttonQuery = '.gallery:not([locked]) button.exposure'; | 139 var buttonQuery = '.gallery:not([locked]) button.exposure'; |
140 | |
141 var origMetadata = null; | 140 var origMetadata = null; |
142 | 141 |
143 // Click the exposure button. | 142 // Click the exposure button. |
144 return gallery.waitAndClickElement(appId, buttonQuery).then(function() { | 143 return gallery.waitAndClickElement(appId, buttonQuery).then(function() { |
145 // Wait until the edit controls appear. | 144 // Wait until the edit controls appear. |
146 return Promise.all([ | 145 return Promise.all([ |
147 gallery.waitForElement(appId, '.brightness > paper-slider'), | 146 gallery.waitForElement(appId, '.brightness > paper-slider'), |
148 gallery.waitForElement(appId, '.contrast > paper-slider'), | 147 gallery.waitForElement(appId, '.contrast > paper-slider'), |
149 ]); | 148 ]); |
150 }).then(function() { | 149 }).then(function() { |
(...skipping 25 matching lines...) Expand all Loading... |
176 origMetadata.modificationTime, | 175 origMetadata.modificationTime, |
177 metadata.modificationTime); | 176 metadata.modificationTime); |
178 } | 177 } |
179 }); | 178 }); |
180 }); | 179 }); |
181 }); | 180 }); |
182 }); | 181 }); |
183 } | 182 } |
184 | 183 |
185 /** | 184 /** |
| 185 * Tests to resize an image and undoes it. |
| 186 * |
| 187 * @param {string} testVolumeName Test volume name passed to the addEntries |
| 188 * function. Either 'drive' or 'local' |
| 189 * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. |
| 190 * @return {Promise} Promise to be fulfilled with on success. |
| 191 */ |
| 192 function resizeImage(testVolumeName, volumeType) { |
| 193 var launchedPromise = setupPhotoEditor(testVolumeName, volumeType); |
| 194 return launchedPromise.then(function(args) { |
| 195 var appId = args.appId; |
| 196 |
| 197 return gallery.waitAndClickElement( |
| 198 appId, '.gallery:not([locked]) button.resize'). |
| 199 then(function() { |
| 200 return Promise.all([ |
| 201 gallery.waitForElement(appId, '.width > paper-input'), |
| 202 gallery.waitForElement(appId, '.height > paper-input'), |
| 203 gallery.waitForElement(appId, '.lockicon[locked]'), |
| 204 ]); |
| 205 }).then(function() { |
| 206 return gallery.callRemoteTestUtil( |
| 207 'changeValue', appId, ['.height > paper-input', 500]); |
| 208 }).then(function() { |
| 209 return gallery.fakeKeyDown( |
| 210 appId, 'body', 'Enter', 'Enter', false, false, false); |
| 211 }).then(function() { |
| 212 return gallery.waitForSlideImage(appId, 667, 500, |
| 213 'My Desktop Background'); |
| 214 }).then(function() { |
| 215 return gallery.waitAndClickElement( |
| 216 appId, '.gallery:not([locked]) button.undo'); |
| 217 }).then(function() { |
| 218 return gallery.waitForSlideImage(appId, 800, 600, |
| 219 'My Desktop Background'); |
| 220 }).then(function() { |
| 221 return gallery.waitAndClickElement( |
| 222 appId, '.gallery:not([locked]) button.resize'); |
| 223 }).then(function() { |
| 224 return Promise.all([ |
| 225 gallery.waitForElement(appId, '.width > paper-input'), |
| 226 gallery.waitForElement(appId, '.height > paper-input'), |
| 227 gallery.waitForElement(appId, '.lockicon[locked]'), |
| 228 ]); |
| 229 }).then(function() { |
| 230 return gallery.waitAndClickElement( |
| 231 appId, '.gallery:not([locked]) .lockicon[locked]'); |
| 232 }).then(function() { |
| 233 return gallery.callRemoteTestUtil( |
| 234 'changeValue', appId, ['.width > paper-input', 500]); |
| 235 }).then(function() { |
| 236 return gallery.callRemoteTestUtil( |
| 237 'changeValue', appId, ['.height > paper-input', 300]); |
| 238 }).then(function() { |
| 239 return gallery.fakeKeyDown( |
| 240 appId, 'body', 'Enter', 'Enter', false, false, false); |
| 241 }).then(function() { |
| 242 return gallery.waitForSlideImage(appId, 500, 300, |
| 243 'My Desktop Background'); |
| 244 }).then(function() { |
| 245 return gallery.waitAndClickElement( |
| 246 appId, '.gallery:not([locked]) button.undo'); |
| 247 }).then(function() { |
| 248 return gallery.waitForSlideImage(appId, 800, 600, |
| 249 'My Desktop Background'); |
| 250 }); |
| 251 }); |
| 252 } |
| 253 |
| 254 /** |
186 * Tests whether overwrite original checkbox is enabled or disabled properly. | 255 * Tests whether overwrite original checkbox is enabled or disabled properly. |
187 * | 256 * |
188 * @param {string} testVolumeName Test volume name passed to the addEntries | 257 * @param {string} testVolumeName Test volume name passed to the addEntries |
189 * function. Either 'drive' or 'local'. | 258 * function. Either 'drive' or 'local'. |
190 * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. | 259 * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. |
191 * @return {Promise} Promise to be fulfilled with on success. | 260 * @return {Promise} Promise to be fulfilled with on success. |
192 */ | 261 */ |
193 function enableDisableOverwriteOriginalCheckbox(testVolumeName, volumeType) { | 262 function enableDisableOverwriteOriginalCheckbox(testVolumeName, volumeType) { |
194 var appId; | 263 var appId; |
195 var launchedPromise = setupPhotoEditor(testVolumeName, volumeType); | 264 var launchedPromise = setupPhotoEditor(testVolumeName, volumeType); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 355 |
287 /** | 356 /** |
288 * The exposureImage test for Google Drive. | 357 * The exposureImage test for Google Drive. |
289 * @return {Promise} Promise to be fulfilled with on success. | 358 * @return {Promise} Promise to be fulfilled with on success. |
290 */ | 359 */ |
291 testcase.exposureImageOnDrive = function() { | 360 testcase.exposureImageOnDrive = function() { |
292 return exposureImage('drive', 'drive'); | 361 return exposureImage('drive', 'drive'); |
293 }; | 362 }; |
294 | 363 |
295 /** | 364 /** |
| 365 * The resize test for Downloas. |
| 366 * @return {Promise} Promise to be fulfilled with on success. |
| 367 */ |
| 368 testcase.resizeImageOnDownloads = function() { |
| 369 return resizeImage('local', 'downloads'); |
| 370 }; |
| 371 |
| 372 /** |
| 373 * The resize test for Google Drive |
| 374 * @return {Promise} Promise to be fulfilled with on success. |
| 375 */ |
| 376 testcase.resizeImageOnDrive = function() { |
| 377 return resizeImage('drive', 'drive'); |
| 378 } |
| 379 |
| 380 /** |
296 * The enableDisableOverwriteOriginalCheckbox test for Downloads. | 381 * The enableDisableOverwriteOriginalCheckbox test for Downloads. |
297 * @return {Promise} Promise to be fulfilled with on success. | 382 * @return {Promise} Promise to be fulfilled with on success. |
298 */ | 383 */ |
299 testcase.enableDisableOverwriteOriginalCheckboxOnDownloads = function() { | 384 testcase.enableDisableOverwriteOriginalCheckboxOnDownloads = function() { |
300 return enableDisableOverwriteOriginalCheckbox('local', 'downloads'); | 385 return enableDisableOverwriteOriginalCheckbox('local', 'downloads'); |
301 }; | 386 }; |
302 | 387 |
303 /** | 388 /** |
304 * The enableDisableOverwriteOriginalCheckbox test for Drive. | 389 * The enableDisableOverwriteOriginalCheckbox test for Drive. |
305 * @return {Promise} Promise to be fulfilled with on success. | 390 * @return {Promise} Promise to be fulfilled with on success. |
306 */ | 391 */ |
307 testcase.enableDisableOverwriteOriginalCheckboxOnDrive = function() { | 392 testcase.enableDisableOverwriteOriginalCheckboxOnDrive = function() { |
308 return enableDisableOverwriteOriginalCheckbox('drive', 'drive'); | 393 return enableDisableOverwriteOriginalCheckbox('drive', 'drive'); |
309 }; | 394 }; |
OLD | NEW |