nearbyshare

package
v0.0.0-...-9474aff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package nearbyshare is used to control Chrome OS Nearby Share functionality.

Index

Constants

View Source
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.

View Source
const BtsnoopLog = "nearby_btsnoop_cros.log"

BtsnoopLog is the filename of the Chrome OS btsnoop log that is saved for each test.

View Source
const ChromeLog = "nearby_chrome"

ChromeLog is the filename of the Chrome log that is saved for each test.

View Source
const DetectShareTargetTimeout = 3 * time.Minute

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.

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.

View Source
const DownloadPath = "/home/chronos/user/Downloads/"

DownloadPath is the downloads directory on CrOS.

View Source
const ExtraLargeFileOnlineTransferTimeout = 3 * time.Minute

ExtraLargeFileOnlineTransferTimeout is the transfer timeout for extra large file (~100MB) online transfer tests.

View Source
const KeepStateVar = "keepState"

KeepStateVar is the runtime variable name used to specify the chrome.KeepState parameter to preserve the DUT's user accounts.

View Source
const LargeFileOnlineTransferTimeout = time.Minute

LargeFileOnlineTransferTimeout is the transfer timeout for large file (~30MB) online transfer tests.

View Source
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.

View Source
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.

View Source
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.

View Source
const SendDir = DownloadPath + "nearby_test_files"

SendDir is the staging directory for test files when sending from CrOS.

View Source
const SmallFileTransferTimeout = 30 * time.Second

SmallFileTransferTimeout is the test timeout for small file (~10kb) transfer tests.

Variables

View Source
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.

View Source
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

func RandomDeviceName(basename string) string

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 DataUsage

type DataUsage int

DataUsage represents Nearby Share data usage setting values.

const (
	DataUsageUnknown DataUsage = iota
	DataUsageOffline
	DataUsageOnline
	DataUsageWifiOnly
)

As defined in https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom

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
)

As defined in https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom

type MimeType

type MimeType string

MimeType are the mime type values that are accepted by the snippet's sendFile method.

const (
	MimeTypeTextVCard MimeType = "text/x-vcard"
	MimeTypePDF       MimeType = "application/pdf"
	MimeTypeJpeg      MimeType = "image/jpeg"
	MimeTypeMP4       MimeType = "video/mp4"
	MimeTypeTextPlain MimeType = "text/plain"
	MimeTypePng       MimeType = "image/png"
)

MimeTypes supported by the snippet library.

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
)

As defined in https://chromium.googlesource.com/chromium/src/+/HEAD/chrome/browser/ui/webui/nearby_share/public/mojom/nearby_share_settings.mojom

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL