Fix Android local open flow

This commit is contained in:
Joe Julian
2026-04-01 21:42:19 -07:00
parent b030b69c0d
commit 5b6f7bb1de
3 changed files with 109 additions and 8 deletions
+55
View File
@@ -3519,6 +3519,50 @@ func TestUIStartupPreselectsNewestTargetAcrossLocalAndRemote(t *testing.T) {
}
}
func TestUIStartupDoesNotRequestMasterPasswordFocusWithoutSelectedTarget(t *testing.T) {
t.Parallel()
dir := t.TempDir()
u := newUIWithSession("phone", &session.Manager{}, statePaths{
DefaultSaveAsPath: filepath.Join(dir, "vault.kdbx"),
RecentVaultsPath: filepath.Join(dir, "recent-vaults.json"),
RecentRemotesPath: filepath.Join(dir, "recent-remotes.json"),
SettingsPath: filepath.Join(dir, "settings.json"),
UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"),
AutofillCachePath: filepath.Join(dir, "autofill-cache.json"),
})
if u.requestMasterPassFocus {
t.Fatal("requestMasterPassFocus = true without a selected startup target, want false")
}
}
func TestUIStartupRequestsMasterPasswordFocusForSelectedRecentVault(t *testing.T) {
t.Parallel()
dir := t.TempDir()
paths := statePaths{
DefaultSaveAsPath: filepath.Join(dir, "vault.kdbx"),
RecentVaultsPath: filepath.Join(dir, "recent-vaults.json"),
RecentRemotesPath: filepath.Join(dir, "recent-remotes.json"),
SettingsPath: filepath.Join(dir, "settings.json"),
UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"),
AutofillCachePath: filepath.Join(dir, "autofill-cache.json"),
}
first := newUIWithSession("phone", &session.Manager{}, paths)
first.noteRecentVault("/tmp/demo.kdbx")
reopened := newUIWithSession("phone", &session.Manager{}, paths)
if got := reopened.vaultPath.Text(); got != "/tmp/demo.kdbx" {
t.Fatalf("vaultPath = %q, want /tmp/demo.kdbx", got)
}
if !reopened.requestMasterPassFocus {
t.Fatal("requestMasterPassFocus = false with a selected startup vault, want true")
}
}
func TestUIGroupToolsDisclosureStatePersists(t *testing.T) {
t.Parallel()
@@ -4311,6 +4355,17 @@ func TestShouldUsePreviewWindowSizeSkipsAndroid(t *testing.T) {
}
}
func TestSupportsDesktopFilePicker(t *testing.T) {
t.Parallel()
if got := supportsDesktopFilePicker("android"); got {
t.Fatal("supportsDesktopFilePicker(android) = true, want false")
}
if got := supportsDesktopFilePicker("linux"); !got {
t.Fatal("supportsDesktopFilePicker(linux) = false, want true")
}
}
func TestEnterOnLocalLifecycleScreenDefaultsToOpenVault(t *testing.T) {
t.Parallel()