From: Seonah Moon Date: Wed, 12 Sep 2018 04:50:21 +0000 (+0900) Subject: [Download][NON-ACR][Add new flag to check downloading state] X-Git-Tag: tct5.0_m2~66^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cee3d94f018b5d63f6f633b2b2df5b202b93277b;p=test%2Ftct%2Fcsharp%2Fapi.git [Download][NON-ACR][Add new flag to check downloading state] HttpStatus_READ_ONLY TC is failed because it checks whether download is finished or not. However, HttpStatus can be gotten although download is not completed. To avoid this case, new flag for downloading state is added. Change-Id: I8af883e78a26e9f5bc97b4144193f0821b8476cb --- diff --git a/tct-suite-vs/Tizen.Download.Tests/testcase/TSRequest.cs b/tct-suite-vs/Tizen.Download.Tests/testcase/TSRequest.cs index 65c63b7..4c8faaa 100755 --- a/tct-suite-vs/Tizen.Download.Tests/testcase/TSRequest.cs +++ b/tct-suite-vs/Tizen.Download.Tests/testcase/TSRequest.cs @@ -20,7 +20,8 @@ namespace Tizen.Content.Download.Tests public static string fileName; public static Tizen.Content.Download.NetworkType type; public static IDictionary httpHeaders; - public static bool bFlag; + public static bool bCompletedFlag; + public static bool bDownloadingFlag; public static bool isDownloadSupported = false; public static bool isWifiSupported = false; public static bool isWifiDirectSupported = false; @@ -34,13 +35,13 @@ namespace Tizen.Content.Download.Tests { await Task.Delay(1000); count++; - if (bFlag) + if (bCompletedFlag) { - Tizen.Log.Info("Tizen.Content.Download" , "RequestTests bFlag is true");break; + Tizen.Log.Info("Tizen.Content.Download" , "RequestTests bCompletedFlag is true");break; } if (count == 30) { - Tizen.Log.Info("Tizen.Content.Download" , "RequestTests count is 8"); break; + Tizen.Log.Info("Tizen.Content.Download" , "RequestTests count is 30"); break; } } } @@ -56,7 +57,8 @@ namespace Tizen.Content.Download.Tests type = NetworkType.All; httpHeaders = new Dictionary(); httpHeaders.Add("Pragma", "no-cache"); - bFlag = false; + bCompletedFlag = false; + bDownloadingFlag = false; Information.TryGetValue("http://tizen.org/feature/download", out isDownloadSupported); Information.TryGetValue("http://tizen.org/feature/network.wifi", out isWifiSupported); @@ -79,12 +81,12 @@ namespace Tizen.Content.Download.Tests static void OnProgressChanged(object sender, ProgressChangedEventArgs e) { Tizen.Log.Info("Tizen.Content.Download" , "OnProgressChanged"); - bFlag = true; + bCompletedFlag = true; } static void OnStateChanged(object sender, StateChangedEventArgs e) { - Tizen.Log.Info("Tizen.Content.Download" , "OnStateChanged"+e.State); + Tizen.Log.Info("Tizen.Content.Download" , "OnStateChanged"+e.State); switch (e.State) { case DownloadState.None: @@ -104,7 +106,7 @@ namespace Tizen.Content.Download.Tests break; case DownloadState.Downloading: { - + bDownloadingFlag = true; } break; case DownloadState.Paused: @@ -114,7 +116,7 @@ namespace Tizen.Content.Download.Tests break; case DownloadState.Completed: { - bFlag = true; + bCompletedFlag = true; } break; case DownloadState.Canceled: @@ -228,7 +230,7 @@ namespace Tizen.Content.Download.Tests testRequest.Dispose(); - Assert.True(bFlag, "StateChanged event should occur"); + Assert.True(bCompletedFlag, "StateChanged event should occur"); Tizen.Log.Info("Tizen.Content.Download" , "TC Completed"); } catch (NotSupportedException) @@ -262,7 +264,7 @@ namespace Tizen.Content.Download.Tests testRequest.Dispose(); - Assert.True(bFlag, "ProgressChanged event should occur"); + Assert.True(bCompletedFlag, "ProgressChanged event should occur"); Tizen.Log.Info("Tizen.Content.Download" , "TC Completed"); } catch (NotSupportedException) @@ -300,7 +302,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bCompletedFlag, "DownloadState should be Completed"); Assert.IsNotNull((string)req.DownloadedPath, "DownloadedPath is null"); Assert.IsInstanceOf( req.DownloadedPath , "DownloadedPath is not of the type string"); req.Dispose(); @@ -361,7 +363,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bCompletedFlag, "DownloadState should be Completed"); Assert.IsNotNull((string)req.MimeType, "MimeType is null"); Assert.IsInstanceOf( req.MimeType , "MimeType is not of the type string"); req.Dispose(); @@ -423,7 +425,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bCompletedFlag, "DownloadState should be Completed"); Assert.IsNotNull((DownloadState)req.State, "State is null"); Assert.IsInstanceOf( req.State , "State is not of the type DownloadState"); Assert.AreEqual((int)DownloadState.Completed, (int)req.State, "Request propety \"State\": value should be completed"); @@ -456,7 +458,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bCompletedFlag, "DownloadState should be Completed"); Assert.IsNotNull((string)req.ContentName, "ContentName is null"); Assert.IsInstanceOf( req.ContentName , "ContentName is not of the type string"); req.Dispose(); @@ -518,7 +520,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bCompletedFlag, "DownloadState should be Completed"); Assert.IsNotNull((ulong)req.ContentSize, "ContentSize is null"); Assert.IsInstanceOf( req.ContentSize , "ContentSize is not of the type ulong"); req.Dispose(); @@ -580,7 +582,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bDownloadingFlag, "DownloadState should be Downloading or Completed"); Assert.IsNotNull((int)req.HttpStatus, "HttpStatus is null"); Assert.IsInstanceOf( req.HttpStatus , "ContentSize is not of the type int"); req.Dispose(); @@ -642,7 +644,7 @@ namespace Tizen.Content.Download.Tests await waitFlag(); - Assert.True(bFlag, "DownloadState should be Completed"); + Assert.True(bCompletedFlag, "DownloadState should be Completed"); Assert.IsNotNull((string)req.ETagValue, "ETagValue is null"); Assert.IsInstanceOf( req.ETagValue , "ETagValue is not of the type string"); req.Dispose(); @@ -1063,7 +1065,7 @@ namespace Tizen.Content.Download.Tests break; case DownloadState.Canceled: { - bFlag = true; + bCompletedFlag = true; } break; } @@ -1259,7 +1261,7 @@ namespace Tizen.Content.Download.Tests break; case DownloadState.Downloading: { - bFlag = true; + bCompletedFlag = true; } break; case DownloadState.Paused: @@ -1357,7 +1359,7 @@ namespace Tizen.Content.Download.Tests break; case DownloadState.Paused: { - bFlag = true; + bCompletedFlag = true; } break; case DownloadState.Completed: @@ -1422,7 +1424,7 @@ namespace Tizen.Content.Download.Tests break; case DownloadState.Canceled: { - bFlag = true; + bCompletedFlag = true; } break; } @@ -1486,7 +1488,7 @@ namespace Tizen.Content.Download.Tests req.Start(); await waitFlag(); - Assert.True(bFlag, "DownloadState should be Downloading"); + Assert.True(bCompletedFlag, "DownloadState should be Downloading"); Tizen.Log.Info("Tizen.Content.Download", "TC Completed"); } catch (NotSupportedException)