From: Paweł Szewczyk
Date: Mon, 9 Sep 2019 08:54:06 +0000 (+0200)
Subject: [Usb][Non-ACR] Do not test devices existing in the system
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F30%2F213630%2F2;p=test%2Ftct%2Fcsharp%2Fapi.git
[Usb][Non-ACR] Do not test devices existing in the system
Some devices may be unavailable to the testing framework and we should
not consider them a target of our tests.
Change-Id: Ie59bd0661c6e1ae7efa9e680146cf2c2a5a02fdd
Signed-off-by: Paweł Szewczyk
---
diff --git a/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbConfiguration.cs b/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbConfiguration.cs
index 076cd91..e0a0428 100755
--- a/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbConfiguration.cs
+++ b/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbConfiguration.cs
@@ -65,7 +65,7 @@ namespace Tizen.System.Usb.Tests
{
try
{
- var testUsbDevice = Helper.Manager.AvailableDevices.FirstOrDefault();
+ var testUsbDevice = Helper.GetTestDevices().FirstOrDefault();
var testConfiguration = testUsbDevice?.Configurations.FirstOrDefault().Value;
// PRECONDITION
@@ -99,7 +99,7 @@ namespace Tizen.System.Usb.Tests
{
try
{
- var testUsbDevice = Helper.Manager.AvailableDevices.FirstOrDefault();
+ var testUsbDevice = Helper.GetTestDevices().FirstOrDefault();
var testConfiguration = testUsbDevice?.Configurations.FirstOrDefault().Value;
// PRECONDITION
diff --git a/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbDeviceStrings.cs b/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbDeviceStrings.cs
index 5a31d18..27e6cf0 100755
--- a/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbDeviceStrings.cs
+++ b/tct-suite-vs/Tizen.Usb.Tests/testcase/TSUsbDeviceStrings.cs
@@ -72,7 +72,7 @@ namespace Tizen.System.Usb.Tests
{
try
{
- foreach (var testUsbDevice in Helper.Manager.AvailableDevices)
+ foreach (var testUsbDevice in Helper.GetTestDevices())
{
// PRECONDITION
Assert.IsNotNull(testUsbDevice, "Invalid USB Device for test");
@@ -111,7 +111,7 @@ namespace Tizen.System.Usb.Tests
{
try
{
- foreach (var testUsbDevice in Helper.Manager.AvailableDevices)
+ foreach (var testUsbDevice in Helper.GetTestDevices())
{
// PRECONDITION
Assert.IsNotNull(testUsbDevice, "Invalid USB Device for test");
@@ -151,7 +151,7 @@ namespace Tizen.System.Usb.Tests
{
try
{
- foreach (var testUsbDevice in Helper.Manager.AvailableDevices)
+ foreach (var testUsbDevice in Helper.GetTestDevices())
{
// PRECONDITION
Assert.IsNotNull(testUsbDevice, "Invalid USB Device for test");
diff --git a/tct-suite-vs/Tizen.Usb.Tests/testcase/support/Helper.cs b/tct-suite-vs/Tizen.Usb.Tests/testcase/support/Helper.cs
index b4608ee..8f58345 100755
--- a/tct-suite-vs/Tizen.Usb.Tests/testcase/support/Helper.cs
+++ b/tct-suite-vs/Tizen.Usb.Tests/testcase/support/Helper.cs
@@ -153,8 +153,12 @@ namespace Tizen.System.Usb.Tests
// This is a special device generated by dummy_hcd, not for testing
if (testUsbDevice.DeviceInformation.ProductId == 0x0002 && testUsbDevice.DeviceInformation.VendorId == 0x1d6b)
continue;
+
var info = testUsbDevice.DeviceInformation;
var testDeviceData = TestDevices.Where(d => d.DeviceInformation.ProductId == info.ProductId).FirstOrDefault();
+ if (testDeviceData == null)
+ continue;
+
testData.Add(testUsbDevice, testDeviceData);
}
return testData;
@@ -206,6 +210,11 @@ namespace Tizen.System.Usb.Tests
return testData;
}
+ internal static IEnumerable GetTestDevices()
+ {
+ return Manager.AvailableDevices.Where(d => d.DeviceInformation.VendorId == 0x1d6b && d.DeviceInformation.ProductId == 0x0104);
+ }
+
internal static void ListUsb()
{
foreach (var testUsbDevice in Manager.AvailableDevices) Print(testUsbDevice, "");