| 
1 | 1 | package profile  | 
2 | 2 | 
 
  | 
3 | 3 | import (  | 
 | 4 | +	"os"  | 
4 | 5 | 	"path/filepath"  | 
5 | 6 | 	"runtime"  | 
6 | 7 | 	"testing"  | 
@@ -58,6 +59,58 @@ func TestProfileFinder_FirefoxMacOS(t *testing.T) {  | 
58 | 59 | 	}  | 
59 | 60 | }  | 
60 | 61 | 
 
  | 
 | 62 | +func TestNewManager_ChromiumWindows(t *testing.T) {  | 
 | 63 | +	if runtime.GOOS != "windows" {  | 
 | 64 | +		t.Skip("skipping test on non-windows system")  | 
 | 65 | +	}  | 
 | 66 | +	userProfile := os.Getenv("USERPROFILE")  | 
 | 67 | +	rootPath := filepath.Join(userProfile, `AppData\Local\Google\Chrome\User Data`)  | 
 | 68 | +	paths, err := filepath.Glob(rootPath)  | 
 | 69 | + | 
 | 70 | +	assert.NoError(t, err)  | 
 | 71 | +	if len(paths) == 0 {  | 
 | 72 | +		t.Skip("no chrome profile found")  | 
 | 73 | +	}  | 
 | 74 | +	browserType := types2.ChromiumType  | 
 | 75 | +	dataTypes := types2.AllDataTypes  | 
 | 76 | +	finder := NewFinder()  | 
 | 77 | +	profiles, err := finder.FindProfiles(rootPath, browserType, dataTypes)  | 
 | 78 | +	assert.NoError(t, err)  | 
 | 79 | +	assert.NotNil(t, profiles)  | 
 | 80 | +	for name, profile := range profiles {  | 
 | 81 | +		for k, v := range profile.DataFilePath {  | 
 | 82 | +			t.Logf("name: %s, datatype: %s, datapath: %s", name, k.String(), v)  | 
 | 83 | +		}  | 
 | 84 | +		t.Log(name, profile.MasterKeyPath)  | 
 | 85 | +	}  | 
 | 86 | +}  | 
 | 87 | + | 
 | 88 | +func TestProfileFinder_FirefoxWindows(t *testing.T) {  | 
 | 89 | +	if runtime.GOOS != "windows" {  | 
 | 90 | +		t.Skip("skipping test on non-windows system")  | 
 | 91 | +	}  | 
 | 92 | +	userProfile := os.Getenv("USERPROFILE")  | 
 | 93 | +	rootPath := filepath.Join(userProfile, `AppData\Roaming\Mozilla\Firefox\Profiles`)  | 
 | 94 | +	paths, err := filepath.Glob(rootPath)  | 
 | 95 | + | 
 | 96 | +	assert.NoError(t, err)  | 
 | 97 | +	if len(paths) == 0 {  | 
 | 98 | +		t.Skip("no firefox profile found")  | 
 | 99 | +	}  | 
 | 100 | +	browserType := types2.FirefoxType  | 
 | 101 | +	dataTypes := types2.AllDataTypes  | 
 | 102 | +	finder := NewFinder()  | 
 | 103 | +	profiles, err := finder.FindProfiles(rootPath, browserType, dataTypes)  | 
 | 104 | +	assert.NoError(t, err)  | 
 | 105 | +	assert.NotNil(t, profiles)  | 
 | 106 | +	for name, profile := range profiles {  | 
 | 107 | +		for k, v := range profile.DataFilePath {  | 
 | 108 | +			t.Logf("name: %s, datatype: %s, value: %s", name, k.String(), v)  | 
 | 109 | +		}  | 
 | 110 | +		t.Log(name, profile.MasterKeyPath)  | 
 | 111 | +	}  | 
 | 112 | +}  | 
 | 113 | + | 
61 | 114 | func Test_extractProfileNameFromPath(t *testing.T) {  | 
62 | 115 | 	testCases := []struct {  | 
63 | 116 | 		name             string  | 
 | 
0 commit comments