Commit 2a40daee authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Files.app: Fix the flakyness in CreateNewFolderTest and re-enable it

BUG=377636
TEST=manually test

Review URL: https://codereview.chromium.org/332973004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278665 0039d316-1c4b-4281-b951-d872f2087c98
parent 7aa1fd97
...@@ -820,9 +820,14 @@ WRAPPED_INSTANTIATE_TEST_CASE_P( ...@@ -820,9 +820,14 @@ WRAPPED_INSTANTIATE_TEST_CASE_P(
TestParameter(NOT_IN_GUEST_MODE, "audioRepeatMultipleFileDrive"), TestParameter(NOT_IN_GUEST_MODE, "audioRepeatMultipleFileDrive"),
TestParameter(NOT_IN_GUEST_MODE, "audioNoRepeatMultipleFileDrive"))); TestParameter(NOT_IN_GUEST_MODE, "audioNoRepeatMultipleFileDrive")));
// Disabled due to frequent failure: http://crbug.com/377636 // Slow tests are disabled on debug build. http://crbug.com/327719
#if !defined(NDEBUG)
#define MAYBE_CreateNewFolder DISABLED_CreateNewFolder
#else
#define MAYBE_CreateNewFolder CreateNewFolder
#endif
INSTANTIATE_TEST_CASE_P( INSTANTIATE_TEST_CASE_P(
DISABLED_CreateNewFolder, MAYBE_CreateNewFolder,
FileManagerBrowserTest, FileManagerBrowserTest,
::testing::Values(TestParameter(NOT_IN_GUEST_MODE, ::testing::Values(TestParameter(NOT_IN_GUEST_MODE,
"createNewFolderAfterSelectFile"), "createNewFolderAfterSelectFile"),
......
...@@ -43,7 +43,6 @@ function selectFirstListItem(windowId) { ...@@ -43,7 +43,6 @@ function selectFirstListItem(windowId) {
* @return {Promise} Promise to be fulfilled on success. * @return {Promise} Promise to be fulfilled on success.
*/ */
function createNewFolder(windowId, path, initialEntrySet) { function createNewFolder(windowId, path, initialEntrySet) {
var newFoloderListItemId = null;
return Promise.resolve( return Promise.resolve(
).then(function() { ).then(function() {
// Push Ctrl + E. // Push Ctrl + E.
...@@ -63,7 +62,6 @@ function createNewFolder(windowId, path, initialEntrySet) { ...@@ -63,7 +62,6 @@ function createNewFolder(windowId, path, initialEntrySet) {
// Ensure that only the new directory is selected and being renamed. // Ensure that only the new directory is selected and being renamed.
chrome.test.assertEq(1, elements.length); chrome.test.assertEq(1, elements.length);
chrome.test.assertTrue('renaming' in elements[0].attributes); chrome.test.assertTrue('renaming' in elements[0].attributes);
newFoloderListItemId = elements[0].attributes['id'];
}).then(function() { }).then(function() {
// Type new folder name. // Type new folder name.
return callRemoteTestUtil( return callRemoteTestUtil(
...@@ -85,18 +83,26 @@ function createNewFolder(windowId, path, initialEntrySet) { ...@@ -85,18 +83,26 @@ function createNewFolder(windowId, path, initialEntrySet) {
{ignoreLastModifiedTime: true}); {ignoreLastModifiedTime: true});
}).then(function() { }).then(function() {
// Wait until the new created folder is selected. // Wait until the new created folder is selected.
return waitForElement( var nameSpanQuery = 'div.detail-table > list > ' +
windowId, 'li[selected]:not([renaming]) span.entry-name';
'div.detail-table > list > li[selected]#' + newFoloderListItemId);
}).then(function() { return repeatUntil(function() {
// Ensure that the created directory is the only one selected directory. var selectedNameRetrievePromise = callRemoteTestUtil(
return callRemoteTestUtil( 'queryAllElements',
'queryAllElements', windowId,
windowId, ['div.detail-table > list > li[selected] span.entry-name']);
['div.detail-table > list > li[selected]']);
}).then(function(elements) { return selectedNameRetrievePromise.then(function(elements) {
chrome.test.assertEq(1, elements.length); if (elements.length !== 1) {
chrome.test.assertEq(newFoloderListItemId, elements[0].attributes['id']); return pending('Selection is not ready (elements: %j)', elements);
} else if (elements[0].text !== 'Test Folder Name') {
return pending('Selected item is wrong. (actual: %s)',
elements[0].text);
} else {
return true;
}
});
});
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment