summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs
diff options
context:
space:
mode:
authorE.Z. Hart <hartez@users.noreply.github.com>2016-04-25 13:57:44 -0600
committerRui Marinho <me@ruimarinho.net>2016-04-25 15:57:44 -0400
commit843bc4727a40d6ca67127326facf2333f461da2d (patch)
tree5467ab3850df7f2368baa1290e983adba27f35d9 /Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs
parent07df05ced2b43446c84d47f4b7a8325abcd0f767 (diff)
downloadxamarin-forms-843bc4727a40d6ca67127326facf2333f461da2d.tar.gz
xamarin-forms-843bc4727a40d6ca67127326facf2333f461da2d.tar.bz2
xamarin-forms-843bc4727a40d6ca67127326facf2333f461da2d.zip
Make core Ticker abstract and public (#116)
* Make core Ticker abstract and public Make the core Ticker abstract and public so it can be inherited by platform implementations; remove now-unused parts of original Ticker; add CreateTicker to IPlatformServices; remove unused CreateTimer methods from IPlatformServices * Add docs for Ticker * Remove unnecessary Ticker.Default set * Move Ticker into Internals * Update Ticker docs * Remove old Ticker docs * Remove commented code
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs')
-rw-r--r--Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs b/Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs
index 7d2317b3..5109cbb4 100644
--- a/Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs
+++ b/Xamarin.Forms.Core.UnitTests/MockPlatformServices.cs
@@ -9,6 +9,8 @@ using Xamarin.Forms;
using Xamarin.Forms.Core.UnitTests;
using System.Security.Cryptography;
using System.Text;
+using Xamarin.Forms.Internals;
+
#if WINDOWS_PHONE
using Xamarin.Forms.Platform.WinPhone;
#endif
@@ -88,6 +90,11 @@ namespace Xamarin.Forms.Core.UnitTests
invokeOnMainThread (action);
}
+ public Ticker CreateTicker()
+ {
+ return new MockTicker();
+ }
+
public void StartTimer (TimeSpan interval, Func<bool> callback)
{
Timer timer = null;
@@ -267,4 +274,24 @@ namespace Xamarin.Forms.Core.UnitTests
{
}
}
+
+ internal class MockTicker : Ticker
+ {
+ bool _enabled;
+
+ protected override void EnableTimer()
+ {
+ _enabled = true;
+
+ while (_enabled)
+ {
+ SendSignals(16);
+ }
+ }
+
+ protected override void DisableTimer()
+ {
+ _enabled = false;
+ }
+ }
} \ No newline at end of file