Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/monotouch-test/Foundation/UrlProtocolTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void Task ()
[Test]
public void RegistrarTest ()
{
CustomUrlProtocol.State = 0;
var success = false;

var task = Task.Run (async () => {
Expand All @@ -76,7 +77,10 @@ public void RegistrarTest ()
}
});

Assert.IsTrue (TestRuntime.RunAsync (TimeSpan.FromSeconds (10), task), "Timed out");
// Use the completion check overload so RunAsync also waits for
// StopLoading to fire (State reaches 5) instead of returning as
// soon as the download task completes (State may still be 4).
Assert.IsTrue (TestRuntime.RunAsync (TimeSpan.FromSeconds (10), task, () => CustomUrlProtocol.State >= 5), "Timed out");
Assert.That (CustomUrlProtocol.State, Is.EqualTo (5), "State");
Assert.IsTrue (success, "Success");
}
Expand Down
Loading