Documentation ¶
Overview ¶
Package nearbyshare is used to control Chrome OS Nearby Share functionality.
Index ¶
Constants ¶
const AdditionalTestTime = 30 * time.Second
AdditionalTestTime is the amount of time to add to the share target detection and file transfer timeouts to make up the global test timeout. This is to account for any additional setup and non-sharing interactions performed by the test.
const BtsnoopLog = "nearby_btsnoop_cros.log"
BtsnoopLog is the filename of the Chrome OS btsnoop log that is saved for each test.
const ChromeLog = "nearby_chrome"
ChromeLog is the filename of the Chrome log that is saved for each test.
DetectShareTargetTimeout is the timeout for a sender to detect an available receiver or vice versa. TODO(b:192296468) Decrease this back to a minute after investigation is over.
const DetectionTimeout = 2*DetectShareTargetTimeout + AdditionalTestTime
DetectionTimeout is the standard timeout for activities performed in a test excluding the actual file transfer. 2*DetectShareTargetTimeout accounts for the amount of time given for the sender to find+select the receiver, and then for the receiver to detect the incoming share from the sender.
const DownloadPath = "/home/chronos/user/Downloads/"
DownloadPath is the downloads directory on CrOS.
const ExtraLargeFileOnlineTransferTimeout = 3 * time.Minute
ExtraLargeFileOnlineTransferTimeout is the transfer timeout for extra large file (~100MB) online transfer tests.
const KeepStateVar = "keepState"
KeepStateVar is the runtime variable name used to specify the chrome.KeepState parameter to preserve the DUT's user accounts.
const LargeFileOnlineTransferTimeout = time.Minute
LargeFileOnlineTransferTimeout is the transfer timeout for large file (~30MB) online transfer tests.
const MediumFileOnlineTransferTimeout = 30 * time.Second
MediumFileOnlineTransferTimeout is the transfer timeout for medium file (~5MB) online transfer tests. Online transfers should be at least 10x faster than offline transfers. Some extra time is required to account for the delay in upgrading the bandwidth.
const MessageLog = "nearby_messages"
MessageLog is the filename of the messages log that is saved for each test. It is saved automatically by tast for local tests. For remote tests we need to grab it within the test.
const NearbyLogDir = "/tmp/nearbyshare/"
NearbyLogDir is the dir that logs will be saved in temporarily on the DUT during remote tests before being pulled back to remote host.
const SendDir = DownloadPath + "nearby_test_files"
SendDir is the staging directory for test files when sending from CrOS.
const SmallFileTransferTimeout = 30 * time.Second
SmallFileTransferTimeout is the test timeout for small file (~10kb) transfer tests.
Variables ¶
var DataUsageStrings = map[DataUsage]string{ DataUsageUnknown: "Unknown", DataUsageOffline: "Offline", DataUsageOnline: "Online", DataUsageWifiOnly: "Wifi Only", }
DataUsageStrings is a map of DataUsage to human-readable setting values.
var VisibilityStrings = map[Visibility]string{ VisibilityUnknown: "Unknown", VisibilityNoOne: "No One", VisibilityAllContacts: "All Contacts", VisibilitySelectedContacts: "Selected Contacts", }
VisibilityStrings is a map of Visibility to human-readable setting values.
Functions ¶
func RandomDeviceName ¶
RandomDeviceName appends a randomly generated integer (up to 6 digits) to the base device name to avoid conflicts when nearby devices in the lab may be running the same test at the same time.
Types ¶
type CrosAttributes ¶
type CrosAttributes struct { BasicAttributes *crossdevice.CrosAttributes DisplayName string DataUsage string Visibility string }
CrosAttributes contains information about the CrOS device that are relevant to Nearby Share.
type DeviceNameValidationResult ¶
type DeviceNameValidationResult int
DeviceNameValidationResult represents device name validation results that are returned after setting the device name programmatically.
const ( DeviceNameValidationResultValid DeviceNameValidationResult = iota DeviceNameValidationResultErrorEmpty DeviceNameValidationResultErrorTooLong DeviceNameValidationResultErrorNotValidUtf8 )
type MimeType ¶
type MimeType string
MimeType are the mime type values that are accepted by the snippet's sendFile method.
type TestData ¶
type TestData struct { Filename string TransferTimeout time.Duration TestTimeout time.Duration MimeType MimeType }
TestData contains the values for parameterized tests, such as: - File name of the archive containing files to be shared - File transfer timeout (varies depending on file size) - Total test timeout (transfer timeout + time required for sender and receiver to detect each other) - MIME type of shared files (only required when sending from Android)
type Visibility ¶
type Visibility int
Visibility represents Nearby Share visibility setting values.
const ( VisibilityUnknown Visibility = iota VisibilityNoOne VisibilityAllContacts VisibilitySelectedContacts )