Commit b55e2595 authored by Alex Lau's avatar Alex Lau Committed by Commit Bot

Cleanup Files app gear menu integration tests.

Add missing assertions after callRemoteTestUtil invocations.

LOG(FATAL) instead of assertion when trying to add entries to a
non-existant Android Files test volume. Also remove unnecessary
AndroidFilesTestVolume.Initialize() call.

Bug: 877371
Change-Id: I925ad37a056e411eb3a5bd833cad59a5ce11fae3
Reviewed-on: https://chromium-review.googlesource.com/1218664Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Alex Lau <alexlau@chromium.org>
Cr-Commit-Position: refs/heads/master@{#590232}
parent 9a4538ad
......@@ -501,8 +501,6 @@ class AndroidFilesTestVolume : public LocalTestVolume {
AndroidFilesTestVolume() : LocalTestVolume("AndroidFiles") {}
~AndroidFilesTestVolume() override = default;
bool Initialize(Profile* profile) { return CreateRootDirectory(profile); }
bool Mount(Profile* profile) override {
return CreateRootDirectory(profile) &&
VolumeManager::Get(profile)->RegisterAndroidFilesDirectoryForTesting(
......@@ -1269,9 +1267,11 @@ void FileManagerBrowserTestBase::OnCommand(const std::string& name,
}
break;
case AddEntriesMessage::ANDROID_FILES_VOLUME:
CHECK(android_files_volume_);
ASSERT_TRUE(android_files_volume_->Initialize(profile()));
android_files_volume_->CreateEntry(*message.entries[i]);
if (android_files_volume_) {
android_files_volume_->CreateEntry(*message.entries[i]);
} else {
LOG(FATAL) << "Add entry: but no Android files volume.";
}
break;
}
}
......
......@@ -129,7 +129,7 @@ std::string GetDownloadsMountPointName(Profile* profile) {
return net::EscapeQueryParamValue(kDownloadsFolderName + id, false);
}
std::string GetAndroidFilesMountPointName() {
const std::string GetAndroidFilesMountPointName() {
return kAndroidFilesMountPointName;
}
......
......@@ -47,7 +47,7 @@ bool MigratePathFromOldFormat(Profile* profile,
std::string GetDownloadsMountPointName(Profile* profile);
// The canonical mount point name for ARC "Play files" folder.
std::string GetAndroidFilesMountPointName();
const std::string GetAndroidFilesMountPointName();
// The canonical mount point name for crostini "Linux files" folder.
std::string GetCrostiniMountPointName(Profile* profile);
......
......@@ -951,10 +951,11 @@ void VolumeManager::OnArcPlayStoreEnabledChanged(bool enabled) {
Volume::CreateForMediaView(arc::kVideosRootDocumentId));
DoMountEvent(chromeos::MOUNT_ERROR_NONE,
Volume::CreateForMediaView(arc::kAudioRootDocumentId));
if (IsShowAndroidFilesEnabled())
if (IsShowAndroidFilesEnabled()) {
DoMountEvent(chromeos::MOUNT_ERROR_NONE,
Volume::CreateForAndroidFiles(
base::FilePath(util::kAndroidFilesPath)));
}
} else {
DoUnmountEvent(chromeos::MOUNT_ERROR_NONE,
*Volume::CreateForMediaView(arc::kImagesRootDocumentId));
......
......@@ -301,12 +301,13 @@ testcase.toogleGoogleDocsDrive = function() {
remoteCall.waitForElement(appId,
'#gear-menu-drive-hosted-settings:not([disabled])').then(this.next);
},
function(results) {
function(result) {
remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#gear-menu-drive-hosted-settings'],
this.next);
},
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForFiles(appId, TestEntryInfo.getExpectedRows(
BASIC_DRIVE_ENTRY_SET), {ignoreFileSize: true,
ignoreLastModifiedTime: true}).then(this.next);
......@@ -369,7 +370,8 @@ testcase.showToggleHiddenAndroidFoldersGearMenuItemsInMyFiles = function() {
'fakeMouseClick', appId, ['#file-list'], this.next);
},
// Wait for the gear menu to hide.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#gear-menu[hidden]').then(this.next);
},
// Navigate to Recent.
......@@ -379,7 +381,8 @@ testcase.showToggleHiddenAndroidFoldersGearMenuItemsInMyFiles = function() {
this.next);
},
// Click the gear menu button.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#gear-button'], this.next);
},
......@@ -493,7 +496,8 @@ testcase.showPasteIntoCurrentFolder = function() {
remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#file-list'], this.next);
},
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#gear-menu[hidden]').then(this.next);
},
......@@ -509,7 +513,8 @@ testcase.showPasteIntoCurrentFolder = function() {
},
// Wait for menu to appear.
// The command is still shown.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall
.waitForElement(
appId,
......@@ -522,7 +527,8 @@ testcase.showPasteIntoCurrentFolder = function() {
remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#file-list'], this.next);
},
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#gear-menu[hidden]').then(this.next);
},
......@@ -532,7 +538,8 @@ testcase.showPasteIntoCurrentFolder = function() {
'selectFile', appId, [ENTRIES.hello.nameText], this.next);
},
// Ctrl-C to copy the selected file
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall
.fakeKeyDown(appId, '#file-list', 'c', 'U+0043', true, false, false)
.then(this.next);
......@@ -542,7 +549,8 @@ testcase.showPasteIntoCurrentFolder = function() {
'fakeMouseClick', appId, ['#gear-button'], this.next);
},
// The command appears enabled.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall
.waitForElement(
appId,
......@@ -555,7 +563,8 @@ testcase.showPasteIntoCurrentFolder = function() {
remoteCall.callRemoteTestUtil(
'fakeMouseClick', appId, ['#file-list'], this.next);
},
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#gear-menu[hidden]').then(this.next);
},
function() {
......@@ -589,7 +598,8 @@ testcase.showSelectAllInCurrentFolder = function() {
'fakeMouseClick', appId, ['#gear-button'], this.next);
},
// Wait for the gear menu to appear.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#gear-menu:not([hidden])')
.then(this.next);
},
......@@ -609,7 +619,8 @@ testcase.showSelectAllInCurrentFolder = function() {
'fakeMouseClick', appId, ['#file-list'], this.next);
},
// Wait for the gear menu to hide.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#gear-menu[hidden]').then(this.next);
},
// Add a new file to Downloads.
......@@ -644,7 +655,8 @@ testcase.showSelectAllInCurrentFolder = function() {
'fakeMouseClick', appId, ['#gear-menu-select-all'], this.next);
},
// Check: the file-list should be selected.
function() {
function(result) {
chrome.test.assertTrue(result);
remoteCall.waitForElement(appId, '#file-list li[selected]')
.then(this.next);
},
......
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