Example #1
0
    public void GetDevice()
    {
        var requiredArchitecture = "x86_64";
        var runner = new AdbRunner(_mainLog.Object, _processManager.Object, s_adbPath);
        var result = runner.GetDevice(requiredArchitectures: new[] { requiredArchitecture });

        VerifyAdbCall("devices", "-l");
        Assert.Contains(_fakeDeviceList, d => d.DeviceSerial == result.DeviceSerial);
    }
Example #2
0
    public void GetDeviceWithAppAndApiVersion()
    {
        var runner = new AdbRunner(_mainLog.Object, _processManager.Object, s_adbPath);
        var device = _fakeDeviceList.Single(d => d.ApiVersion == 31 && d.InstalledApplications.Contains("net.dot.E"));
        var result = runner.GetDevice(requiredInstalledApp: "net.dot.E", requiredApiVersion: 31);

        VerifyAdbCall("devices", "-l");
        Assert.Equal(device.DeviceSerial, result.DeviceSerial);
        Assert.Equal(device.ApiVersion, result.ApiVersion);
    }
Example #3
0
    public void GetDeviceWithArchitecture()
    {
        var requiredArchitecture = "x86";
        var runner = new AdbRunner(_mainLog.Object, _processManager.Object, s_adbPath);
        var result = runner.GetDevice(loadArchitecture: true, requiredArchitectures: new[] { requiredArchitecture });

        VerifyAdbCall("devices", "-l");
        VerifyAdbCall("-s", result.DeviceSerial, "shell", "getprop", "ro.product.cpu.abi");
        Assert.Contains(_fakeDeviceList, d => d.DeviceSerial == result.DeviceSerial && d.Architecture == result.Architecture);
    }
Example #4
0
    public void DumpBugReport()
    {
        var    runner = new AdbRunner(_mainLog.Object, _processManager.Object, s_adbPath);
        string pathToDumpBugReport = Path.Join(s_scratchAndOutputPath, Path.GetRandomFileName());

        runner.GetDevice(requiredDeviceId: _fakeDeviceList.First().DeviceSerial);
        runner.DumpBugReport(pathToDumpBugReport);
        VerifyAdbCall("bugreport", $"{pathToDumpBugReport}.zip");

        Assert.Equal("Sample BugReport Output", File.ReadAllText($"{pathToDumpBugReport}.zip"));
    }
Example #5
0
    public void GetDeviceWithApiVersion()
    {
        var runner = new AdbRunner(_mainLog.Object, _processManager.Object, s_adbPath);
        var device = _fakeDeviceList.Single(d => d.ApiVersion == 30);
        var result = runner.GetDevice(loadArchitecture: true, requiredApiVersion: 30);

        VerifyAdbCall("devices", "-l");
        Assert.Equal(device.DeviceSerial, result.DeviceSerial);
        Assert.Equal(device.ApiVersion, result.ApiVersion);
        Assert.Equal(device.Architecture, result.Architecture);
    }