Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ protected void setUp() throws Exception {
// Set up Robotium.solo and Driver objects
Activity tempActivity = getActivity();

StringHelper.initialize(tempActivity.getResources());
mStringHelper = StringHelper.get();
mStringHelper = StringHelper.initialize(tempActivity.getResources());

mSolo = new Solo(getInstrumentation(), tempActivity);
mDriver = new FennecNativeDriver(tempActivity, mSolo, mRootPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,12 @@ private StringHelper(final Resources res) {
DONT_RESTORE_QUIT = res.getString(R.string.pref_restore_quit);
}

public static void initialize(Resources res) {
public static StringHelper initialize(Resources res) {
if (instance != null) {
throw new IllegalStateException(StringHelper.class.getSimpleName() + " already Initialized");
}
instance = new StringHelper(res);
}

public static StringHelper get() {
if (instance == null) {
throw new IllegalStateException(StringHelper.class.getSimpleName() + " instance is not yet initialized. Use StringHelper.initialize(Resources) first.");
}
instance = new StringHelper(res);
return instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ private GeckoClickHelper() { /* To disallow instantiation. */ }
* The link should be positioned at the top of the page, at least 60px high and
* aligned to the middle.
*/
public static void openCentralizedLinkInNewTab() {
public static void openCentralizedLinkInNewTab(StringHelper stringHelper) {
openLinkContextMenu();

// Click on "Open Link in New Tab"
sSolo.clickOnText(StringHelper.get().CONTEXT_MENU_ITEMS_IN_NORMAL_TAB[0]);
sSolo.clickOnText(stringHelper.CONTEXT_MENU_ITEMS_IN_NORMAL_TAB[0]);
}

private static void openLinkContextMenu() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void testStateWhileLoading() {

NavigationHelper.enterAndLoadUrl(mStringHelper.ROBOCOP_LINK_TO_SLOW_LOADING);

GeckoClickHelper.openCentralizedLinkInNewTab();
GeckoClickHelper.openCentralizedLinkInNewTab(mStringHelper);

WaitHelper.waitForPageLoad(new Runnable() {
@Override
Expand Down