1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
8 * Tests if the gallery shows up for the selected image and that the image
11 * @param {string} path Directory path to be tested.
13 function galleryOpen(path) {
17 setupAndWaitUntilReady(null, path, this.next);
19 // Resize the window to desired dimensions to avoid flakyness.
22 callRemoteTestUtil('resizeWindow',
29 chrome.test.assertTrue(result);
30 callRemoteTestUtil('openFile',
32 ['My Desktop Background.png'],
35 // Wait for the image in the gallery's screen image.
37 chrome.test.assertTrue(result);
39 '.gallery .content canvas.image',
40 'iframe.overlay-pane').then(this.next);
42 // Verify the gallery's screen image.
44 chrome.test.assertEq('480', element.attributes.width);
45 chrome.test.assertEq('360', element.attributes.height);
46 // Get the full-resolution image.
48 '.gallery .content canvas.fullres',
49 'iframe.overlay-pane').then(this.next);
51 // Verify the gallery's full resolution image.
53 chrome.test.assertEq('800', element.attributes.width);
54 chrome.test.assertEq('600', element.attributes.height);
55 checkIfNoErrorsOccured(this.next);
61 * Tests if we can open and unmount a zip file.
62 * @param {string} path Directory path to be tested.
64 function zipOpen(path) {
69 addEntries(['local', 'drive'], [ENTRIES.zipArchive], this.next);
73 chrome.test.assertTrue(result);
74 openNewWindow(null, path, this.next);
76 // Wait for going back.
79 waitForElement(appId, '#detail-table').then(this.next);
82 waitForFiles(appId, [ENTRIES.zipArchive.getExpectedRow()]).
87 callRemoteTestUtil('openFile',
89 [ENTRIES.zipArchive.nameText],
92 // Wait for ZIP contents.
94 chrome.test.assertTrue(result);
97 'SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt',
102 {ignoreLastModifiedTime: true}).then(this.next);
106 waitForElement(appId, '.root-eject', this.next).then(this.next);
110 callRemoteTestUtil('fakeMouseClick',
115 // Wait for going back.
117 chrome.test.assertTrue(result);
118 waitForFiles(appId, [ENTRIES.zipArchive.getExpectedRow()]).
122 checkIfNoErrorsOccured(this.next);
127 testcase.galleryOpenDownloads = function() {
128 galleryOpen(RootPath.DOWNLOADS);
131 testcase.galleryOpenDrive = function() {
132 galleryOpen(RootPath.DRIVE);
135 testcase.zipOpenDownloads = function() {
136 zipOpen(RootPath.DOWNLOADS);
139 testcase.zipOpenDrive = function() {
140 zipOpen(RootPath.DRIVE);