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

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

Issue 13450004: drive: Make FileManagerBrowserTest more robust (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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 | « no previous file | 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/background.js
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
index 6e5c689844b980b08423e465b868a7ef1f634c71..dc0f5337d98523afa02d0a762e06d5363e3f2e9f 100644
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
@@ -84,44 +84,61 @@ function waitAndAcceptDialog(callback) {
// Checks that the files initially added by the C++ side are displayed, and
// that a subsequently added file shows up.
function testFileDisplay() {
- getFileList(function(actualFilesBefore) {
- chrome.test.assertEq(EXPECTED_FILES_BEFORE, actualFilesBefore);
- chrome.test.sendMessage('initial check done', function(reply) {
- chrome.test.assertEq('file added', reply);
- waitForFileListChange(
+ waitForFileListChange(
+ 0,
+ function(actualFilesBefore) {
+ chrome.test.assertEq(EXPECTED_FILES_BEFORE, actualFilesBefore);
+ chrome.test.sendMessage('initial check done', function(reply) {
+ chrome.test.assertEq('file added', reply);
+ waitForFileListChange(
EXPECTED_FILES_BEFORE.length,
chrome.test.callbackPass(function(actualFilesAfter) {
chrome.test.assertEq(EXPECTED_FILES_AFTER, actualFilesAfter);
}));
+ });
});
- });
}
// Injects the keyboard test code into the file manager tab and runs the
// keyboard delete test.
function doKeyboardTestWithConfirmation(code) {
- chrome.tabs.executeScript(null, {file: 'fake_keypress.js'}, function(result) {
- chrome.tabs.executeScript(null, {code: code}, function(result) {
- chrome.test.assertFalse(!result[0]);
- waitAndAcceptDialog(function() {
- // Succeed here if anything happens; the C++ code checks what happened.
- waitForFileListChange(EXPECTED_FILES_BEFORE.length,
- chrome.test.succeed);
+ // Wait until the file list is rendered.
+ waitForFileListChange(
+ 0,
+ function(unused) {
+ // Once the file list is rendered, start the keyboard test.
+ chrome.tabs.executeScript(
+ null, {file: 'fake_keypress.js'}, function(result) {
+ chrome.tabs.executeScript(null, {code: code}, function(result) {
+ chrome.test.assertFalse(!result[0]);
+ waitAndAcceptDialog(function() {
+ // Succeed here if anything happens; the C++ code checks what
+ // happened.
+ waitForFileListChange(EXPECTED_FILES_BEFORE.length,
+ chrome.test.succeed);
+ });
+ });
});
});
- });
}
// Injects the keyboard test code into the file manager tab and runs the
// keyboard copy test.
function doKeyboardTest(code) {
- chrome.tabs.executeScript(null, {file: 'fake_keypress.js'}, function(result) {
- chrome.tabs.executeScript(null, {code: code}, function(result) {
- chrome.test.assertFalse(!result[0]);
- // Succeed here if anything happens; the C++ code checks what happened.
- waitForFileListChange(EXPECTED_FILES_BEFORE.length, chrome.test.succeed);
+ waitForFileListChange(
+ 0,
+ function(unused) {
+ chrome.tabs.executeScript(
+ null, {file: 'fake_keypress.js'}, function(result) {
+ chrome.tabs.executeScript(null, {code: code}, function(result) {
+ chrome.test.assertFalse(!result[0]);
+ // Succeed here if anything happens; the C++ code checks what
+ // happened.
+ waitForFileListChange(EXPECTED_FILES_BEFORE.length,
+ chrome.test.succeed);
+ });
+ });
});
- });
}
chrome.test.runTests([
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698