Add Android autofill service packaging
This commit is contained in:
@@ -2725,6 +2725,9 @@ func TestDefaultStatePathsUsesProvidedStateDir(t *testing.T) {
|
||||
if got := paths.UIPreferencesPath; got != filepath.Join(base, "ui-prefs.json") {
|
||||
t.Fatalf("UIPreferencesPath = %q, want %q", got, filepath.Join(base, "ui-prefs.json"))
|
||||
}
|
||||
if got := paths.AutofillCachePath; got != filepath.Join(base, "autofill-cache.json") {
|
||||
t.Fatalf("AutofillCachePath = %q, want %q", got, filepath.Join(base, "autofill-cache.json"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestDefaultStatePathsUsesEnvironmentStateDirWhenFlagUnset(t *testing.T) {
|
||||
@@ -2745,6 +2748,44 @@ func TestDefaultStatePathsUsesEnvironmentStateDirWhenFlagUnset(t *testing.T) {
|
||||
if got := paths.UIPreferencesPath; got != filepath.Join(base, "ui-prefs.json") {
|
||||
t.Fatalf("UIPreferencesPath = %q, want %q", got, filepath.Join(base, "ui-prefs.json"))
|
||||
}
|
||||
if got := paths.AutofillCachePath; got != filepath.Join(base, "autofill-cache.json") {
|
||||
t.Fatalf("AutofillCachePath = %q, want %q", got, filepath.Join(base, "autofill-cache.json"))
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunActionSynchronizesAutofillCache(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dir := t.TempDir()
|
||||
cachePath := filepath.Join(dir, "autofill-cache.json")
|
||||
u := newUIWithSession("desktop", &session.Manager{}, statePaths{
|
||||
DefaultSaveAsPath: filepath.Join(dir, "vault.kdbx"),
|
||||
RecentVaultsPath: filepath.Join(dir, "recent-vaults.json"),
|
||||
RecentRemotesPath: filepath.Join(dir, "recent-remotes.json"),
|
||||
UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"),
|
||||
AutofillCachePath: cachePath,
|
||||
})
|
||||
u.masterPassword.SetText("correct horse battery staple")
|
||||
|
||||
u.runAction("create vault", u.createVaultAction)
|
||||
u.entryTitle.SetText("Chrome Test")
|
||||
u.entryUsername.SetText("joe")
|
||||
u.entryPassword.SetText("secret")
|
||||
u.entryURL.SetText("https://10.0.2.2:8443/login")
|
||||
u.runAction("save entry", u.saveEntryAction)
|
||||
|
||||
data, err := os.ReadFile(cachePath)
|
||||
if err != nil {
|
||||
t.Fatalf("ReadFile(cache) error = %v", err)
|
||||
}
|
||||
if !strings.Contains(string(data), "\"host\": \"10.0.2.2\"") {
|
||||
t.Fatalf("cache contents = %s, want host entry", string(data))
|
||||
}
|
||||
|
||||
u.runAction("lock vault", u.lockAction)
|
||||
if _, err := os.Stat(cachePath); !os.IsNotExist(err) {
|
||||
t.Fatalf("cache path still exists after lock, stat err = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveFlagOrEnvPrefersFlagThenEnvThenFallback(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user