[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 2101e76..a05ddd1 100755 (executable)
@@ -133,6 +133,7 @@ namespace Tizen.Multimedia.Tests
             catch (Exception)
             {
                 NetworkConncetion.Check();
+                throw;
             }
         }
 
index de712e6..42701e3 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 79d4dee..6768ada 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 af8e9a2..880dd52 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.");
             }
         }
     }