Bug 1121651 - Remove static StringHelper.get references in UITest framework.r=mcomella

--HG--
extra : rebase_source : bd7330bd66a462aa78cb3f50903d779b16233e48
This commit is contained in:
darrenjl 2015-04-30 12:37:33 +10:00
parent 65a519d3e4
commit aae36aaed4
4 changed files with 12 additions and 3 deletions

View File

@ -123,6 +123,11 @@ abstract class UITest extends BaseRobocopTest
return mActions;
}
@Override
public StringHelper getStringHelper() {
return mStringHelper;
}
@Override
public void dumpLog(final String logtag, final String message) {
mAsserter.dumpLog(logtag + ": " + message);

View File

@ -32,6 +32,7 @@ public interface UITestContext {
public Driver getDriver();
public Actions getActions();
public Instrumentation getInstrumentation();
public StringHelper getStringHelper();
public void dumpLog(final String logtag, final String message);
public void dumpLog(final String logtag, final String message, final Throwable t);

View File

@ -5,6 +5,7 @@
package org.mozilla.gecko.tests.components;
import org.mozilla.gecko.Actions;
import org.mozilla.gecko.tests.StringHelper;
import org.mozilla.gecko.tests.UITestContext;
import android.app.Activity;
@ -23,11 +24,13 @@ public abstract class BaseComponent {
protected final Activity mActivity;
protected final Solo mSolo;
protected final Actions mActions;
protected final StringHelper mStringHelper;
public BaseComponent(final UITestContext testContext) {
mTestContext = testContext;
mActivity = mTestContext.getActivity();
mSolo = mTestContext.getSolo();
mActions = mTestContext.getActions();
mStringHelper = mTestContext.getStringHelper();
}
}

View File

@ -56,8 +56,8 @@ public class ToolbarComponent extends BaseComponent {
final String expected;
final String absoluteURL = NavigationHelper.adjustUrl(url);
if (StringHelper.get().ABOUT_HOME_URL.equals(absoluteURL)) {
expected = StringHelper.get().ABOUT_HOME_TITLE;
if (mStringHelper.ABOUT_HOME_URL.equals(absoluteURL)) {
expected = mStringHelper.ABOUT_HOME_TITLE;
} else if (absoluteURL.startsWith(URL_HTTP_PREFIX)) {
expected = absoluteURL.substring(URL_HTTP_PREFIX.length());
} else {
@ -134,7 +134,7 @@ public class ToolbarComponent extends BaseComponent {
for (int i = 0; i < count; i++) {
final View view = pageActionLayout.getChildAt(i);
if (StringHelper.get().CONTENT_DESCRIPTION_READER_MODE_BUTTON.equals(view.getContentDescription())) {
if (mStringHelper.CONTENT_DESCRIPTION_READER_MODE_BUTTON.equals(view.getContentDescription())) {
return (ImageButton) view;
}
}