{
AudioManager.DeviceRunningChanged += eventHandler;
- // We need to play anything in BACKGROUND for checking whether IsRunning returns true or not.
- 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);
- }
+ Task.Run(() => TonePlayer.StartAsync(ToneType.Default, audioStreamPolicy, 2000, cts.Token));
Assert.That(await tcs.Task);
}