diff --git a/src/omaha/omaha.go b/src/omaha/omaha.go index a08d8ce..8c39ee9 100644 --- a/src/omaha/omaha.go +++ b/src/omaha/omaha.go @@ -40,13 +40,15 @@ func (r *Request) AddApp(a *App) { type App struct { XMLName xml.Name `xml:"app"` UpdateCheck *UpdateCheck `xml:"updatecheck"` - Ping *Ping + Event *Event `xml:"event"` + Ping *Ping `xml:"ping"` Id string `xml:"appid,attr,omitempty"` Version string `xml:"version,attr,omitempty"` NextVersion string `xml:"nextversion,attr,omitempty"` Lang string `xml:"lang,attr,omitempty"` Client string `xml:"client,attr,omitempty"` InstallAge string `xml:"installage,attr,omitempty"` + FromTrack string `xml:"from_track,attr,omitempty"` } func NewApp(id string, version string) *App { @@ -92,8 +94,8 @@ func (a *App) AddPing() { type Event struct { XMLName xml.Name `xml:"event"` - EventType string `xml:"eventtype,attr,omitempty"` - EventResult string `xml:"eventresult,attr,omitempty"` + Type string `xml:"eventtype,attr,omitempty"` + Result string `xml:"eventresult,attr,omitempty"` PreviousVersion string `xml:"previousversion,attr,omitempty"` } diff --git a/src/omaha/omaha_test.go b/src/omaha/omaha_test.go index eaeb38e..f0717ba 100644 --- a/src/omaha/omaha_test.go +++ b/src/omaha/omaha_test.go @@ -8,7 +8,7 @@ import ( "os" ) -func TestOmahaUpdateCheck(t *testing.T) { +func TestOmahaRequestUpdateCheck(t *testing.T) { file, err := os.Open("fixtures/update-engine/update/request.xml") if err != nil { t.Error(err) @@ -31,6 +31,18 @@ func TestOmahaUpdateCheck(t *testing.T) { if v.Apps[0].UpdateCheck == nil { t.Error("Expected an UpdateCheck") } + + if v.Apps[0].Version != "ForcedUpdate" { + t.Error("Verison is ForcedUpdate") + } + + if v.Apps[0].FromTrack != "developer-build" { + t.Error("developer-build") + } + + if v.Apps[0].Event.Type != "3" { + t.Error("developer-build") + } } func ExampleOmaha_NewRequest() {