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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
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 1f5e5057aeee159b9c16e009f5839e87e413eb34..8ab4c7c13cd3d2fd8131238e9ec76014972ab496 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
@@ -12,6 +12,7 @@ var EXPECTED_FILES_BEFORE_LOCAL = [
['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'],
['My Desktop Background.png', '272 bytes', 'PNG image',
'Jan 18, 2038 1:02 AM'],
+ ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 PM'],
['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM']
// ['.warez', '--', 'Folder', 'Oct 26, 1985 1:39 PM'] # should be hidden
].sort();
@@ -26,6 +27,7 @@ var EXPECTED_FILES_BEFORE_DRIVE = [
['world.ogv', '59 KB', 'OGG video', 'Jul 4, 2012 10:35 AM'],
['My Desktop Background.png', '272 bytes', 'PNG image',
'Jan 18, 2038 1:02 AM'],
+ ['Beautiful Song.ogg', '14 KB', 'OGG audio', 'Nov 12, 2086 12:00 PM'],
['photos', '--', 'Folder', 'Jan 1, 1980 11:59 PM'],
['Test Document.gdoc','--','Google document','Apr 10, 2013 4:20 PM'],
['Test Shared Document.gdoc','--','Google document','Mar 20, 2013 10:40 PM']
@@ -192,10 +194,10 @@ testcase.intermediate.galleryOpen = function(path) {
'iframe.overlay-pane'],
steps.shift());
},
- function(attributes) {
+ function(element) {
// Verify the gallery's screen image.
- chrome.test.assertEq('320', attributes['width']);
- chrome.test.assertEq('240', attributes['height']);
+ chrome.test.assertEq('320', element.attributes.width);
+ chrome.test.assertEq('240', element.attributes.height);
// Get the full-resolution image.
callRemoteTestUtil('waitForElement',
appId,
@@ -203,12 +205,145 @@ testcase.intermediate.galleryOpen = function(path) {
'iframe.overlay-pane'],
steps.shift());
},
- function(attributes) {
+ function(element) {
// Verify the gallery's screen image.
- chrome.test.assertEq('800', attributes['width']);
- chrome.test.assertEq('600', attributes['height']);
+ chrome.test.assertEq('800', element.attributes.width);
+ chrome.test.assertEq('600', element.attributes.height);
chrome.test.succeed();
+ }
+ ];
+ steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
+ steps.shift()();
+};
+
+/**
+ * Tests if the audio player shows up for the selected image and that the audio
+ * is loaded successfully.
+ *
+ * @param {string} path Directory path to be tested.
+ */
+testcase.intermediate.audioOpen = function(path) {
+ var appId;
+ var audioAppId;
+ var steps = [
+ function() {
+ setupAndWaitUntilReady(path, steps.shift());
+ },
+ function(inAppId) {
+ appId = inAppId;
+ // Select the song.
+ callRemoteTestUtil(
+ 'selectFile', appId, ['Beautiful Song.ogg'], steps.shift());
+ },
+ function(result) {
+ chrome.test.assertTrue(result);
+ // Click on the label to enter the audio player.
+ callRemoteTestUtil(
+ 'fakeMouseClick',
+ appId,
+ ['#file-list li.table-row[selected] .filename-label span'],
+ steps.shift());
+ },
+ function(result) {
+ chrome.test.assertTrue(result);
+ // Wait for the audio player.
+ callRemoteTestUtil('waitForWindow',
+ null,
+ ['mediaplayer.html'],
+ steps.shift());
+ },
+ function(inAppId) {
+ audioAppId = inAppId;
+ // Wait for the audio tag and verify the source.
+ callRemoteTestUtil('waitForElement',
+ audioAppId,
+ ['audio[src]'],
+ steps.shift());
+ },
+ function(element) {
+ chrome.test.assertEq(
+ 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+ 'external' + path + '/Beautiful%20Song.ogg',
+ element.attributes.src);
+ // Get the title tag.
+ callRemoteTestUtil('waitForElement',
+ audioAppId,
+ ['.data-title'],
+ steps.shift());
+ },
+ function(element) {
+ chrome.test.assertEq('Beautiful Song', element.text);
+ // Get the artist tag.
+ callRemoteTestUtil('waitForElement',
+ audioAppId,
+ ['.data-artist'],
+ steps.shift());
+ },
+ function(element) {
+ chrome.test.assertEq('Unknown Artist', element.text);
+ chrome.test.succeed();
+ }
+ ];
+ steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
+ steps.shift()();
+};
+
+/**
+ * Tests if the video player shows up for the selected movie and that it is
+ * loaded successfully.
+ *
+ * @param {string} path Directory path to be tested.
+ */
+testcase.intermediate.videoOpen = function(path) {
+ var appId;
+ var videoAppId;
+ var steps = [
+ function() {
+ setupAndWaitUntilReady(path, steps.shift());
+ },
+ function(inAppId) {
+ appId = inAppId;
+ // Select the song.
+ callRemoteTestUtil(
+ 'selectFile', appId, ['world.ogv'], steps.shift());
+ },
+ function(result) {
+ chrome.test.assertTrue(result);
+ // Click on the label to enter the video player.
+ callRemoteTestUtil(
+ 'fakeMouseClick',
+ appId,
+ ['#file-list li.table-row[selected] .filename-label span'],
+ steps.shift());
},
+ function(result) {
+ chrome.test.assertTrue(result);
+ // Wait for the video player.
+ callRemoteTestUtil('waitForWindow',
+ null,
+ ['video_player.html'],
+ steps.shift());
+ },
+ function(appId) {
hirono 2013/05/28 07:59:46 Please use 'inAppId'.
mtomasz 2013/05/28 10:26:38 Done.
+ videoAppId = appId;
+ // Wait for the video tag and verify the source.
+ callRemoteTestUtil('waitForElement',
+ videoAppId,
+ ['video[src]'],
+ steps.shift());
+ },
+ function(element) {
+ chrome.test.assertEq(
+ 'filesystem:chrome-extension://hhaomjibdihmijegdhdafkllkbggdgoj/' +
+ 'external' + path + '/world.ogv',
+ element.attributes.src);
+ // Wait for the window's inner dimensions. Should be changed to the video
+ // size once the metadata is loaded.
+ callRemoteTestUtil('waitForWindowGeometry',
+ videoAppId,
+ [320, 192],
+ 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
+ }
];
steps = steps.map(function(f) { return chrome.test.callbackPass(f); });
steps.shift()();
@@ -260,6 +395,14 @@ testcase.galleryOpenDownloads = function() {
testcase.intermediate.galleryOpen('/Downloads');
};
+testcase.audioOpenDownloads = function() {
+ testcase.intermediate.audioOpen('/Downloads');
+};
+
+testcase.videoOpenDownloads = function() {
+ testcase.intermediate.videoOpen('/Downloads');
+};
+
testcase.keyboardCopyDownloads = function() {
testcase.intermediate.keyboardCopy('/Downloads');
};
@@ -276,6 +419,14 @@ testcase.galleryOpenDrive = function() {
testcase.intermediate.galleryOpen('/drive/root');
};
+testcase.audioOpenDrive = function() {
+ testcase.intermediate.audioOpen('/drive/root');
+};
+
+testcase.videoOpenDrive = function() {
+ testcase.intermediate.videoOpen('/drive/root');
+};
+
testcase.keyboardCopyDrive = function() {
testcase.intermediate.keyboardCopy('/drive/root');
};

Powered by Google App Engine
This is Rietveld 408576698