| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser; | 5 package org.chromium.chrome.browser; |
| 6 | 6 |
| 7 import android.app.Dialog; | 7 import android.app.Dialog; |
| 8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
| 9 import android.view.View; | 9 import android.view.View; |
| 10 import android.widget.Button; | 10 import android.widget.Button; |
| 11 import android.widget.ListView; | 11 import android.widget.ListView; |
| 12 | 12 |
| 13 import org.chromium.base.ThreadUtils; | 13 import org.chromium.base.ThreadUtils; |
| 14 import org.chromium.base.test.util.RetryOnFailure; |
| 14 import org.chromium.chrome.R; | 15 import org.chromium.chrome.R; |
| 15 import org.chromium.chrome.test.ChromeActivityTestCaseBase; | 16 import org.chromium.chrome.test.ChromeActivityTestCaseBase; |
| 16 import org.chromium.components.security_state.ConnectionSecurityLevel; | 17 import org.chromium.components.security_state.ConnectionSecurityLevel; |
| 17 import org.chromium.content.browser.test.util.Criteria; | 18 import org.chromium.content.browser.test.util.Criteria; |
| 18 import org.chromium.content.browser.test.util.CriteriaHelper; | 19 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 19 import org.chromium.content.browser.test.util.TouchCommon; | 20 import org.chromium.content.browser.test.util.TouchCommon; |
| 20 import org.chromium.ui.widget.TextViewWithClickableSpans; | 21 import org.chromium.ui.widget.TextViewWithClickableSpans; |
| 21 | 22 |
| 22 import java.util.concurrent.Callable; | 23 import java.util.concurrent.Callable; |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * Tests for the UsbChooserDialog class. | 26 * Tests for the UsbChooserDialog class. |
| 26 */ | 27 */ |
| 28 @RetryOnFailure |
| 27 public class UsbChooserDialogTest extends ChromeActivityTestCaseBase<ChromeActiv
ity> { | 29 public class UsbChooserDialogTest extends ChromeActivityTestCaseBase<ChromeActiv
ity> { |
| 28 /** | 30 /** |
| 29 * Works like the UsbChooserDialog class, but records calls to native method
s instead of | 31 * Works like the UsbChooserDialog class, but records calls to native method
s instead of |
| 30 * calling back to C++. | 32 * calling back to C++. |
| 31 */ | 33 */ |
| 32 static class UsbChooserDialogWithFakeNatives extends UsbChooserDialog { | 34 static class UsbChooserDialogWithFakeNatives extends UsbChooserDialog { |
| 33 String mSelectedDeviceId = ""; | 35 String mSelectedDeviceId = ""; |
| 34 | 36 |
| 35 UsbChooserDialogWithFakeNatives() { | 37 UsbChooserDialogWithFakeNatives() { |
| 36 super(42 /* nativeUsbChooserDialogPtr */); | 38 super(42 /* nativeUsbChooserDialogPtr */); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 R.string.usb_chooser_dialog_footnote_text)), | 178 R.string.usb_chooser_dialog_footnote_text)), |
| 177 statusView.getText().toString()); | 179 statusView.getText().toString()); |
| 178 assertFalse(button.isEnabled()); | 180 assertFalse(button.isEnabled()); |
| 179 assertEquals(View.VISIBLE, items.getVisibility()); | 181 assertEquals(View.VISIBLE, items.getVisibility()); |
| 180 | 182 |
| 181 selectItem(mChooserDialog, position); | 183 selectItem(mChooserDialog, position); |
| 182 | 184 |
| 183 assertEquals("device_id_1", mChooserDialog.mSelectedDeviceId); | 185 assertEquals("device_id_1", mChooserDialog.mSelectedDeviceId); |
| 184 } | 186 } |
| 185 } | 187 } |
| OLD | NEW |