arcast/pkg/browser/dummy/browser.go

53 lines
983 B
Go
Raw Normal View History

2023-12-13 20:07:22 +01:00
package dummy
import (
"context"
"forge.cadoles.com/arcad/arcast/pkg/browser"
"gitlab.com/wpetit/goweb/logger"
)
type Browser struct {
status browser.Status
url string
}
// Load implements browser.Browser.
func (b *Browser) Load(url string) error {
logger.Debug(context.Background(), "loading url", logger.F("url", url))
b.status = browser.StatusCasting
b.url = url
return nil
}
// Status implements browser.Browser.
func (b *Browser) Status() (browser.Status, error) {
return b.status, nil
}
// Title implements browser.Browser.
func (b *Browser) Title() (string, error) {
return "", nil
}
// URL implements browser.Browser.
func (b *Browser) URL() (string, error) {
return b.url, nil
}
// Reset implements browser.Browser.
func (b *Browser) Reset(url string) error {
b.status = browser.StatusIdle
b.url = url
return nil
}
func NewBrowser() *Browser {
return &Browser{
status: browser.StatusIdle,
url: "",
}
}
var _ browser.Browser = &Browser{}