Documentation ¶
Overview ¶
Package nearbyshare is used to control Nearby Share functionality.
Package nearbyshare is used to control Nearby Share functionality.
Package nearbyshare is used to control Chrome OS Nearby Share functionality.
Package nearbyshare is used to control Nearby Share functionality.
Index ¶
- func AcceptFastInitiationNotification(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration, ...) error
- func AcceptIncomingShareNotification(ctx context.Context, tconn *chrome.TestConn, senderName string, ...) error
- func CrOSSetup(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome, ...) error
- func EnableNearbyShareInInitialOnboardingPage(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) error
- func EnableNearbyShareInVisibilitySelectionPage(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) error
- func FastInitiationNotificationExists(ctx context.Context, tconn *chrome.TestConn) (bool, error)
- func GetCrosAttributes(ctx context.Context, tconn *chrome.TestConn, displayName, username string, ...) (*nearbycommon.CrosAttributes, error)
- func IncomingShareNotificationExists(ctx context.Context, tconn *chrome.TestConn, senderName string) (bool, error)
- func SaveLogs(ctx context.Context, reader *syslog.LineReader, path string) error
- func StartHighVisibilityMode(ctx context.Context, tconn *chrome.TestConn, deviceName string) error
- func StartLogging(ctx context.Context, path string) (*syslog.LineReader, error)
- func ToggleNearbyDeviceIsSharingNotification(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome, ...) error
- func WaitForReceivingCompleteNotification(ctx context.Context, tconn *chrome.TestConn, senderName string, ...) error
- type NearbySettings
- type ReceiveSurface
- type SendSurface
- func (s *SendSurface) Cancel(ctx context.Context) error
- func (s *SendSurface) CancelSelect(ctx context.Context) error
- func (s *SendSurface) Close(ctx context.Context) error
- func (s *SendSurface) ConfirmationToken(ctx context.Context) (string, error)
- func (s *SendSurface) ConfirmationTokenWithTimeout(ctx context.Context, timeout time.Duration) (string, error)
- func (s *SendSurface) SelectShareTarget(ctx context.Context, receiverName string, timeout time.Duration) error
- func (s *SendSurface) WaitForShareTarget(ctx context.Context, receiverName string, timeout time.Duration) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptFastInitiationNotification ¶
func AcceptFastInitiationNotification(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration, isSetupComplete bool) error
AcceptFastInitiationNotification accepts an incoming fast initiation notification. Fast initiation notifications are shown when a nearby device is trying to discover a share target.
func AcceptIncomingShareNotification ¶
func AcceptIncomingShareNotification(ctx context.Context, tconn *chrome.TestConn, senderName string, timeout time.Duration) error
AcceptIncomingShareNotification waits for the incoming share notification from an in-contacts device and then accepts the share.
func CrOSSetup ¶
func CrOSSetup(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome, dataUsage nearbycommon.DataUsage, visibility nearbycommon.Visibility, deviceName string) error
CrOSSetup enables Chrome OS Nearby Share and configures its settings using the nearby_share_settings interface which is available through chrome://nearby. This allows tests to bypass onboarding. If deviceName is empty, the device display name will not be set and the default will be used.
func EnableNearbyShareInInitialOnboardingPage ¶
func EnableNearbyShareInInitialOnboardingPage(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) error
EnableNearbyShareInInitialOnboardingPage enables nearby share in the initial page of the onboarding workflow.
func EnableNearbyShareInVisibilitySelectionPage ¶
func EnableNearbyShareInVisibilitySelectionPage(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) error
EnableNearbyShareInVisibilitySelectionPage enables nearby share in the visibility selection page of the onboarding workflow.
func FastInitiationNotificationExists ¶
FastInitiationNotificationExists checks if the background scanning notification is present.
func GetCrosAttributes ¶
func GetCrosAttributes(ctx context.Context, tconn *chrome.TestConn, displayName, username string, dataUsage nearbycommon.DataUsage, visibility nearbycommon.Visibility) (*nearbycommon.CrosAttributes, error)
GetCrosAttributes gets the Chrome version and combines it into a CrosAttributes strct with the provided values for easy logging with json.MarshalIndent.
func IncomingShareNotificationExists ¶
func IncomingShareNotificationExists(ctx context.Context, tconn *chrome.TestConn, senderName string) (bool, error)
IncomingShareNotificationExists checks if the incoming share notification is present.
func SaveLogs ¶
SaveLogs saves the logs that have appeared since StartLogging was called, and then closes the individual line readers.
func StartHighVisibilityMode ¶
StartHighVisibilityMode enables Nearby Share's high visibility mode via Quick Settings.
func StartLogging ¶
StartLogging starts collecting logs from the specified log file, such as /var/log/chrome/chrome or /var/log/messages. Only log lines that appear after StartLogging is called will be collected, so logs for individual tests can be extracted if tests are running consecutively on a shared fixture or precondition. Callers should defer calling Save with the returned *syslog.LineReader to save the logs and free associated resources.
Types ¶
type NearbySettings ¶
type NearbySettings struct {
// contains filtered or unexported fields
}
NearbySettings is used to interact with the Nearby Share subpage of OS settings.
func GetNearbySettings ¶
func GetNearbySettings(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) (*NearbySettings, error)
GetNearbySettings connects to an existing OS settings Nearby Share subpage.
func LaunchNearbySettings ¶
func LaunchNearbySettings(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) (*NearbySettings, error)
LaunchNearbySettings launches OS settings to the Nearby Share subpage.
func (*NearbySettings) Close ¶
func (n *NearbySettings) Close(ctx context.Context) error
Close releases the resources associated with NearbySettings.
func (*NearbySettings) SetAllowedContacts ¶
func (n *NearbySettings) SetAllowedContacts(ctx context.Context, contacts ...string) error
SetAllowedContacts selects the contacts to will be able to see the device as a receiver.
func (*NearbySettings) ShowVisibilityDialog ¶
func (n *NearbySettings) ShowVisibilityDialog(ctx context.Context) error
ShowVisibilityDialog shows the visibility settings dialog, where we can choose a visibility setting and select which contacts to appear to.
func (*NearbySettings) WaitForOnboardingFlow ¶
func (n *NearbySettings) WaitForOnboardingFlow(ctx context.Context) error
WaitForOnboardingFlow waits for the Nearby Share setup page to open.
type ReceiveSurface ¶
type ReceiveSurface struct {
// contains filtered or unexported fields
}
ReceiveSurface is used to control the Nearby Share high-visibility receiving flow. The js object implements several Mojo APIs that allow tests to control Nearby Share very closely to how the UI does.
func GetReceiveSurface ¶
func GetReceiveSurface(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) (*ReceiveSurface, error)
GetReceiveSurface establishes a connection to the current receive surface if there is one.
func StartReceiving ¶
func StartReceiving(ctx context.Context, tconn *chrome.TestConn, cr *chrome.Chrome) (*ReceiveSurface, error)
StartReceiving initiates high-visibility receiving from chrome://os-settings.
func (*ReceiveSurface) AcceptShare ¶
func (r *ReceiveSurface) AcceptShare(ctx context.Context) error
AcceptShare accepts the incoming share.
func (*ReceiveSurface) Close ¶
func (r *ReceiveSurface) Close(ctx context.Context) error
Close releases the resources associated with the ReceiveSurface.
func (*ReceiveSurface) WaitForSender ¶
func (r *ReceiveSurface) WaitForSender(ctx context.Context, senderName string, timeout time.Duration) (string, error)
WaitForSender waits until the specified sender is detected, and returns the confirmation token.
type SendSurface ¶
type SendSurface struct {
// contains filtered or unexported fields
}
SendSurface is used to control the Nearby Share sending flow on Chrome OS. The js object implements several Mojo APIs that allow tests to control Nearby Share very closely to how the UI does.
func ConnectToSharingUI ¶
ConnectToSharingUI connects to an existing Nearby Share UI to drive sharing, rather than navigating to chrome://nearby/share in a browser. Sharing should be started independently from a sharing entry point ("Nearby Share" option from CrOS native share sheet, ARC++ sharesheet, etc.) before calling this function.
func StartSendFiles ¶
func StartSendFiles(ctx context.Context, cr *chrome.Chrome, filepaths []string) (*SendSurface, error)
StartSendFiles navigates directly to chrome://nearby to start sharing.
func (*SendSurface) Cancel ¶
func (s *SendSurface) Cancel(ctx context.Context) error
Cancel cancels the share on discovery page.
func (*SendSurface) CancelSelect ¶
func (s *SendSurface) CancelSelect(ctx context.Context) error
CancelSelect cancels the share on the confirmation page after selectng the device.
func (*SendSurface) Close ¶
func (s *SendSurface) Close(ctx context.Context) error
Close releases the resources associated with the SendSurface.
func (*SendSurface) ConfirmationToken ¶
func (s *SendSurface) ConfirmationToken(ctx context.Context) (string, error)
ConfirmationToken gets the secure sharing token for the transfer.
func (*SendSurface) ConfirmationTokenWithTimeout ¶
func (s *SendSurface) ConfirmationTokenWithTimeout(ctx context.Context, timeout time.Duration) (string, error)
ConfirmationTokenWithTimeout gets the secure sharing token for the transfer. This function will only wait up until the specified timeout. The Android Nearby snippet still requires a token if one is available, even for in-contact sharing. However sometimes there is no token, in which case the snippet will ignore it.
func (*SendSurface) SelectShareTarget ¶
func (s *SendSurface) SelectShareTarget(ctx context.Context, receiverName string, timeout time.Duration) error
SelectShareTarget selects the specified device as a receiver and initiates the share. The transfer will begin pending the receiver's confirmation. The timeout specifies how long to wait for the receiver to be found in the list of available share targets.
func (*SendSurface) WaitForShareTarget ¶
func (s *SendSurface) WaitForShareTarget(ctx context.Context, receiverName string, timeout time.Duration) error
WaitForShareTarget waits for the share target with the given name to become available.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package nearbyfixture contains fixtures for Nearby Share tests.
|
Package nearbyfixture contains fixtures for Nearby Share tests. |
Package nearbysnippet is for interacting with the Nearby Snippet which provides automated control of Android Nearby share.
|
Package nearbysnippet is for interacting with the Nearby Snippet which provides automated control of Android Nearby share. |
Package nearbytestutils provides utility functions for Nearby Share tests.
|
Package nearbytestutils provides utility functions for Nearby Share tests. |