[AudioManager][NonACR] Add debug log 17/204317/3
authorHaesu Gwon <haesu.gwon@samsung.com>
Tue, 23 Apr 2019 05:20:20 +0000 (14:20 +0900)
committerHaesu Gwon <haesu.gwon@samsung.com>
Wed, 24 Apr 2019 08:26:25 +0000 (17:26 +0900)
Change-Id: Id29a379014503620c30d6ca7d8b7414c62a318d3

tct-suite-vs/Tizen.Multimedia.Tests/testcase/AudioManager/TSAudioManager.cs

index e692646..f686752 100644 (file)
@@ -48,6 +48,7 @@ namespace Tizen.Multimedia.Tests
 
             EventHandler<AudioDeviceRunningChangedEventArgs> eventHandler = (s, e) =>
             {
+                Log.Info("Tizen.Multimedia.Tests", $"RunningChanged event raised : {e.IsRunning}");
                 if (e.IsRunning)
                 {
                     tcs.TrySetResult(true);
@@ -59,7 +60,25 @@ namespace Tizen.Multimedia.Tests
                 AudioManager.DeviceRunningChanged += eventHandler;
 
                 // We need to play anything in BACKGROUND for checking whether IsRunning returns true or not.
-                Task.Run(() => TonePlayer.StartAsync(ToneType.Default, audioStreamPolicy, 1000, cts.Token));
+                var task = Task.Run(() =>
+                {
+                    var timer = new global::System.Timers.Timer() { Interval = 500 };
+                    timer.Elapsed += (s, e) =>
+                    {
+                        if (Thread.Yield())
+                        {
+                            Log.Info("Tizen.Multimedia.Tests", "Current thread was yielded.");
+                        }
+                    };
+
+                    TonePlayer.StartAsync(ToneType.Default, audioStreamPolicy, 2000, cts.Token);
+                });
+
+                while (task.Status != TaskStatus.Running)
+                {
+                    Log.Info("Tizen.Multimedia.Tests", "Sleep 50ms");
+                    Thread.Sleep(50);
+                }
 
                 Assert.That(await tcs.Task);
             }