Index: chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
index 1fcafd8b1625f1122fe5e4bc4dcb29c900a8e1a6..d27af556ffdd5f61c3d04102681c292da8f7f957 100644 |
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js |
@@ -3,6 +3,64 @@ |
// found in the LICENSE file. |
/** |
+ * @enum {string} |
+ * @const |
+ */ |
+var EntryType = { |
yoshiki
2013/09/10 04:38:55
Object.freeze?
hirono
2013/09/10 04:56:02
Done.
|
+ FILE: 'file', |
+ DIRECTORY: 'directory' |
+}; |
+ |
+/** |
+ * @enum {string} |
+ * @const |
+ */ |
+var SharedOption = { |
yoshiki
2013/09/10 04:38:55
ditto
hirono
2013/09/10 04:56:02
Done.
|
+ NONE: 'none', |
+ SHARED: 'shared' |
+}; |
+ |
+ |
+/** |
+ * File system entry information for tests. |
+ * |
+ * @param {EntryType} entryType Entry type. |
+ * @param {string} sourceFileName Source file name that provides file contents. |
+ * @param {string} targetName Name of entry on the test file system. |
+ * @param {string} mimeType Mime type. |
+ * @param {string} typeText Type name to be shown in the type column. |
+ * @param {string} sizeText Size text to be shown in the size column. |
+ * @param {SharedOption} sharedOption Shared option. |
+ * @param {string} lastModifiedTime Last modified time as a text to be shown in |
+ * the last modified column. |
+ * @constructor |
+ */ |
+var TestEntryInfo = function(entryType, |
+ sourceFileName, |
+ targetName, |
+ mimeType, |
+ typeText, |
+ sizeText, |
+ sharedOption, |
+ lastModifiedTime) { |
+ this.entryType = entryType; |
+ this.sourceFileName = sourceFileName; |
+ this.targetName = targetName; |
+ this.mimeType = mimeType; |
+ this.typeText = typeText; |
+ this.sizeText = sizeText; |
+ this.sharedOption = sharedOption; |
+ this.lastModifiedTime = lastModifiedTime; |
+}; |
yoshiki
2013/09/10 04:38:55
Object.seal(this)?
hirono
2013/09/10 04:56:02
This object is immutable, so we can freeze this.
|
+ |
+/** |
+ * Obtains a expected row contents of the file in the file list. |
+ */ |
+TestEntryInfo.prototype.getExpectedRow = function() { |
+ return [this.targetName, this.sizeText, this.typeText, this.lastModifiedTime]; |
+}; |
+ |
+/** |
* Expected files before tests are performed. Entries for Local tests. |
* @type {Array.<Array.<string>>} |
* @const |
@@ -34,13 +92,16 @@ var EXPECTED_FILES_BEFORE_DRIVE = [ |
].sort(); |
/** |
- * Expected files added during some tests. |
- * @type {Array.<Array.<string>>} |
+ * Filesystem entries used by the test cases. |
+ * @type {Object.<string, TestEntryInfo>} |
* @const |
*/ |
-var EXPECTED_NEWLY_ADDED_FILE = [ |
- ['newly added file.ogg', '14 KB', 'OGG audio', 'Sep 4, 1998 12:00 AM'] |
-]; |
+var ENTRIES = { |
+ newlyAdded: new TestEntryInfo( |
+ EntryType.FILE, 'music.ogg', 'newly added file.ogg', |
+ 'audio/ogg', 'OGG audio', '14 KB', SharedOption.NONE, |
+ 'Sep 4, 1998 12:00 AM') |
+}; |
/** |
* @param {boolean} isDrive True if the test is for Drive. |
@@ -166,7 +227,7 @@ testcase.intermediate.fileDisplay = function(path) { |
var expectedFilesBefore = getExpectedFilesBefore(path == '/drive/root'); |
var expectedFilesAfter = |
- expectedFilesBefore.concat(EXPECTED_NEWLY_ADDED_FILE).sort(); |
+ expectedFilesBefore.concat([ENTRIES.newlyAdded.getExpectedRow()]).sort(); |
StepsRunner.run([ |
function() { |
@@ -177,14 +238,7 @@ testcase.intermediate.fileDisplay = function(path) { |
function(inAppId, actualFilesBefore) { |
appId = inAppId; |
chrome.test.assertEq(expectedFilesBefore, actualFilesBefore); |
- addEntries(['local', 'drive'], [{ |
- type: 'file', |
- source_file_name: 'music.ogg', |
- target_name: 'newly added file.ogg', |
- mime_type: 'audio/ogg', |
- shared_option: 'none', |
- last_modified_time: '4 Sep 1998 00:00:00' |
- }], this.next); |
+ addEntries(['local', 'drive'], [ENTRIES.newlyAdded], this.next); |
}, |
function(result) { |
chrome.test.assertTrue(result); |