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

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/test_cases.js

Issue 14241010: Checks for Javascript errors in Files.app's tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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
« no previous file with comments | « chrome/browser/resources/file_manager/js/test_util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 747f41a5b153962f66955c24c1e2096d1ccb572b..30e331d84c139b86a510f1bd4d405e26c2d93c8e 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
@@ -64,8 +64,20 @@ function setupAndWaitUntilReady(path, callback) {
}
/**
+ * Verifies if there are no Javascript errors in any of the app windows.
+ * @param {function()} Completion callback.
+ */
+function checkIfNoErrorsOccured(callback) {
+ callRemoteTestUtil('getErrorCount', null, [], function(count) {
+ chrome.test.assertEq(0, count);
+ callback();
+ });
+}
+
+/**
* Expected files shown in "Recent". Directories (e.g. 'photos') are not in this
* list as they are not expected in "Recent".
+ *
* @type {Array.<Array.<string>>}
* @const
*/
@@ -115,10 +127,10 @@ testcase.intermediate.fileDisplay = function(path) {
callRemoteTestUtil(
'waitForFileListChange',
appId,
- [expectedFilesBefore.length],
- chrome.test.callbackPass(function(actualFilesAfter) {
+ [expectedFilesBefore.length], function(actualFilesAfter) {
chrome.test.assertEq(expectedFilesAfter, actualFilesAfter);
- }));
+ checkIfNoErrorsOccured(chrome.test.succeed);
+ });
});
});
};
@@ -129,14 +141,15 @@ testcase.intermediate.fileDisplay = function(path) {
*
* @param {string} path Directory path to be tested.
*/
-testcase.intermediate.keyboardCopy = function(path) {
+testcase.intermediate.keyboardCopy = function(path, callback) {
setupAndWaitUntilReady(path, function(appId) {
callRemoteTestUtil('copyFile', appId, ['world.mpeg'], function(result) {
chrome.test.assertFalse(!result);
callRemoteTestUtil('waitForFileListChange',
appId,
[getExpectedFilesBefore(path == '/drive/root').length],
- chrome.test.succeed);
+ checkIfNoErrorsOccured.bind(null,
+ chrome.test.succeed));
});
});
};
@@ -154,7 +167,7 @@ testcase.intermediate.keyboardDelete = function(path) {
'waitForFileListChange',
appId,
[getExpectedFilesBefore(path == '/drive/root').length],
- chrome.test.succeed);
+ checkIfNoErrorsOccured.bind(null, chrome.test.succeed));
});
});
});
@@ -191,9 +204,10 @@ testcase.keyboardDeleteDrive = function() {
* Drive.
*/
testcase.openSidebarRecent = function() {
- var onFileListChange = chrome.test.callbackPass(function(actualFilesAfter) {
+ var onFileListChange = function(actualFilesAfter) {
chrome.test.assertEq(EXPECTED_FILES_IN_RECENT, actualFilesAfter);
- });
+ checkIfNoErrorsOccured(chrome.test.succeed);
+ };
setupAndWaitUntilReady('/drive/root', function(appId) {
// Use the icon for a click target.
@@ -217,9 +231,10 @@ testcase.openSidebarRecent = function() {
* entries cached by DriveCache.
*/
testcase.openSidebarOffline = function() {
- var onFileListChange = chrome.test.callbackPass(function(actualFilesAfter) {
+ var onFileListChange = function(actualFilesAfter) {
chrome.test.assertEq(EXPECTED_FILES_IN_OFFLINE, actualFilesAfter);
- });
+ checkIfNoErrorsOccured(chrome.test.succeed);
+ };
setupAndWaitUntilReady('/drive/root/', function(appId) {
// Use the icon for a click target.
@@ -246,10 +261,10 @@ testcase.autocomplete = function() {
'hello.txt\n',
];
- var onAutocompleteListShown = chrome.test.callbackPass(
- function(autocompleteList) {
- chrome.test.assertEq(EXPECTED_AUTOCOMPLETE_LIST, autocompleteList);
- });
+ var onAutocompleteListShown = function(autocompleteList) {
+ chrome.test.assertEq(EXPECTED_AUTOCOMPLETE_LIST, autocompleteList);
+ checkIfNoErrorsOccured(chrome.test.succeed);
+ };
setupAndWaitUntilReady('/drive/root', function(appId, list) {
callRemoteTestUtil('performAutocompleteAndWait',
« no previous file with comments | « chrome/browser/resources/file_manager/js/test_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698