This repository was archived by the owner on Dec 14, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +34
-4
lines changed
androidTest/java/mozilla/lockbox/robots
main/java/mozilla/lockbox Expand file tree Collapse file tree 5 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import br.com.concretesolutions.kappuccino.actions.TextActions.typeText
1010import br.com.concretesolutions.kappuccino.assertions.VisibilityAssertions.displayed
1111import mozilla.lockbox.R
1212
13- // Filter ItemList
13+ // SearchFallback ItemList
1414class FilteredItemListRobot : BaseTestRobot {
1515 override fun exists () = displayed { id(R .id.filterField) }
1616
Original file line number Diff line number Diff line change @@ -95,7 +95,10 @@ class LockboxAutofillService(
9595 is DataStore .State .Errored -> AutofillAction .Error (state.error)
9696 }
9797 }
98- .subscribe(dispatcher::dispatch)
98+ .onErrorReturnItem(AutofillAction .SearchFallback )
99+ .subscribe(dispatcher::dispatch) {
100+ log.error(throwable = it)
101+ }
99102 .addTo(compositeDisposable)
100103
101104 autofillStore.autofillActions
@@ -104,6 +107,7 @@ class LockboxAutofillService(
104107 is AutofillAction .Complete -> builder.buildFilteredFillResponse(this , listOf (it.login)).asOptional()
105108 is AutofillAction .CompleteMultiple -> (builder.buildFilteredFillResponse(this , it.logins)
106109 ? : builder.buildFallbackFillResponse(this )).asOptional()
110+ is AutofillAction .SearchFallback -> builder.buildFallbackFillResponse(this ).asOptional()
107111 is AutofillAction .Authenticate -> builder.buildAuthenticationFillResponse(this ).asOptional()
108112 is AutofillAction .Cancel -> Optional (null )
109113 is AutofillAction .Error -> {
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ sealed class AutofillAction(
1515 data class Complete (val login : ServerPassword ) : AutofillAction(TelemetryEventMethod .autofill_single, TelemetryEventObject .autofill)
1616 data class CompleteMultiple (val logins : List <ServerPassword >) : AutofillAction(TelemetryEventMethod .autofill_multiple, TelemetryEventObject .autofill)
1717 data class Error (val error : Throwable ) : AutofillAction(TelemetryEventMethod .autofill_error, TelemetryEventObject .autofill)
18+ object SearchFallback : AutofillAction(TelemetryEventMethod .autofill_filter, TelemetryEventObject .autofill)
1819 object Authenticate : AutofillAction(TelemetryEventMethod .autofill_locked, TelemetryEventObject .autofill)
1920 object Cancel : AutofillAction(TelemetryEventMethod .autofill_cancel, TelemetryEventObject .autofill)
2021}
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ enum class TelemetryEventMethod {
5252 autofill_single,
5353 autofill_multiple,
5454 autofill_cancel,
55- autofill_error
55+ autofill_error,
56+ autofill_filter
5657}
5758
5859enum class TelemetryEventObject {
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ class FixedDataStoreSupport(
2121) : DataStoreSupport {
2222 var size = getRandomInRange(40 , 50 )
2323 private val logins = MemoryLoginsStorage (
24- values ? : List (size) { createDummyItem(it) })
24+ values ? : List (size) { createDummyItem(it) } + listOf (createDummyIPItem())
25+ )
2526
2627 override var encryptionKey: String = " shh-keep-it-secret"
2728
@@ -67,6 +68,29 @@ internal fun createDummyItem(idx: Int): ServerPassword {
6768 )
6869}
6970
71+ internal fun createDummyIPItem (): ServerPassword {
72+ val random = Random ()
73+ val id = UUID .randomUUID().toString()
74+ val pwd = createRandomPassword()
75+ val host = " http://10.250.7.80"
76+ val user = createUserId()
77+ val created = Date ().time
78+ val used = Date (created - 86400000 ).time
79+ val changed = Date (used - 86400000 ).time
80+
81+ return ServerPassword (
82+ id = id,
83+ hostname = host,
84+ username = user,
85+ password = pwd,
86+ formSubmitURL = host,
87+ timeCreated = created,
88+ timeLastUsed = used,
89+ timePasswordChanged = changed,
90+ timesUsed = random.nextInt(100 ) + 1
91+ )
92+ }
93+
7094internal fun createRandomPassword (): String {
7195 return UUID .randomUUID().toString().substring(0 .. 20 )
7296}
You can’t perform that action at this time.
0 commit comments