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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** | 7 /** |
8 * @enum {string} | 8 * @enum {string} |
9 * @const | 9 * @const |
10 */ | 10 */ |
11 var EntryType = Object.freeze({ | 11 var EntryType = Object.freeze({ |
12 FILE: 'file', | 12 FILE: 'file', |
13 DIRECTORY: 'directory' | 13 DIRECTORY: 'directory' |
14 }); | 14 }); |
15 | 15 |
16 /** | 16 /** |
17 * @enum {string} | 17 * @enum {string} |
18 * @const | 18 * @const |
19 */ | 19 */ |
20 var SharedOption = Object.freeze({ | 20 var SharedOption = Object.freeze({ |
21 NONE: 'none', | 21 NONE: 'none', |
22 SHARED: 'shared' | 22 SHARED: 'shared' |
23 }); | 23 }); |
24 | 24 |
25 /** | 25 /** |
26 * File system entry information for tests. | 26 * File system entry information for tests. |
27 * | 27 * |
28 * @param {EntryType} entryType Entry type. | 28 * @param {EntryType} type Entry type. |
29 * @param {string} sourceFileName Source file name that provides file contents. | 29 * @param {string} sourceFileName Source file name that provides file contents. |
30 * @param {string} targetName Name of entry on the test file system. | 30 * @param {string} targetName Name of entry on the test file system. |
31 * @param {string} mimeType Mime type. | 31 * @param {string} mimeType Mime type. |
32 * @param {string} typeText Type name to be shown in the type column. | |
33 * @param {string} sizeText Size text to be shown in the size column. | |
34 * @param {SharedOption} sharedOption Shared option. | 32 * @param {SharedOption} sharedOption Shared option. |
35 * @param {string} lastModifiedTime Last modified time as a text to be shown in | 33 * @param {string} lastModifiedTime Last modified time as a text to be shown in |
36 * the last modified column. | 34 * the last modified column. |
| 35 * @param {string} nameText File name to be shown in the name column. |
| 36 * @param {string} sizeText Size text to be shown in the size column. |
| 37 * @param {string} typeText Type name to be shown in the type column. |
37 * @constructor | 38 * @constructor |
38 */ | 39 */ |
39 var TestEntryInfo = function(entryType, | 40 var TestEntryInfo = function(type, |
40 sourceFileName, | 41 sourceFileName, |
41 targetName, | 42 targetName, |
42 mimeType, | 43 mimeType, |
43 typeText, | 44 sharedOption, |
| 45 lastModifiedTime, |
| 46 nameText, |
44 sizeText, | 47 sizeText, |
45 sharedOption, | 48 typeText) { |
46 lastModifiedTime) { | 49 this.type = type; |
47 this.entryType = entryType; | |
48 this.sourceFileName = sourceFileName; | 50 this.sourceFileName = sourceFileName; |
49 this.targetName = targetName; | 51 this.targetName = targetName; |
50 this.mimeType = mimeType; | 52 this.mimeType = mimeType; |
51 this.typeText = typeText; | |
52 this.sizeText = sizeText; | |
53 this.sharedOption = sharedOption; | 53 this.sharedOption = sharedOption; |
54 this.lastModifiedTime = lastModifiedTime; | 54 this.lastModifiedTime = lastModifiedTime; |
| 55 this.nameText = nameText; |
| 56 this.sizeText = sizeText; |
| 57 this.typeText = typeText; |
55 Object.freeze(this); | 58 Object.freeze(this); |
56 }; | 59 }; |
57 | 60 |
58 /** | 61 /** |
59 * Obtains a expected row contents of the file in the file list. | 62 * Obtains a expected row contents of the file in the file list. |
60 */ | 63 */ |
61 TestEntryInfo.prototype.getExpectedRow = function() { | 64 TestEntryInfo.prototype.getExpectedRow = function() { |
62 return [this.targetName, this.sizeText, this.typeText, this.lastModifiedTime]; | 65 return [this.nameText, this.sizeText, this.typeText, this.lastModifiedTime]; |
63 }; | 66 }; |
64 | 67 |
65 /** | 68 /** |
66 * Expected files before tests are performed. Entries for Local tests. | 69 * Expected files before tests are performed. Entries for Local tests. |
67 * @type {Array.<Array.<string>>} | 70 * @type {Array.<Array.<string>>} |
68 * @const | 71 * @const |
69 */ | 72 */ |
70 var EXPECTED_FILES_BEFORE_LOCAL = [ | 73 var EXPECTED_FILES_BEFORE_LOCAL = [ |
71 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], | 74 ['hello.txt', '51 bytes', 'Plain text', 'Sep 4, 1998 12:34 PM'], |
72 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], | 75 ['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'], |
(...skipping 21 matching lines...) Expand all Loading... |
94 ].sort(); | 97 ].sort(); |
95 | 98 |
96 /** | 99 /** |
97 * Filesystem entries used by the test cases. | 100 * Filesystem entries used by the test cases. |
98 * @type {Object.<string, TestEntryInfo>} | 101 * @type {Object.<string, TestEntryInfo>} |
99 * @const | 102 * @const |
100 */ | 103 */ |
101 var ENTRIES = { | 104 var ENTRIES = { |
102 newlyAdded: new TestEntryInfo( | 105 newlyAdded: new TestEntryInfo( |
103 EntryType.FILE, 'music.ogg', 'newly added file.ogg', | 106 EntryType.FILE, 'music.ogg', 'newly added file.ogg', |
104 'audio/ogg', 'OGG audio', '14 KB', SharedOption.NONE, | 107 'audio/ogg', SharedOption.NONE, 'Sep 4, 1998 12:00 AM', |
105 'Sep 4, 1998 12:00 AM') | 108 'newly added file.ogg', '14 KB', 'OGG audio') |
106 }; | 109 }; |
107 | 110 |
108 /** | 111 /** |
109 * @param {boolean} isDrive True if the test is for Drive. | 112 * @param {boolean} isDrive True if the test is for Drive. |
110 * @return {Array.<Array.<string>>} A sorted list of expected entries at the | 113 * @return {Array.<Array.<string>>} A sorted list of expected entries at the |
111 * initial state. | 114 * initial state. |
112 */ | 115 */ |
113 function getExpectedFilesBefore(isDrive) { | 116 function getExpectedFilesBefore(isDrive) { |
114 return isDrive ? | 117 return isDrive ? |
115 EXPECTED_FILES_BEFORE_DRIVE : | 118 EXPECTED_FILES_BEFORE_DRIVE : |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 appId2, | 1273 appId2, |
1271 [650, 490], | 1274 [650, 490], |
1272 this.next); | 1275 this.next); |
1273 }, | 1276 }, |
1274 // Check for errors. | 1277 // Check for errors. |
1275 function() { | 1278 function() { |
1276 checkIfNoErrorsOccured(this.next); | 1279 checkIfNoErrorsOccured(this.next); |
1277 } | 1280 } |
1278 ]); | 1281 ]); |
1279 }; | 1282 }; |
OLD | NEW |