Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 /** | 5 /** |
| 6 * Expected files before tests are performed. Entries for Local tests. | 6 * Expected files before tests are performed. Entries for Local tests. |
| 7 * @type {Array.<Array.<string>>} | 7 * @type {Array.<Array.<string>>} |
| 8 * @const | 8 * @const |
| 9 */ | 9 */ |
| 10 var EXPECTED_FILES_BEFORE_LOCAL = [ | 10 var EXPECTED_FILES_BEFORE_LOCAL = [ |
| 11 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], | 11 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], |
| 12 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], | 12 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], |
| 13 ['My Desktop Background.png', '272 bytes', 'PNG image', | 13 ['My Desktop Background.png', '272 bytes', 'PNG image', |
| 14 'Jan 18, 2038 1:02 AM'], | 14 'Jan 18, 2038 1:02 AM'], |
| 15 ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 AM'], | |
| 15 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'] | 16 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'] |
| 16 // ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden | 17 // ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden |
| 17 ].sort(); | 18 ].sort(); |
| 18 | 19 |
| 19 /** | 20 /** |
| 20 * Expected files before tests are performed. Entries for Drive tests. | 21 * Expected files before tests are performed. Entries for Drive tests. |
| 21 * @type {Array.<Array.<string>>} | 22 * @type {Array.<Array.<string>>} |
| 22 * @const | 23 * @const |
| 23 */ | 24 */ |
| 24 var EXPECTED_FILES_BEFORE_DRIVE = [ | 25 var EXPECTED_FILES_BEFORE_DRIVE = [ |
| 25 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], | 26 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], |
| 26 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], | 27 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], |
| 27 ['My Desktop Background.png', '272 bytes', 'PNG image', | 28 ['My Desktop Background.png', '272 bytes', 'PNG image', |
| 28 'Jan 18, 2038 1:02 AM'], | 29 'Jan 18, 2038 1:02 AM'], |
| 30 ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 AM'], | |
| 29 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'], | 31 ['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'], |
| 30 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], | 32 ['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'], |
| 31 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] | 33 ['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM'] |
| 32 ].sort(); | 34 ].sort(); |
| 33 | 35 |
| 34 /** | 36 /** |
| 35 * Expected files added during some tests. | 37 * Expected files added during some tests. |
| 36 * @type {Array.<Array.<string>>} | 38 * @type {Array.<Array.<string>>} |
| 37 * @const | 39 * @const |
| 38 */ | 40 */ |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 }, | 187 }, |
| 186 function(result) { | 188 function(result) { |
| 187 chrome.test.assertTrue(result); | 189 chrome.test.assertTrue(result); |
| 188 // Wait for the image in the gallery's screen image. | 190 // Wait for the image in the gallery's screen image. |
| 189 callRemoteTestUtil('waitForElement', | 191 callRemoteTestUtil('waitForElement', |
| 190 appId, | 192 appId, |
| 191 ['.gallery .content canvas.image', | 193 ['.gallery .content canvas.image', |
| 192 'iframe.overlay-pane'], | 194 'iframe.overlay-pane'], |
| 193 steps.shift()); | 195 steps.shift()); |
| 194 }, | 196 }, |
| 195 function(attributes) { | 197 function(element) { |
| 196 // Verify the gallery's screen image. | 198 // Verify the gallery's screen image. |
| 197 chrome.test.assertEq('320', attributes['width']); | 199 chrome.test.assertEq('320', element.attributes.width); |
| 198 chrome.test.assertEq('240', attributes['height']); | 200 chrome.test.assertEq('240', element.attributes.height); |
| 199 // Get the full-resolution image. | 201 // Get the full-resolution image. |
| 200 callRemoteTestUtil('waitForElement', | 202 callRemoteTestUtil('waitForElement', |
| 201 appId, | 203 appId, |
| 202 ['.gallery .content canvas.fullres', | 204 ['.gallery .content canvas.fullres', |
| 203 'iframe.overlay-pane'], | 205 'iframe.overlay-pane'], |
| 204 steps.shift()); | 206 steps.shift()); |
| 205 }, | 207 }, |
| 206 function(attributes) { | 208 function(element) { |
| 207 // Verify the gallery's screen image. | 209 // Verify the gallery's screen image. |
| 208 chrome.test.assertEq('800', attributes['width']); | 210 chrome.test.assertEq('800', element.attributes.width); |
| 209 chrome.test.assertEq('600', attributes['height']); | 211 chrome.test.assertEq('600', element.attributes.height); |
| 210 chrome.test.succeed(); | 212 chrome.test.succeed(); |
| 211 }, | 213 } |
| 212 ]; | 214 ]; |
| 213 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); | 215 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); |
| 214 steps.shift()(); | 216 steps.shift()(); |
| 217 }; | |
| 218 | |
| 219 /** | |
| 220 * Tests if the audio player shows up for the selected image and that the audio | |
| 221 * is loaded successfully. | |
| 222 * | |
| 223 * @param {string} path Directory path to be tested. | |
| 224 */ | |
| 225 testcase.intermediate.audioOpen = function(path) { | |
| 226 var appId; | |
| 227 var audioAppId; | |
| 228 var steps = [ | |
| 229 function() { | |
| 230 setupAndWaitUntilReady(path, steps.shift()); | |
| 231 }, | |
| 232 function(inAppId) { | |
| 233 appId = inAppId; | |
| 234 // Select the song. | |
| 235 callRemoteTestUtil( | |
| 236 'selectFile', appId, ['Beautiful Song.ogg'], steps.shift()); | |
| 237 }, | |
| 238 function(result) { | |
| 239 chrome.test.assertTrue(result); | |
| 240 // Click on the label to enter the audio player. | |
| 241 callRemoteTestUtil( | |
| 242 'fakeMouseClick', | |
| 243 appId, | |
| 244 ['#file-list li.table-row[selected] .filename-label span'], | |
| 245 steps.shift()); | |
| 246 }, | |
| 247 function(result) { | |
| 248 chrome.test.assertTrue(result); | |
| 249 // Wait for the audio player. | |
| 250 callRemoteTestUtil('waitForWindow', | |
| 251 null, | |
| 252 ['mediaplayer.html'], | |
| 253 steps.shift()); | |
| 254 }, | |
| 255 function(appId) { | |
|
hirono
2013/05/27 09:15:37
The name 'appId' is also used in the outer functio
mtomasz
2013/05/27 09:18:12
Good idea. Done.
| |
| 256 audioAppId = appId; | |
| 257 // Wait for the audio tag and verify the source. | |
| 258 callRemoteTestUtil('waitForElement', | |
| 259 audioAppId, | |
| 260 ['audio[src]'], | |
| 261 steps.shift()); | |
| 262 }, | |
| 263 function(element) { | |
| 264 chrome.test.assertEq( | |
| 265 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' + | |
| 266 'external' + path + '/Beautiful%20Song.ogg', | |
| 267 element.attributes.src); | |
| 268 // Get the title tag. | |
| 269 callRemoteTestUtil('waitForElement', | |
| 270 audioAppId, | |
| 271 ['.data-title'], | |
| 272 steps.shift()); | |
| 273 }, | |
| 274 function(element) { | |
| 275 chrome.test.assertEq('Beautiful Song', element.text); | |
| 276 // Get the artist tag. | |
| 277 callRemoteTestUtil('waitForElement', | |
| 278 audioAppId, | |
| 279 ['.data-artist'], | |
| 280 steps.shift()); | |
| 281 }, | |
| 282 function(element) { | |
| 283 chrome.test.assertEq('Unknown Artist', element.text); | |
| 284 chrome.test.succeed(); | |
| 285 } | |
| 286 ]; | |
| 287 steps = steps.map(function(f) { return chrome.test.callbackPass(f); }); | |
| 288 steps.shift()(); | |
| 215 }; | 289 }; |
| 216 | 290 |
| 217 /** | 291 /** |
| 218 * Tests copying a file to the same directory and waits until the file lists | 292 * Tests copying a file to the same directory and waits until the file lists |
| 219 * changes. | 293 * changes. |
| 220 * | 294 * |
| 221 * @param {string} path Directory path to be tested. | 295 * @param {string} path Directory path to be tested. |
| 222 */ | 296 */ |
| 223 testcase.intermediate.keyboardCopy = function(path, callback) { | 297 testcase.intermediate.keyboardCopy = function(path, callback) { |
| 224 setupAndWaitUntilReady(path, function(appId) { | 298 setupAndWaitUntilReady(path, function(appId) { |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 253 }; | 327 }; |
| 254 | 328 |
| 255 testcase.fileDisplayDownloads = function() { | 329 testcase.fileDisplayDownloads = function() { |
| 256 testcase.intermediate.fileDisplay('/Downloads'); | 330 testcase.intermediate.fileDisplay('/Downloads'); |
| 257 }; | 331 }; |
| 258 | 332 |
| 259 testcase.galleryOpenDownloads = function() { | 333 testcase.galleryOpenDownloads = function() { |
| 260 testcase.intermediate.galleryOpen('/Downloads'); | 334 testcase.intermediate.galleryOpen('/Downloads'); |
| 261 }; | 335 }; |
| 262 | 336 |
| 337 testcase.audioOpenDownloads = function() { | |
| 338 testcase.intermediate.audioOpen('/Downloads'); | |
| 339 }; | |
| 340 | |
| 263 testcase.keyboardCopyDownloads = function() { | 341 testcase.keyboardCopyDownloads = function() { |
| 264 testcase.intermediate.keyboardCopy('/Downloads'); | 342 testcase.intermediate.keyboardCopy('/Downloads'); |
| 265 }; | 343 }; |
| 266 | 344 |
| 267 testcase.keyboardDeleteDownloads = function() { | 345 testcase.keyboardDeleteDownloads = function() { |
| 268 testcase.intermediate.keyboardDelete('/Downloads'); | 346 testcase.intermediate.keyboardDelete('/Downloads'); |
| 269 }; | 347 }; |
| 270 | 348 |
| 271 testcase.fileDisplayDrive = function() { | 349 testcase.fileDisplayDrive = function() { |
| 272 testcase.intermediate.fileDisplay('/drive/root'); | 350 testcase.intermediate.fileDisplay('/drive/root'); |
| 273 }; | 351 }; |
| 274 | 352 |
| 275 testcase.galleryOpenDrive = function() { | 353 testcase.galleryOpenDrive = function() { |
| 276 testcase.intermediate.galleryOpen('/drive/root'); | 354 testcase.intermediate.galleryOpen('/drive/root'); |
| 277 }; | 355 }; |
| 278 | 356 |
| 357 testcase.audioOpenDrive = function() { | |
| 358 testcase.intermediate.audioOpen('/drive/root'); | |
| 359 }; | |
| 360 | |
| 279 testcase.keyboardCopyDrive = function() { | 361 testcase.keyboardCopyDrive = function() { |
| 280 testcase.intermediate.keyboardCopy('/drive/root'); | 362 testcase.intermediate.keyboardCopy('/drive/root'); |
| 281 }; | 363 }; |
| 282 | 364 |
| 283 testcase.keyboardDeleteDrive = function() { | 365 testcase.keyboardDeleteDrive = function() { |
| 284 testcase.intermediate.keyboardDelete('/drive/root'); | 366 testcase.intermediate.keyboardDelete('/drive/root'); |
| 285 }; | 367 }; |
| 286 | 368 |
| 287 /** | 369 /** |
| 288 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, | 370 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 /** | 649 /** |
| 568 * Tests copy from drive's offline to drive's root. | 650 * Tests copy from drive's offline to drive's root. |
| 569 */ | 651 */ |
| 570 testcase.transferFromOfflineToDrive = function() { | 652 testcase.transferFromOfflineToDrive = function() { |
| 571 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', | 653 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', |
| 572 'drive_offline', | 654 'drive_offline', |
| 573 EXPECTED_FILES_IN_OFFLINE, | 655 EXPECTED_FILES_IN_OFFLINE, |
| 574 'drive', | 656 'drive', |
| 575 EXPECTED_FILES_BEFORE_DRIVE); | 657 EXPECTED_FILES_BEFORE_DRIVE); |
| 576 }; | 658 }; |
| OLD | NEW |