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

Side by Side Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js

Issue 15984003: Add tests for the video player in Files.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 PM'],
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 PM'],
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
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(inAppId) {
256 audioAppId = inAppId;
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()();
289 };
290
291 /**
292 * Tests if the video player shows up for the selected movie and that it is
293 * loaded successfully.
294 *
295 * @param {string} path Directory path to be tested.
296 */
297 testcase.intermediate.videoOpen = function(path) {
298 var appId;
299 var videoAppId;
300 var steps = [
301 function() {
302 setupAndWaitUntilReady(path, steps.shift());
303 },
304 function(inAppId) {
305 appId = inAppId;
306 // Select the song.
307 callRemoteTestUtil(
308 'selectFile', appId, ['world.ogv'], steps.shift());
309 },
310 function(result) {
311 chrome.test.assertTrue(result);
312 // Click on the label to enter the video player.
313 callRemoteTestUtil(
314 'fakeMouseClick',
315 appId,
316 ['#file-list li.table-row[selected] .filename-label span'],
317 steps.shift());
318 },
319 function(result) {
320 chrome.test.assertTrue(result);
321 // Wait for the video player.
322 callRemoteTestUtil('waitForWindow',
323 null,
324 ['video_player.html'],
325 steps.shift());
326 },
327 function(appId) {
hirono 2013/05/28 07:59:46 Please use 'inAppId'.
mtomasz 2013/05/28 10:26:38 Done.
328 videoAppId = appId;
329 // Wait for the video tag and verify the source.
330 callRemoteTestUtil('waitForElement',
331 videoAppId,
332 ['video[src]'],
333 steps.shift());
334 },
335 function(element) {
336 chrome.test.assertEq(
337 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
338 'external' + path + '/world.ogv',
339 element.attributes.src);
340 // Wait for the window's inner dimensions. Should be changed to the video
341 // size once the metadata is loaded.
342 callRemoteTestUtil('waitForWindowGeometry',
343 videoAppId,
344 [320, 192],
345 chrome.test.succeed);
hirono 2013/05/28 07:59:46 It seems that chrome.test.succeed just records suc
mtomasz 2013/05/28 10:26:38 I think chrome.test.succeed marks the test case as
346 }
347 ];
348 steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
349 steps.shift()();
215 }; 350 };
216 351
217 /** 352 /**
218 * Tests copying a file to the same directory and waits until the file lists 353 * Tests copying a file to the same directory and waits until the file lists
219 * changes. 354 * changes.
220 * 355 *
221 * @param {string} path Directory path to be tested. 356 * @param {string} path Directory path to be tested.
222 */ 357 */
223 testcase.intermediate.keyboardCopy = function(path, callback) { 358 testcase.intermediate.keyboardCopy = function(path, callback) {
224 setupAndWaitUntilReady(path, function(appId) { 359 setupAndWaitUntilReady(path, function(appId) {
(...skipping 28 matching lines...) Expand all
253 }; 388 };
254 389
255 testcase.fileDisplayDownloads = function() { 390 testcase.fileDisplayDownloads = function() {
256 testcase.intermediate.fileDisplay('/Downloads'); 391 testcase.intermediate.fileDisplay('/Downloads');
257 }; 392 };
258 393
259 testcase.galleryOpenDownloads = function() { 394 testcase.galleryOpenDownloads = function() {
260 testcase.intermediate.galleryOpen('/Downloads'); 395 testcase.intermediate.galleryOpen('/Downloads');
261 }; 396 };
262 397
398 testcase.audioOpenDownloads = function() {
399 testcase.intermediate.audioOpen('/Downloads');
400 };
401
402 testcase.videoOpenDownloads = function() {
403 testcase.intermediate.videoOpen('/Downloads');
404 };
405
263 testcase.keyboardCopyDownloads = function() { 406 testcase.keyboardCopyDownloads = function() {
264 testcase.intermediate.keyboardCopy('/Downloads'); 407 testcase.intermediate.keyboardCopy('/Downloads');
265 }; 408 };
266 409
267 testcase.keyboardDeleteDownloads = function() { 410 testcase.keyboardDeleteDownloads = function() {
268 testcase.intermediate.keyboardDelete('/Downloads'); 411 testcase.intermediate.keyboardDelete('/Downloads');
269 }; 412 };
270 413
271 testcase.fileDisplayDrive = function() { 414 testcase.fileDisplayDrive = function() {
272 testcase.intermediate.fileDisplay('/drive/root'); 415 testcase.intermediate.fileDisplay('/drive/root');
273 }; 416 };
274 417
275 testcase.galleryOpenDrive = function() { 418 testcase.galleryOpenDrive = function() {
276 testcase.intermediate.galleryOpen('/drive/root'); 419 testcase.intermediate.galleryOpen('/drive/root');
277 }; 420 };
278 421
422 testcase.audioOpenDrive = function() {
423 testcase.intermediate.audioOpen('/drive/root');
424 };
425
426 testcase.videoOpenDrive = function() {
427 testcase.intermediate.videoOpen('/drive/root');
428 };
429
279 testcase.keyboardCopyDrive = function() { 430 testcase.keyboardCopyDrive = function() {
280 testcase.intermediate.keyboardCopy('/drive/root'); 431 testcase.intermediate.keyboardCopy('/drive/root');
281 }; 432 };
282 433
283 testcase.keyboardDeleteDrive = function() { 434 testcase.keyboardDeleteDrive = function() {
284 testcase.intermediate.keyboardDelete('/drive/root'); 435 testcase.intermediate.keyboardDelete('/drive/root');
285 }; 436 };
286 437
287 /** 438 /**
288 * Tests opening the "Recent" on the sidebar navigation by clicking the icon, 439 * Tests opening the "Recent" on the sidebar navigation by clicking the icon,
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 /** 721 /**
571 * Tests copy from drive's offline to drive's root. 722 * Tests copy from drive's offline to drive's root.
572 */ 723 */
573 testcase.transferFromOfflineToDrive = function() { 724 testcase.transferFromOfflineToDrive = function() {
574 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc', 725 testcase.intermediate.copyBetweenVolumes('Test Document.gdoc',
575 'drive_offline', 726 'drive_offline',
576 EXPECTED_FILES_IN_OFFLINE, 727 EXPECTED_FILES_IN_OFFLINE,
577 'drive', 728 'drive',
578 EXPECTED_FILES_BEFORE_DRIVE); 729 EXPECTED_FILES_BEFORE_DRIVE);
579 }; 730 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698