nearbytestutils

package
v0.0.0-...-683b059 Latest Latest
Warning

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

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

Documentation

Overview

Package nearbytestutils provides utility functions for Nearby Share tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearCrOSDownloads

func ClearCrOSDownloads(ctx context.Context) error

ClearCrOSDownloads clears the Downloads folder (where incoming shares are received).

func ExtractAndroidTestFile

func ExtractAndroidTestFile(ctx context.Context, zipPath string, a *nearbysnippet.AndroidNearbyDevice) (string, error)

ExtractAndroidTestFile prepares a test file to send from an Android device.

func ExtractCrosTestFiles

func ExtractCrosTestFiles(ctx context.Context, zipPath string) ([]string, error)

ExtractCrosTestFiles prepares test files to send from a CrOS device. The test files will be staged in SendDir, which is a subdirectory of the current user's download directory. Callers should defer removing the test files to clean up after tests.

func FileHashComparison

func FileHashComparison(ctx context.Context, filenames []string, crosFileDir, androidFileDir string, androidDevice *nearbysnippet.AndroidNearbyDevice) error

FileHashComparison compares file hashes on CrOS and Android after a share has been completed.

func HashFile

func HashFile(ctx context.Context, filePath, fileName string) (string, error)

HashFile returns the hash for a single file.

func HashFiles

func HashFiles(ctx context.Context, filenames []string, fileDir string) ([]string, error)

HashFiles takes in a list of filenames and returns a list of their hashes.

func UnzipTestFiles

func UnzipTestFiles(ctx context.Context, zipPath string) (filenames []string, tempDir string, err error)

UnzipTestFiles extracts test data files to a temporary directory. Returns an array of base filenames and the name of the temporary dir. The extracted files can then be pushed to the Android device or copied to a user-accessible directory on CrOS, depending on which device is the sender. The data files supplied for file transfer tests should be contained in a .zip file regardless of how many files are being transferred.

Types

This section is empty.

Jump to

Keyboard shortcuts

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