mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 869123: Fix testShareLink to support submenu in 14+. [r=mfinkle]
--HG-- extra : rebase_source : 5291de20acb1e4c4500b8ef26eaf1a6816f3647f
This commit is contained in:
parent
5bbd465bbe
commit
8daebcf929
@ -11,6 +11,7 @@ import android.view.ViewGroup;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import android.app.Activity;
|
||||
import android.os.Build;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
/**
|
||||
@ -34,11 +35,16 @@ public class testShareLink extends BaseTest {
|
||||
loadUrl(url);
|
||||
waitForText("Big Link"); // Waiting for page title to ensure the page is loaded
|
||||
selectMenuItem("Share");
|
||||
waitForText("Share via");
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
// Check for our own sync in the submenu.
|
||||
waitForText("Sync$");
|
||||
} else {
|
||||
waitForText("Share via");
|
||||
}
|
||||
|
||||
// Get list of current avaliable share activities and verify them
|
||||
shareOptions = getShareOptions();
|
||||
ArrayList<String> displayedOptions = getSharePopupOption();
|
||||
ArrayList<String> displayedOptions = getShareOptionsList();
|
||||
for (String option:shareOptions) {
|
||||
// Verify if the option is present in the list of displayed share options
|
||||
mAsserter.ok(optionDisplayed(option, displayedOptions), "Share option found", option);
|
||||
@ -147,6 +153,26 @@ public class testShareLink extends BaseTest {
|
||||
return displayedOptions;
|
||||
}
|
||||
|
||||
public ArrayList<String> getShareSubMenuOption() {
|
||||
ArrayList<String> displayedOptions = new ArrayList();
|
||||
ListView shareMenu = getDisplayedShareList();
|
||||
for (int i = 0; i < shareMenu.getAdapter().getCount();i++) {
|
||||
View shareItem = shareMenu.getAdapter().getView(i, null, null);
|
||||
if (shareItem instanceof android.widget.TextView) {
|
||||
displayedOptions.add(((android.widget.TextView)shareItem).getText().toString());
|
||||
}
|
||||
}
|
||||
return displayedOptions;
|
||||
}
|
||||
|
||||
public ArrayList<String> getShareOptionsList() {
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
return getShareSubMenuOption();
|
||||
} else {
|
||||
return getSharePopupOption();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean optionDisplayed(String shareOption, ArrayList<String> displayedOptions) {
|
||||
for (String displayedOption: displayedOptions) {
|
||||
if (shareOption.equals(displayedOption)) {
|
||||
|
Loading…
Reference in New Issue
Block a user