summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/file_manager/integration_tests/audio_player/background.js30
-rw-r--r--ui/file_manager/integration_tests/file_manager/background.js16
-rw-r--r--ui/file_manager/integration_tests/gallery/background.js29
-rw-r--r--ui/file_manager/integration_tests/test_util.js30
-rw-r--r--ui/file_manager/integration_tests/video_player/background.js30
5 files changed, 37 insertions, 98 deletions
diff --git a/ui/file_manager/integration_tests/audio_player/background.js b/ui/file_manager/integration_tests/audio_player/background.js
index 757bbf3..4c101c6 100644
--- a/ui/file_manager/integration_tests/audio_player/background.js
+++ b/ui/file_manager/integration_tests/audio_player/background.js
@@ -52,34 +52,6 @@ function launch(testVolumeName, volumeType, entries, opt_selected) {
}
/**
- * Verifies if there are no Javascript errors in any of the app windows.
- * @param {function()} Completion callback.
- */
-function checkIfNoErrorsOccured(callback) {
- var countPromise = remoteCallAudioPlayer.callRemoteTestUtil(
- 'getErrorCount', null, []);
- countPromise.then(function(count) {
- chrome.test.assertEq(0, count, 'The error count is not 0.');
- callback();
- });
-}
-
-/**
- * Adds check of chrome.test to the end of the given promise.
- * @param {Promise} promise Promise.
- */
-function testPromise(promise) {
- promise.then(function() {
- return new Promise(checkIfNoErrorsOccured);
- }).then(chrome.test.callbackPass(function() {
- // The callbacPass is necessary to avoid prematurely finishing tests.
- // Don't put chrome.test.succeed() here to avoid doubled success log.
- }), function(error) {
- chrome.test.fail(error.stack || error);
- });
-};
-
-/**
* Namespace for test cases.
*/
var testcase = {};
@@ -117,7 +89,7 @@ window.addEventListener('load', function() {
// Specify the name of test to the test system.
targetTest.generatedName = testCaseName;
chrome.test.runTests([function() {
- return testPromise(targetTest());
+ return testPromiseAndApps(targetTest(), [remoteCallAudioPlayer]);
}]);
}
];
diff --git a/ui/file_manager/integration_tests/file_manager/background.js b/ui/file_manager/integration_tests/file_manager/background.js
index 8448bd8..bbbafce 100644
--- a/ui/file_manager/integration_tests/file_manager/background.js
+++ b/ui/file_manager/integration_tests/file_manager/background.js
@@ -45,14 +45,9 @@ var videoPlayerApp = new RemoteCall(VIDEO_PLAYER_APP_ID);
* @param {Promise} promise Promise.
*/
function testPromise(promise) {
- promise.then(function() {
- return new Promise(checkIfNoErrorsOccured);
- }).then(chrome.test.callbackPass(function() {
- // The callbacPass is necessary to avoid prematurely finishing tests.
- // Don't put chrome.test.succeed() here to avoid doubled success log.
- }), function(error) {
- chrome.test.fail(error.stack || error);
- });
+ return testPromiseAndApps(
+ promise,
+ [remoteCall, galleryApp, audioPlayerApp, videoPlayerApp]);
};
/**
@@ -338,10 +333,7 @@ function setupAndWaitUntilReady(appState, initialRoot, opt_callback) {
* @param {function()} Completion callback.
*/
function checkIfNoErrorsOccured(callback) {
- remoteCall.callRemoteTestUtil('getErrorCount', null, [], function(count) {
- chrome.test.assertEq(0, count, 'The error count is not 0.');
- callback();
- });
+ checkIfNoErrorsOccuredOnApp(remoteCall, callback);
}
/**
diff --git a/ui/file_manager/integration_tests/gallery/background.js b/ui/file_manager/integration_tests/gallery/background.js
index f507799..ffaba3d 100644
--- a/ui/file_manager/integration_tests/gallery/background.js
+++ b/ui/file_manager/integration_tests/gallery/background.js
@@ -54,33 +54,6 @@ function launch(testVolumeName, volumeType, entries, opt_selected) {
}
/**
- * Verifies if there are no Javascript errors in any of the app windows.
- * @param {function()} Completion callback.
- */
-function checkIfNoErrorsOccured(callback) {
- var countPromise = gallery.callRemoteTestUtil('getErrorCount', null, []);
- countPromise.then(function(count) {
- chrome.test.assertEq(0, count, 'The error count is not 0.');
- callback();
- });
-}
-
-/**
- * Adds check of chrome.test to the end of the given promise.
- * @param {Promise} promise Promise.
- */
-function testPromise(promise) {
- promise.then(function() {
- return new Promise(checkIfNoErrorsOccured);
- }).then(chrome.test.callbackPass(function() {
- // The callbacPass is necessary to avoid prematurely finishing tests.
- // Don't put chrome.test.succeed() here to avoid doubled success log.
- }), function(error) {
- chrome.test.fail(error.stack || error);
- });
-};
-
-/**
* Namespace for test cases.
*/
var testcase = {};
@@ -118,7 +91,7 @@ window.addEventListener('load', function() {
// Specify the name of test to the test system.
targetTest.generatedName = testCaseName;
chrome.test.runTests([function() {
- return testPromise(targetTest());
+ return testPromiseAndApps(targetTest(), [gallery]);
}]);
}
];
diff --git a/ui/file_manager/integration_tests/test_util.js b/ui/file_manager/integration_tests/test_util.js
index 2b586a6..2db86ff 100644
--- a/ui/file_manager/integration_tests/test_util.js
+++ b/ui/file_manager/integration_tests/test_util.js
@@ -27,6 +27,36 @@ function wait(time) {
}
/**
+ * Verifies if there are no Javascript errors in any of the app windows.
+ * @param {function()} Completion callback.
+ */
+function checkIfNoErrorsOccuredOnApp(app, callback) {
+ var countPromise = app.callRemoteTestUtil('getErrorCount', null, []);
+ countPromise.then(function(count) {
+ chrome.test.assertEq(0, count, 'The error count is not 0.');
+ callback();
+ });
+}
+
+/**
+ * Adds check of chrome.test to the end of the given promise.
+ * @param {Promise} promise Promise.
+ */
+function testPromiseAndApps(promise, apps) {
+ promise.then(function() {
+ return Promise.all(
+ apps.map(function(app) {
+ return new Promise(checkIfNoErrorsOccuredOnApp.bind(null, app));
+ }));
+ }).then(chrome.test.callbackPass(function() {
+ // The callbacPass is necessary to avoid prematurely finishing tests.
+ // Don't put chrome.test.succeed() here to avoid doubled success log.
+ }), function(error) {
+ chrome.test.fail(error.stack || error);
+ });
+};
+
+/**
* Interval milliseconds between checks of repeatUntil.
* @type {number}
* @const
diff --git a/ui/file_manager/integration_tests/video_player/background.js b/ui/file_manager/integration_tests/video_player/background.js
index f1caec0..0a541b1 100644
--- a/ui/file_manager/integration_tests/video_player/background.js
+++ b/ui/file_manager/integration_tests/video_player/background.js
@@ -75,34 +75,6 @@ function openSingleVideo(volumeName, volumeType, entry) {
};
/**
- * Verifies if there are no Javascript errors in any of the app windows.
- * @param {function()} Completion callback.
- */
-function checkIfNoErrorsOccured(callback) {
- var countPromise = remoteCallVideoPlayer.callRemoteTestUtil(
- 'getErrorCount', null, []);
- countPromise.then(function(count) {
- chrome.test.assertEq(0, count, 'The error count is not 0.');
- callback();
- });
-}
-
-/**
- * Adds check of chrome.test to the end of the given promise.
- * @param {Promise} promise Promise.
- */
-function testPromise(promise) {
- promise.then(function() {
- return new Promise(checkIfNoErrorsOccured);
- }).then(chrome.test.callbackPass(function() {
- // The callbacPass is necessary to avoid prematurely finishing tests.
- // Don't put chrome.test.succeed() here to avoid doubled success log.
- }), function(error) {
- chrome.test.fail(error.stack || error);
- });
-};
-
-/**
* Namespace for test cases.
*/
var testcase = {};
@@ -140,7 +112,7 @@ window.addEventListener('load', function() {
// Specify the name of test to the test system.
targetTest.generatedName = testCaseName;
chrome.test.runTests([function() {
- return testPromise(targetTest());
+ return testPromiseAndApps(targetTest(), [remoteCallVideoPlayer]);
}]);
}
];