This source file includes following definitions.
- findButton
- hasPrimaryButton
- hasSecondaryButton
- clickCloseButton
- clickPrimaryButton
- clickSecondaryButton
package org.chromium.chrome.test.util;
import android.test.ActivityInstrumentationTestCase2;
import android.view.View;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.infobar.InfoBar;
import org.chromium.content.browser.test.util.TouchCommon;
public class InfoBarUtil {
private static boolean findButton(ActivityInstrumentationTestCase2<?> test,
InfoBar infoBar, int buttonId, boolean click) {
View button = infoBar.getContentWrapper().findViewById(buttonId);
if (button == null) return false;
if (click) new TouchCommon(test).singleClickView(button);
return true;
}
public static boolean hasPrimaryButton(ActivityInstrumentationTestCase2<?> test,
InfoBar infoBar) {
return findButton(test, infoBar, R.id.button_primary, false);
}
public static boolean hasSecondaryButton(ActivityInstrumentationTestCase2<?> test,
InfoBar infoBar) {
return findButton(test, infoBar, R.id.button_secondary, false);
}
public static boolean clickCloseButton(ActivityInstrumentationTestCase2<?> test,
InfoBar infoBar) {
return findButton(test, infoBar, R.id.infobar_close_button, true);
}
public static boolean clickPrimaryButton(ActivityInstrumentationTestCase2<?> test,
InfoBar infoBar) {
return findButton(test, infoBar, R.id.button_primary, true);
}
public static boolean clickSecondaryButton(ActivityInstrumentationTestCase2<?> test,
InfoBar infoBar) {
return findButton(test, infoBar, R.id.button_secondary, true);
}
}