[MediaPlayer][Non-ACR] check networks and rethrow an exception 47/227047/1
authorruble <just.nam@samsung.com>
Mon, 9 Mar 2020 08:16:09 +0000 (17:16 +0900)
committerruble <just.nam@samsung.com>
Mon, 9 Mar 2020 08:16:09 +0000 (17:16 +0900)
Change-Id: Ie105c487fbbca5e2c48e83c17f843af3d70aa45e

tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSAdaptiveVariants.cs
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSDownloadProgress.cs
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/TSPlayer.cs
tct-suite-vs/Tizen.MediaPlayer.Tests/testcase/support/NetworkConnection.cs

index 2101e76217e1d8ec33de3b01c30fb524d463acb1..a05ddd12255b483b6d5f33c37ab8734952ba5254 100755 (executable)
@@ -133,6 +133,7 @@ namespace Tizen.Multimedia.Tests
             catch (Exception)
             {
                 NetworkConncetion.Check();
+                throw;
             }
         }
 
index de712e6cf579fe3d4516a77b931f1c076ccf4f7a..42701e37992311150a8902529560e63a8cbe7e50 100755 (executable)
@@ -49,6 +49,7 @@ namespace Tizen.Multimedia.Tests
             catch (Exception)
             {
                 NetworkConncetion.Check();
+                throw;
             }
         }
 
@@ -73,6 +74,7 @@ namespace Tizen.Multimedia.Tests
             catch (Exception)
             {
                 NetworkConncetion.Check();
+                throw;
             }
         }
 
@@ -106,6 +108,7 @@ namespace Tizen.Multimedia.Tests
             catch (Exception)
             {
                 NetworkConncetion.Check();
+                throw;
             }
         }
     }
index 79d4dee28d3f7b8708378b03c68c1e00b54d07b0..6768ada321eb132d4e833359a31d811b68cfca55 100755 (executable)
@@ -1069,6 +1069,7 @@ namespace Tizen.Multimedia.Tests
                 catch(Exception)
                 {
                     NetworkConncetion.Check();
+                    throw;
                 }
             }
         }
@@ -1805,6 +1806,7 @@ namespace Tizen.Multimedia.Tests
             catch (Exception)
             {
                 NetworkConncetion.Check();
+                throw;
             }
         }
 
index af8e9a27e7703a707690fe21586adc623abdcbaf..880dd524dbf32548ddfa67aa2d2692d3e94dd54e 100644 (file)
@@ -14,19 +14,12 @@ namespace Tizen.Multimedia
             get
             {
                 Information.TryGetValue("http://tizen.org/feature/network.wifi", out bool isWiFiSupported);
-                if (isWiFiSupported)
-                {
-                    WiFiAP WifiAp = WiFiManager.GetConnectedAP();
-                    if (WifiAp != null)
-                    {
-                        LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "WifiAp : " + WifiAp.NetworkInformation.Essid.ToString());
-                        WifiAp.Dispose();
-                    }
-                }
-
                 Information.TryGetValue("http://tizen.org/feature/network.telephony", out bool isTelephonySupported);
                 Information.TryGetValue("http://tizen.org/feature/network.ethernet", out bool isEthernetSupported);
 
+                LogUtils.Write(LogUtils.INFO, LogUtils.TAG,
+                    $"Wifi:{isWiFiSupported}, Telephony:{isTelephonySupported}, Ethernet:{isEthernetSupported}");
+
                 return isWiFiSupported | isTelephonySupported | isEthernetSupported;
             }
         }
@@ -35,18 +28,33 @@ namespace Tizen.Multimedia
         {
             if (!IsSupportable)
             {
-                Assert.Fail("No Wifi connection. Network support : " + IsSupportable);
+                Assert.Fail("Networks are not supported.");
             }
 
-            try
+            if (ConnectionState.Connected == ConnectionManager.WiFiState)
             {
-                var data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData);
-                LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "LastReceivedData : " + data);
-                Assert.IsTrue(data > 0, "LastReceivedData should not be 0");
+                WiFiAP WifiAp = WiFiManager.GetConnectedAP();
+                if (WifiAp != null)
+                {
+                    LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "WifiAp : " + WifiAp.NetworkInformation.Essid.ToString());
+                    WifiAp.Dispose();
+                }
+
+                try
+                {
+                    var data = ConnectionManager.GetStatistics(ConnectionType.WiFi, StatisticsType.TotalReceivedData);
+                    LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "TotalReceivedData : " + data);
+                    if (data == 0)
+                        Assert.Fail("TotalReceivedData should not be 0.");
+                }
+                catch (Exception ex)
+                {
+                    Assert.Fail("Failed to get connection statistics. : " + ex.ToString());
+                }
             }
-            catch (Exception ex)
+            else
             {
-                Assert.Fail("Failed to get connection statistics. : " + ex.ToString());
+                LogUtils.Write(LogUtils.INFO, LogUtils.TAG, "Wifi is not connected. Maybe another network is being used.");
             }
         }
     }