Merge pull request #11346 from brave/android_wallet_tests
Adds tests coverage for Android wallet Utils
This commit is contained in:
@@ -227,7 +227,7 @@ public class TxFragment extends Fragment {
|
||||
if (!mIsEIP1559) {
|
||||
EditText gasLimitEdit = dialog.findViewById(R.id.gas_limit_edit);
|
||||
mTxInfo.txData.baseData.gasLimit =
|
||||
Utils.toHexWeiFromGWEI(gasLimitEdit.getText().toString());
|
||||
Utils.toHexGWeiFromGWEI(gasLimitEdit.getText().toString());
|
||||
EditText gasFeeEdit = dialog.findViewById(R.id.gas_fee_edit);
|
||||
mTxInfo.txData.baseData.gasPrice =
|
||||
Utils.toHexWei(gasFeeEdit.getText().toString(), 9);
|
||||
@@ -263,7 +263,7 @@ public class TxFragment extends Fragment {
|
||||
dialog.findViewById(R.id.per_gas_tip_limit_edit);
|
||||
EditText perGasPriceLimitEdit =
|
||||
dialog.findViewById(R.id.per_gas_price_limit_edit);
|
||||
gasLimit = Utils.toHexWeiFromGWEI(
|
||||
gasLimit = Utils.toHexGWeiFromGWEI(
|
||||
gasAmountLimitEdit.getText().toString());
|
||||
maxPriorityFeePerGas =
|
||||
Utils.toHexWei(perGasTipLimitEdit.getText().toString(), 9);
|
||||
@@ -327,7 +327,7 @@ public class TxFragment extends Fragment {
|
||||
if (gasAmountLimitEdit.hasFocus() || perGasTipLimitEdit.hasFocus()
|
||||
|| perGasPriceLimitEdit.hasFocus()) {
|
||||
fillMaxFee(mDialog.findViewById(R.id.maximum_fee_msg),
|
||||
Utils.toHexWeiFromGWEI(gasAmountLimitEdit.getText().toString()),
|
||||
Utils.toHexGWeiFromGWEI(gasAmountLimitEdit.getText().toString()),
|
||||
Utils.toHexWei(perGasPriceLimit, 9));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -388,7 +389,8 @@ public class Utils {
|
||||
return networkConst;
|
||||
}
|
||||
|
||||
private static String getDecimalsDepNumber(int decimals) {
|
||||
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
|
||||
public static String getDecimalsDepNumber(int decimals) {
|
||||
String strDecimals = "1";
|
||||
for (int i = 0; i < decimals; i++) {
|
||||
strDecimals += "0";
|
||||
@@ -489,7 +491,7 @@ public class Utils {
|
||||
return "0x" + res.toString(16);
|
||||
}
|
||||
|
||||
public static String toHexWeiFromGWEI(String number) {
|
||||
public static String toHexGWeiFromGWEI(String number) {
|
||||
try {
|
||||
if (number.isEmpty()) {
|
||||
return "0x0";
|
||||
|
||||
Reference in New Issue
Block a user