Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java

Issue 1843483002: Add test code for UsbChooserDialog.java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address newt@'s comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java_sources.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java
index a291c51f6b7bc840b7fbe3f7d68b9747249a3cba..6293113edb52aeb5c84a5d8dd548c7152f08245f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/UsbChooserDialog.java
@@ -9,6 +9,7 @@ import android.text.SpannableString;
import android.text.TextUtils;
import android.view.View;
+import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.omnibox.OmniboxUrlEmphasizer;
@@ -36,7 +37,8 @@ public class UsbChooserDialog implements ItemChooserDialog.ItemSelectedCallback
/**
* Creates the UsbChooserDialog.
*/
- private UsbChooserDialog(long nativeUsbChooserDialogPtr) {
+ @VisibleForTesting
+ UsbChooserDialog(long nativeUsbChooserDialogPtr) {
mNativeUsbChooserDialogPtr = nativeUsbChooserDialogPtr;
}
@@ -48,7 +50,8 @@ public class UsbChooserDialog implements ItemChooserDialog.ItemSelectedCallback
* @param securityLevel The security level of the connection to the site wanting to connect to
* the USB device. For valid values see SecurityStateModel::SecurityLevel.
*/
- private void show(Context context, String origin, int securityLevel) {
+ @VisibleForTesting
+ void show(Context context, String origin, int securityLevel) {
// Emphasize the origin.
Profile profile = Profile.getLastUsedProfile();
SpannableString originSpannableString = new SpannableString(origin);
@@ -117,8 +120,9 @@ public class UsbChooserDialog implements ItemChooserDialog.ItemSelectedCallback
mItemChooserDialog.setIdleState();
}
+ @VisibleForTesting
@CalledByNative
- private void addDevice(String deviceId, String deviceName) {
+ void addDevice(String deviceId, String deviceName) {
mItemChooserDialog.addItemToList(
new ItemChooserDialog.ItemChooserRow(deviceId, deviceName));
}
@@ -135,7 +139,10 @@ public class UsbChooserDialog implements ItemChooserDialog.ItemSelectedCallback
mItemChooserDialog.dismiss();
}
- private native void nativeOnItemSelected(long nativeUsbChooserDialogAndroid, String deviceId);
- private native void nativeOnDialogCancelled(long nativeUsbChooserDialogAndroid);
- private native void nativeLoadUsbHelpPage(long nativeUsbChooserDialogAndroid);
+ @VisibleForTesting
+ native void nativeOnItemSelected(long nativeUsbChooserDialogAndroid, String deviceId);
+ @VisibleForTesting
+ native void nativeOnDialogCancelled(long nativeUsbChooserDialogAndroid);
+ @VisibleForTesting
+ native void nativeLoadUsbHelpPage(long nativeUsbChooserDialogAndroid);
}
« no previous file with comments | « no previous file | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698