Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #464 from sidelnikovmike/ISSUE-463
Browse files Browse the repository at this point in the history
Added ability to use deviceName instead of browserName (fixes #463)
  • Loading branch information
vania-pooh authored Jun 8, 2018
2 parents 7bdec69 + 7d7e1cf commit a2dd970
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ type DefaultManager struct {

// Find - default implementation Manager interface
func (m *DefaultManager) Find(caps session.Caps, requestId uint64) (Starter, bool) {
browserName := caps.Name
browserName := browser(caps)
version := caps.Version
log.Printf("[%d] [LOCATING_SERVICE] [%s] [%s]", requestId, browserName, version)
service, version, ok := m.Config.Find(browserName, version)
Expand All @@ -92,6 +92,14 @@ func (m *DefaultManager) Find(caps session.Caps, requestId uint64) (Starter, boo
return nil, false
}

func browser(caps session.Caps) string {
browserName := caps.Name
if browserName != "" {
return browserName
}
return caps.DeviceName
}

func wait(u string, t time.Duration) error {
up := make(chan struct{})
done := make(chan struct{})
Expand Down
2 changes: 1 addition & 1 deletion service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func createDockerStarter(t *testing.T, env *service.Environment, cfg *config.Con
AssertThat(t, err, Is{nil})
manager := service.DefaultManager{Environment: env, Client: cli, Config: cfg}
caps := session.Caps{
Name: "firefox",
DeviceName: "firefox",
Version: "33.0",
ScreenResolution: "1024x768",
VNC: true,
Expand Down
1 change: 1 addition & 0 deletions session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
// Caps - user capabilities
type Caps struct {
Name string `json:"browserName"`
DeviceName string `json:"deviceName"`
Version string `json:"version"`
W3CVersion string `json:"browserVersion"`
ScreenResolution string `json:"screenResolution"`
Expand Down

0 comments on commit a2dd970

Please sign in to comment.