test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's

This commit is contained in:
Michael Gratton 2020-04-10 12:58:09 +10:00
parent 768f6afc78
commit 196f05e595
22 changed files with 175 additions and 229 deletions

View file

@ -82,7 +82,7 @@ class Accounts.ManagerTest : TestCase {
this.test.create_account.begin( this.test.create_account.begin(
account, new GLib.Cancellable(), account, new GLib.Cancellable(),
(obj, res) => { async_complete(res); } this.async_completion
); );
this.test.create_account.end(async_result()); this.test.create_account.end(async_result());
@ -95,7 +95,7 @@ class Accounts.ManagerTest : TestCase {
public void create_orphan_account() throws GLib.Error { public void create_orphan_account() throws GLib.Error {
this.test.new_orphan_account.begin( this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null, Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
Geary.AccountInformation account1 = Geary.AccountInformation account1 =
this.test.new_orphan_account.end(async_result()); this.test.new_orphan_account.end(async_result());
@ -103,13 +103,13 @@ class Accounts.ManagerTest : TestCase {
this.test.create_account.begin( this.test.create_account.begin(
account1, new GLib.Cancellable(), account1, new GLib.Cancellable(),
(obj, res) => { async_complete(res); } this.async_completion
); );
this.test.create_account.end(async_result()); this.test.create_account.end(async_result());
this.test.new_orphan_account.begin( this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null, Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
Geary.AccountInformation account2 = Geary.AccountInformation account2 =
this.test.new_orphan_account.end(async_result()); this.test.new_orphan_account.end(async_result());
@ -119,13 +119,13 @@ class Accounts.ManagerTest : TestCase {
public void create_orphan_account_with_legacy() throws GLib.Error { public void create_orphan_account_with_legacy() throws GLib.Error {
this.test.create_account.begin( this.test.create_account.begin(
account, new GLib.Cancellable(), account, new GLib.Cancellable(),
(obj, res) => { async_complete(res); } this.async_completion
); );
this.test.create_account.end(async_result()); this.test.create_account.end(async_result());
this.test.new_orphan_account.begin( this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null, Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
Geary.AccountInformation account1 = Geary.AccountInformation account1 =
this.test.new_orphan_account.end(async_result()); this.test.new_orphan_account.end(async_result());
@ -133,13 +133,13 @@ class Accounts.ManagerTest : TestCase {
this.test.create_account.begin( this.test.create_account.begin(
account1, new GLib.Cancellable(), account1, new GLib.Cancellable(),
(obj, res) => { async_complete(res); } this.async_completion
); );
this.test.create_account.end(async_result()); this.test.create_account.end(async_result());
this.test.new_orphan_account.begin( this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null, Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
Geary.AccountInformation account2 = Geary.AccountInformation account2 =
this.test.new_orphan_account.end(async_result()); this.test.new_orphan_account.end(async_result());
@ -154,7 +154,7 @@ class Accounts.ManagerTest : TestCase {
this.test.new_orphan_account.begin( this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null, Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
Geary.AccountInformation account = Geary.AccountInformation account =
this.test.new_orphan_account.end(async_result()); this.test.new_orphan_account.end(async_result());

View file

@ -43,10 +43,7 @@ public abstract class ClientWebViewTestCase<V> : TestCase {
protected WebKit.JavascriptResult run_javascript(string command) throws Error { protected WebKit.JavascriptResult run_javascript(string command) throws Error {
ClientWebView view = (ClientWebView) this.test_view; ClientWebView view = (ClientWebView) this.test_view;
view.run_javascript.begin( view.run_javascript.begin(command, null, this.async_completion);
command, null, (obj, res) => { async_complete(res); }
);
return view.run_javascript.end(async_result()); return view.run_javascript.end(async_result());
} }

View file

@ -54,7 +54,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public void get_html() throws GLib.Error { public void get_html() throws GLib.Error {
string BODY = "<p>para</p>"; string BODY = "<p>para</p>";
load_body_fixture(BODY); load_body_fixture(BODY);
this.test_view.get_html.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_html.begin(this.async_completion);
string html = this.test_view.get_html.end(async_result()); string html = this.test_view.get_html.end(async_result());
assert_string(PageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html); assert_string(PageStateTest.CLEAN_BODY_TEMPLATE.printf(BODY), html);
} }
@ -62,14 +62,14 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public void get_html_for_draft() throws GLib.Error { public void get_html_for_draft() throws GLib.Error {
string BODY = "<p>para</p>"; string BODY = "<p>para</p>";
load_body_fixture(BODY); load_body_fixture(BODY);
this.test_view.get_html_for_draft.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_html_for_draft.begin(this.async_completion);
string html = this.test_view.get_html.end(async_result()); string html = this.test_view.get_html.end(async_result());
assert_string(PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html); assert_string(PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
} }
public void get_text() throws Error { public void get_text() throws Error {
load_body_fixture("<p>para</p>"); load_body_fixture("<p>para</p>");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == "para\n\n\n\n\n"); assert(this.test_view.get_text.end(async_result()) == "para\n\n\n\n\n");
} catch (Error err) { } catch (Error err) {
@ -80,7 +80,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public void get_text_with_quote() throws Error { public void get_text_with_quote() throws Error {
load_body_fixture("<p>pre</p> <blockquote><p>quote</p></blockquote> <p>post</p>"); load_body_fixture("<p>pre</p> <blockquote><p>quote</p></blockquote> <p>post</p>");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"pre\n\n> quote\n> \npost\n\n\n\n\n"); "pre\n\n> quote\n> \npost\n\n\n\n\n");
@ -92,7 +92,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public void get_text_with_nested_quote() throws Error { public void get_text_with_nested_quote() throws Error {
load_body_fixture("<p>pre</p> <blockquote><p>quote1</p> <blockquote><p>quote2</p></blockquote></blockquote> <p>post</p>"); load_body_fixture("<p>pre</p> <blockquote><p>quote1</p> <blockquote><p>quote2</p></blockquote></blockquote> <p>post</p>");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"pre\n\n> quote1\n> \n>> quote2\n>> \npost\n\n\n\n\n"); "pre\n\n> quote1\n> \n>> quote2\n>> \npost\n\n\n\n\n");
@ -107,7 +107,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
<p>A long, long, long, long, long, long para. Well, longer than MAX_BREAKABLE_LEN <p>A long, long, long, long, long, long para. Well, longer than MAX_BREAKABLE_LEN
at least. Really long, long, long, long, long long, long long, long long, long.</p> at least. Really long, long, long, long, long long, long long, long long, long.</p>
"""); """);
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"""A long, long, long, long, long, long para. Well, longer than """A long, long, long, long, long, long para. Well, longer than
@ -130,7 +130,7 @@ long long, long long, long.
<p>A long, long, long, long, long, long para. Well, longer than MAX_BREAKABLE_LEN <p>A long, long, long, long, long, long para. Well, longer than MAX_BREAKABLE_LEN
at least. Really long, long, long, long, long long, long long, long long, long.</p>"""); at least. Really long, long, long, long, long long, long long, long long, long.</p>""");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"""> A long, long, long, long, long, long line. Well, longer than """> A long, long, long, long, long, long line. Well, longer than
@ -157,7 +157,7 @@ long long, long long, long.
</div> </div>
"""); """);
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"""On Sun, Jan 1, 2017 at 9:55 PM, Michael Gratton <mike@vee.net> wrote: """On Sun, Jan 1, 2017 at 9:55 PM, Michael Gratton <mike@vee.net> wrote:
@ -185,7 +185,7 @@ long, long, long, long, long, long, long, long, long, long,
public void get_text_with_named_link() throws Error { public void get_text_with_named_link() throws Error {
load_body_fixture("Check out <a href=\"https://wiki.gnome.org/Apps/Geary\">Geary</a>!"); load_body_fixture("Check out <a href=\"https://wiki.gnome.org/Apps/Geary\">Geary</a>!");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"Check out Geary <https://wiki.gnome.org/Apps/Geary>!\n\n\n\n"); "Check out Geary <https://wiki.gnome.org/Apps/Geary>!\n\n\n\n");
@ -197,7 +197,7 @@ long, long, long, long, long, long, long, long, long, long,
public void get_text_with_url_link() throws Error { public void get_text_with_url_link() throws Error {
load_body_fixture("Check out <a href=\"https://wiki.gnome.org/Apps/Geary\">https://wiki.gnome.org/Apps/Geary</a>!"); load_body_fixture("Check out <a href=\"https://wiki.gnome.org/Apps/Geary\">https://wiki.gnome.org/Apps/Geary</a>!");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
"Check out <https://wiki.gnome.org/Apps/Geary>!\n\n\n\n"); "Check out <https://wiki.gnome.org/Apps/Geary>!\n\n\n\n");
@ -209,7 +209,7 @@ long, long, long, long, long, long, long, long, long, long,
public void get_text_with_surrounding_nbsps() throws Error { public void get_text_with_surrounding_nbsps() throws Error {
load_body_fixture("&nbsp;&nbsp;I like my space&nbsp;&nbsp;"); load_body_fixture("&nbsp;&nbsp;I like my space&nbsp;&nbsp;");
this.test_view.get_text.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_text.begin(this.async_completion);
try { try {
assert(this.test_view.get_text.end(async_result()) == assert(this.test_view.get_text.end(async_result()) ==
" I like my space\n\n\n\n"); " I like my space\n\n\n\n");
@ -226,21 +226,21 @@ long, long, long, long, long, long, long, long, long, long,
const string SIG1 = "signature text 1"; const string SIG1 = "signature text 1";
this.test_view.update_signature(SIG1); this.test_view.update_signature(SIG1);
this.test_view.get_html.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_html.begin(this.async_completion);
html = this.test_view.get_html.end(async_result()); html = this.test_view.get_html.end(async_result());
assert_true(BODY in html, "Body not present"); assert_true(BODY in html, "Body not present");
assert_true(SIG1 in html, "Signature 1 not present"); assert_true(SIG1 in html, "Signature 1 not present");
const string SIG2 = "signature text 2"; const string SIG2 = "signature text 2";
this.test_view.update_signature(SIG2); this.test_view.update_signature(SIG2);
this.test_view.get_html.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_html.begin(this.async_completion);
html = this.test_view.get_html.end(async_result()); html = this.test_view.get_html.end(async_result());
assert_true(BODY in html, "Body not present"); assert_true(BODY in html, "Body not present");
assert_false(SIG1 in html, "Signature 1 still present"); assert_false(SIG1 in html, "Signature 1 still present");
assert_true(SIG2 in html, "Signature 2 not present"); assert_true(SIG2 in html, "Signature 2 not present");
this.test_view.update_signature(""); this.test_view.update_signature("");
this.test_view.get_html.begin((obj, ret) => { async_complete(ret); }); this.test_view.get_html.begin(this.async_completion);
html = this.test_view.get_html.end(async_result()); html = this.test_view.get_html.end(async_result());
assert_true(BODY in html, "Body not present"); assert_true(BODY in html, "Body not present");
assert_false(SIG1 in html, "Signature 1 still present"); assert_false(SIG1 in html, "Signature 1 still present");

View file

@ -83,9 +83,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == TEST_FILENAME); assert(test.get_safe_file_name.end(async_result()) == TEST_FILENAME);
} }
@ -102,9 +100,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME); assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
} }
@ -121,9 +117,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME); assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
} }
@ -139,9 +133,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME); assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
} }
@ -157,9 +149,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME); assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
} }
@ -176,9 +166,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(ALT_TEXT, (obj, ret) => { test.get_safe_file_name.begin(ALT_TEXT, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME); assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
} }
@ -194,9 +182,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == TEST_FILENAME); assert(test.get_safe_file_name.end(async_result()) == TEST_FILENAME);
} }
@ -214,9 +200,7 @@ class Geary.AttachmentTest : TestCase {
this.file this.file
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME); assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
} }
@ -233,9 +217,7 @@ class Geary.AttachmentTest : TestCase {
File.new_for_path(TEST_FILENAME) File.new_for_path(TEST_FILENAME)
); );
test.get_safe_file_name.begin(null, (obj, ret) => { test.get_safe_file_name.begin(null, this.async_completion);
async_complete(ret);
});
assert_string(TEST_FILENAME, test.get_safe_file_name.end(async_result())); assert_string(TEST_FILENAME, test.get_safe_file_name.end(async_result()));
} }

View file

@ -78,7 +78,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
this.base_folder.expect_call("close_async"); this.base_folder.expect_call("close_async");
monitor.start_monitoring.begin( monitor.start_monitoring.begin(
NONE, test_cancellable, (obj, res) => { async_complete(res); } NONE, test_cancellable, this.async_completion
); );
monitor.start_monitoring.end(async_result()); monitor.start_monitoring.end(async_result());
@ -88,7 +88,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
} }
monitor.stop_monitoring.begin( monitor.stop_monitoring.begin(
test_cancellable, (obj, res) => { async_complete(res); } test_cancellable, this.async_completion
); );
monitor.stop_monitoring.end(async_result()); monitor.stop_monitoring.end(async_result());
@ -108,7 +108,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
.throws(new EngineError.SERVER_UNAVAILABLE("Mock error")); .throws(new EngineError.SERVER_UNAVAILABLE("Mock error"));
monitor.start_monitoring.begin( monitor.start_monitoring.begin(
NONE, null, (obj, res) => { async_complete(res); } NONE, null, this.async_completion
); );
try { try {
monitor.start_monitoring.end(async_result()); monitor.start_monitoring.end(async_result());
@ -246,7 +246,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
// error out during later tests // error out during later tests
this.base_folder.expect_call("close_async"); this.base_folder.expect_call("close_async");
monitor.stop_monitoring.begin( monitor.stop_monitoring.begin(
null, (obj, res) => { async_complete(res); } null, this.async_completion
); );
monitor.stop_monitoring.end(async_result()); monitor.stop_monitoring.end(async_result());
} }
@ -477,7 +477,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
} }
monitor.start_monitoring.begin( monitor.start_monitoring.begin(
NONE, test_cancellable, (obj, res) => { async_complete(res); } NONE, test_cancellable, this.async_completion
); );
monitor.start_monitoring.end(async_result()); monitor.start_monitoring.end(async_result());

View file

@ -64,9 +64,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
); );
whitelisted.harvest_from_email.begin( whitelisted.harvest_from_email.begin(
Collection.single(this.email), null, Collection.single(this.email), null, this.async_completion);
(obj, ret) => { async_complete(ret); }
);
whitelisted.harvest_from_email.end(async_result()); whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations(); this.store.assert_expectations();
@ -92,9 +90,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
); );
whitelisted.harvest_from_email.begin( whitelisted.harvest_from_email.begin(
Collection.single(this.email), null, Collection.single(this.email), null, this.async_completion);
(obj, ret) => { async_complete(ret); }
);
whitelisted.harvest_from_email.end(async_result()); whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations(); this.store.assert_expectations();
@ -113,9 +109,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
); );
whitelisted.harvest_from_email.begin( whitelisted.harvest_from_email.begin(
Collection.single(this.email), null, Collection.single(this.email), null, this.async_completion);
(obj, ret) => { async_complete(ret); }
);
whitelisted.harvest_from_email.end(async_result()); whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations(); this.store.assert_expectations();
@ -142,9 +136,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
); );
whitelisted.harvest_from_email.begin( whitelisted.harvest_from_email.begin(
Collection.single(this.email), null, Collection.single(this.email), null, this.async_completion);
(obj, ret) => { async_complete(ret); }
);
whitelisted.harvest_from_email.end(async_result()); whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations(); this.store.assert_expectations();
@ -171,9 +163,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
); );
whitelisted.harvest_from_email.begin( whitelisted.harvest_from_email.begin(
Collection.single(this.email), null, Collection.single(this.email), null, this.async_completion);
(obj, ret) => { async_complete(ret); }
);
whitelisted.harvest_from_email.end(async_result()); whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations(); this.store.assert_expectations();

View file

@ -42,7 +42,7 @@ class Geary.ContactStoreImplTest : TestCase {
); );
this.db.open.begin( this.db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null, Geary.Db.DatabaseFlags.CREATE_FILE, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.db.open.end(async_result()); this.db.open.end(async_result());
@ -79,7 +79,7 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.get_by_rfc822.begin( test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "Test@example.com"), new RFC822.MailboxAddress(null, "Test@example.com"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Contact? existing = test_article.get_by_rfc822.end(async_result()); Contact? existing = test_article.get_by_rfc822.end(async_result());
assert_non_null(existing, "Existing contact"); assert_non_null(existing, "Existing contact");
@ -92,7 +92,7 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.get_by_rfc822.begin( test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "test@example.com"), new RFC822.MailboxAddress(null, "test@example.com"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Contact? missing = test_article.get_by_rfc822.end(async_result()); Contact? missing = test_article.get_by_rfc822.end(async_result());
assert_null(missing, "Missing contact"); assert_null(missing, "Missing contact");
@ -104,7 +104,7 @@ class Geary.ContactStoreImplTest : TestCase {
0, 0,
10, 10,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Collection<Contact> results = test_article.search.end( Gee.Collection<Contact> results = test_article.search.end(
async_result() async_result()
@ -118,7 +118,7 @@ class Geary.ContactStoreImplTest : TestCase {
0, 0,
10, 10,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Collection<Contact> results = test_article.search.end( Gee.Collection<Contact> results = test_article.search.end(
async_result() async_result()
@ -139,7 +139,7 @@ class Geary.ContactStoreImplTest : TestCase {
0, 0,
10, 10,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Collection<Contact> results = test_article.search.end( Gee.Collection<Contact> results = test_article.search.end(
async_result() async_result()
@ -173,7 +173,7 @@ class Geary.ContactStoreImplTest : TestCase {
0, 0,
10, 10,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Collection<Contact> results = test_article.search.end( Gee.Collection<Contact> results = test_article.search.end(
async_result() async_result()
@ -204,7 +204,7 @@ class Geary.ContactStoreImplTest : TestCase {
0, 0,
10, 10,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Collection<Contact> results = test_article.search.end( Gee.Collection<Contact> results = test_article.search.end(
async_result() async_result()
@ -226,14 +226,14 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.update_contacts.begin( test_article.update_contacts.begin(
Collection.single(not_persisted), Collection.single(not_persisted),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
test_article.update_contacts.end(async_result()); test_article.update_contacts.end(async_result());
test_article.get_by_rfc822.begin( test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "New@example.com"), new RFC822.MailboxAddress(null, "New@example.com"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Contact? persisted = test_article.get_by_rfc822.end(async_result()); Contact? persisted = test_article.get_by_rfc822.end(async_result());
assert_non_null(persisted, "persisted"); assert_non_null(persisted, "persisted");
@ -255,13 +255,13 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.update_contacts.begin( test_article.update_contacts.begin(
Collection.single(not_updated), Collection.single(not_updated),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
test_article.update_contacts.end(async_result()); test_article.update_contacts.end(async_result());
test_article.get_by_rfc822.begin( test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "Test@example.com"), new RFC822.MailboxAddress(null, "Test@example.com"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Contact? updated = test_article.get_by_rfc822.end(async_result()); Contact? updated = test_article.get_by_rfc822.end(async_result());
assert_non_null(updated, "updated"); assert_non_null(updated, "updated");
@ -276,13 +276,13 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.update_contacts.begin( test_article.update_contacts.begin(
Collection.single(not_updated), Collection.single(not_updated),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
test_article.update_contacts.end(async_result()); test_article.update_contacts.end(async_result());
test_article.get_by_rfc822.begin( test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "Test@example.com"), new RFC822.MailboxAddress(null, "Test@example.com"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Contact? updated_again = test_article.get_by_rfc822.end(async_result()); Contact? updated_again = test_article.get_by_rfc822.end(async_result());
assert_false(updated_again.flags.always_load_remote_images(), "Removed flags"); assert_false(updated_again.flags.always_load_remote_images(), "Removed flags");

View file

@ -21,10 +21,7 @@ class Geary.Db.DatabaseTest : TestCase {
public void transient_open() throws Error { public void transient_open() throws Error {
Database db = new Geary.Db.Database.transient(); Database db = new Geary.Db.Database.transient();
db.open.begin( db.open.begin(Geary.Db.DatabaseFlags.NONE, null, this.async_completion);
Geary.Db.DatabaseFlags.NONE, null,
(obj, ret) => { async_complete(ret); }
);
db.open.end(async_result()); db.open.end(async_result());
// Need to get a connection since the database doesn't // Need to get a connection since the database doesn't
@ -39,10 +36,7 @@ class Geary.Db.DatabaseTest : TestCase {
); );
Database db = new Geary.Db.Database.persistent(tmp_file); Database db = new Geary.Db.Database.persistent(tmp_file);
db.open.begin( db.open.begin(Geary.Db.DatabaseFlags.NONE, null, this.async_completion);
Geary.Db.DatabaseFlags.NONE, null,
(obj, ret) => { async_complete(ret); }
);
db.open.end(async_result()); db.open.end(async_result());
// Need to get a connection since the database doesn't // Need to get a connection since the database doesn't
@ -61,8 +55,7 @@ class Geary.Db.DatabaseTest : TestCase {
tmp_dir.get_child("test.db") tmp_dir.get_child("test.db")
); );
db.open.begin( db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null, Geary.Db.DatabaseFlags.CREATE_FILE, null, this.async_completion
(obj, ret) => { async_complete(ret); }
); );
db.open.end(async_result()); db.open.end(async_result());
@ -86,7 +79,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_DIRECTORY | Geary.Db.DatabaseFlags.CREATE_DIRECTORY |
Geary.Db.DatabaseFlags.CREATE_FILE, Geary.Db.DatabaseFlags.CREATE_FILE,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());
@ -111,7 +104,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_DIRECTORY | Geary.Db.DatabaseFlags.CREATE_DIRECTORY |
Geary.Db.DatabaseFlags.CREATE_FILE, Geary.Db.DatabaseFlags.CREATE_FILE,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());
@ -135,7 +128,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_FILE | Geary.Db.DatabaseFlags.CREATE_FILE |
Geary.Db.DatabaseFlags.CHECK_CORRUPTION, Geary.Db.DatabaseFlags.CHECK_CORRUPTION,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());
@ -160,7 +153,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_FILE | Geary.Db.DatabaseFlags.CREATE_FILE |
Geary.Db.DatabaseFlags.CHECK_CORRUPTION, Geary.Db.DatabaseFlags.CHECK_CORRUPTION,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());

View file

@ -34,8 +34,7 @@ class Geary.Db.VersionedDatabaseTest : TestCase {
); );
db.open.begin( db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null, Geary.Db.DatabaseFlags.CREATE_FILE, null, this.async_completion
(obj, ret) => { async_complete(ret); }
); );
db.open.end(async_result()); db.open.end(async_result());

View file

@ -48,7 +48,7 @@ class Geary.ImapDB.AccountTest : TestCase {
); );
this.account.open_async.begin( this.account.open_async.begin(
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.open_async.end(async_result()); this.account.open_async.end(async_result());
@ -59,7 +59,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.root = null; this.root = null;
this.account.close_async.begin( this.account.close_async.begin(
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.close_async.end(async_result()); this.account.close_async.end(async_result());
this.account = null; this.account = null;
@ -91,7 +91,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.clone_folder_async.begin( this.account.clone_folder_async.begin(
folder, folder,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.clone_folder_async.end(async_result()); this.account.clone_folder_async.end(async_result());
@ -130,7 +130,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.clone_folder_async.begin( this.account.clone_folder_async.begin(
folder, folder,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.clone_folder_async.end(async_result()); this.account.clone_folder_async.end(async_result());
@ -155,7 +155,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.list_folders_async.begin( this.account.list_folders_async.begin(
this.account.imap_folder_root, this.account.imap_folder_root,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Collection<Geary.ImapDB.Folder> result = Gee.Collection<Geary.ImapDB.Folder> result =
this.account.list_folders_async.end(async_result()); this.account.list_folders_async.end(async_result());
@ -167,7 +167,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.list_folders_async.begin( this.account.list_folders_async.begin(
test1.get_path(), test1.get_path(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
result = this.account.list_folders_async.end(async_result()); result = this.account.list_folders_async.end(async_result());
@ -178,7 +178,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.list_folders_async.begin( this.account.list_folders_async.begin(
test2.get_path(), test2.get_path(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
result = this.account.list_folders_async.end(async_result()); result = this.account.list_folders_async.end(async_result());
@ -198,14 +198,14 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.delete_folder_async.begin( this.account.delete_folder_async.begin(
this.root.get_child("test1").get_child("test2"), this.root.get_child("test1").get_child("test2"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.delete_folder_async.end(async_result()); this.account.delete_folder_async.end(async_result());
this.account.delete_folder_async.begin( this.account.delete_folder_async.begin(
this.root.get_child("test1"), this.root.get_child("test1"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.delete_folder_async.end(async_result()); this.account.delete_folder_async.end(async_result());
} }
@ -221,7 +221,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.delete_folder_async.begin( this.account.delete_folder_async.begin(
this.root.get_child("test1"), this.root.get_child("test1"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
try { try {
this.account.delete_folder_async.end(async_result()); this.account.delete_folder_async.end(async_result());
@ -242,7 +242,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.delete_folder_async.begin( this.account.delete_folder_async.begin(
this.root.get_child("test3"), this.root.get_child("test3"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
try { try {
this.account.delete_folder_async.end(async_result()); this.account.delete_folder_async.end(async_result());
@ -263,7 +263,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.fetch_folder_async.begin( this.account.fetch_folder_async.begin(
this.root.get_child("test1"), this.root.get_child("test1"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Folder? result = this.account.fetch_folder_async.end(async_result()); Folder? result = this.account.fetch_folder_async.end(async_result());
@ -282,7 +282,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.fetch_folder_async.begin( this.account.fetch_folder_async.begin(
this.root.get_child("test1").get_child("test2"), this.root.get_child("test1").get_child("test2"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Folder? result = this.account.fetch_folder_async.end(async_result()); Folder? result = this.account.fetch_folder_async.end(async_result());
@ -301,7 +301,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.fetch_folder_async.begin( this.account.fetch_folder_async.begin(
this.root.get_child("test3"), this.root.get_child("test3"),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
try { try {
this.account.fetch_folder_async.end(async_result()); this.account.fetch_folder_async.end(async_result());
@ -330,7 +330,7 @@ class Geary.ImapDB.AccountTest : TestCase {
}).to_linked_list(), }).to_linked_list(),
Email.Field.RECEIVERS, Email.Field.RECEIVERS,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.List<Email> result = this.account.list_email.end( Gee.List<Email> result = this.account.list_email.end(
async_result() async_result()
@ -344,7 +344,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Collection.single(new EmailIdentifier(3, null)), Collection.single(new EmailIdentifier(3, null)),
Email.Field.RECEIVERS, Email.Field.RECEIVERS,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
try { try {
this.account.list_email.end(async_result()); this.account.list_email.end(async_result());
@ -357,7 +357,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Collection.single(new EmailIdentifier(1, null)), Collection.single(new EmailIdentifier(1, null)),
Email.Field.BODY, Email.Field.BODY,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
try { try {
this.account.list_email.end(async_result()); this.account.list_email.end(async_result());

View file

@ -119,7 +119,7 @@ class Geary.ImapDB.AttachmentIoTest : TestCase {
this.db = new Geary.Db.Database.transient(); this.db = new Geary.Db.Database.transient();
this.db.open.begin( this.db.open.begin(
Geary.Db.DatabaseFlags.NONE, null, Geary.Db.DatabaseFlags.NONE, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
this.db.open.end(async_result()); this.db.open.end(async_result());
this.db.exec(""" this.db.exec("""
@ -150,7 +150,7 @@ CREATE TABLE MessageAttachmentTable (
Files.recursive_delete_async.begin( Files.recursive_delete_async.begin(
this.tmp_dir, GLib.Priority.DEFAULT, null, this.tmp_dir, GLib.Priority.DEFAULT, null,
(obj, res) => { async_complete(res); } this.async_completion
); );
Files.recursive_delete_async.end(async_result()); Files.recursive_delete_async.end(async_result());
this.tmp_dir = null; this.tmp_dir = null;

View file

@ -42,7 +42,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
db.open.begin( db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null, Geary.Db.DatabaseFlags.CREATE_FILE, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());
@ -102,7 +102,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
db.open.begin( db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null, Geary.Db.DatabaseFlags.CREATE_FILE, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());
@ -136,7 +136,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
db.open.begin( db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null, Geary.Db.DatabaseFlags.CREATE_FILE, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
db.open.end(async_result()); db.open.end(async_result());

View file

@ -47,7 +47,7 @@ class Geary.ImapDB.FolderTest : TestCase {
); );
this.account.open_async.begin( this.account.open_async.begin(
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.open_async.end(async_result()); this.account.open_async.end(async_result());
@ -58,7 +58,7 @@ class Geary.ImapDB.FolderTest : TestCase {
this.account.list_folders_async.begin( this.account.list_folders_async.begin(
this.account.imap_folder_root, this.account.imap_folder_root,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.folder = traverse<Folder>( this.folder = traverse<Folder>(
this.account.list_folders_async.end(async_result()) this.account.list_folders_async.end(async_result())
@ -69,7 +69,7 @@ class Geary.ImapDB.FolderTest : TestCase {
this.folder = null; this.folder = null;
this.account.close_async.begin( this.account.close_async.begin(
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.account.close_async.end(async_result()); this.account.close_async.end(async_result());
this.account = null; this.account = null;
@ -87,7 +87,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true, true,
new MockContactHarvester(), new MockContactHarvester(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Map<Email,bool> results = Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result()); this.folder.create_or_merge_email_async.end(async_result());
@ -107,7 +107,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true, true,
new MockContactHarvester(), new MockContactHarvester(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Map<Email,bool> results = Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result()); this.folder.create_or_merge_email_async.end(async_result());
@ -127,7 +127,7 @@ class Geary.ImapDB.FolderTest : TestCase {
false, false,
new MockContactHarvester(), new MockContactHarvester(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Map<Email,bool> results = Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result()); this.folder.create_or_merge_email_async.end(async_result());
@ -157,7 +157,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true, true,
new MockContactHarvester(), new MockContactHarvester(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Map<Email,bool> results = Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result()); this.folder.create_or_merge_email_async.end(async_result());
@ -172,7 +172,7 @@ class Geary.ImapDB.FolderTest : TestCase {
fixture_fields | mock.fields, fixture_fields | mock.fields,
Folder.ListFlags.NONE, Folder.ListFlags.NONE,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Email? merged = null; Email? merged = null;
try { try {
@ -208,7 +208,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true, true,
new MockContactHarvester(), new MockContactHarvester(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Map<Email,bool> results = Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result()); this.folder.create_or_merge_email_async.end(async_result());
@ -242,7 +242,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true, true,
new MockContactHarvester(), new MockContactHarvester(),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Gee.Map<Email,bool> results = Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result()); this.folder.create_or_merge_email_async.end(async_result());
@ -280,7 +280,7 @@ class Geary.ImapDB.FolderTest : TestCase {
this.folder.set_email_flags_async.begin( this.folder.set_email_flags_async.begin(
Collection.single_map(test, test_flags), Collection.single_map(test, test_flags),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.folder.set_email_flags_async.end(async_result()); this.folder.set_email_flags_async.end(async_result());
@ -316,7 +316,7 @@ class Geary.ImapDB.FolderTest : TestCase {
this.folder.set_email_flags_async.begin( this.folder.set_email_flags_async.begin(
Collection.single_map(test, test_flags), Collection.single_map(test, test_flags),
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
this.folder.set_email_flags_async.end(async_result()); this.folder.set_email_flags_async.end(async_result());
@ -347,7 +347,7 @@ class Geary.ImapDB.FolderTest : TestCase {
Email.Field.FLAGS, Email.Field.FLAGS,
Folder.ListFlags.INCLUDE_MARKED_FOR_REMOVE, Folder.ListFlags.INCLUDE_MARKED_FOR_REMOVE,
null, null,
(obj, ret) => { async_complete(ret); } this.async_completion
); );
Email? merged = null; Email? merged = null;
try { try {

View file

@ -57,18 +57,12 @@ public class Geary.ImapEngine.GenericAccountTest : TestCase {
this.tmp_dir, this.tmp_dir,
GLib.File.new_for_path(_SOURCE_ROOT_DIR).get_child("sql") GLib.File.new_for_path(_SOURCE_ROOT_DIR).get_child("sql")
); );
this.local_account.open_async.begin( this.local_account.open_async.begin(null, this.async_completion);
null,
(obj, ret) => { async_complete(ret); }
);
this.local_account.open_async.end(async_result()); this.local_account.open_async.end(async_result());
} }
public override void tear_down() throws GLib.Error { public override void tear_down() throws GLib.Error {
this.local_account.close_async.begin( this.local_account.close_async.begin(null, this.async_completion);
null,
(obj, ret) => { async_complete(ret); }
);
this.local_account.close_async.end(async_result()); this.local_account.close_async.end(async_result());
this.local_account = null; this.local_account = null;
this.config = null; this.config = null;

View file

@ -40,13 +40,13 @@ class Geary.Imap.ClientConnectionTest : TestCase {
public void connect_disconnect() throws GLib.Error { public void connect_disconnect() throws GLib.Error {
var test_article = new ClientConnection(new_endpoint()); var test_article = new ClientConnection(new_endpoint());
test_article.connect_async.begin(null, this.async_complete_full); test_article.connect_async.begin(null, this.async_completion);
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_non_null(test_article.get_remote_address()); assert_non_null(test_article.get_remote_address());
assert_non_null(test_article.get_local_address()); assert_non_null(test_article.get_local_address());
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
assert_null(test_article.get_remote_address()); assert_null(test_article.get_remote_address());
@ -71,7 +71,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
var test_article = new ClientConnection( var test_article = new ClientConnection(
new_endpoint(), COMMAND_TIMEOUT, IDLE_TIMEOUT new_endpoint(), COMMAND_TIMEOUT, IDLE_TIMEOUT
); );
test_article.connect_async.begin(null, this.async_complete_full); test_article.connect_async.begin(null, this.async_completion);
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_false(test_article.is_in_idle(), "Initial idle state"); assert_false(test_article.is_in_idle(), "Initial idle state");
@ -98,12 +98,12 @@ class Geary.Imap.ClientConnectionTest : TestCase {
var command = new TestCommand(); var command = new TestCommand();
test_article.send_command(command); test_article.send_command(command);
command.wait_until_complete.begin(null, this.async_complete_full); command.wait_until_complete.begin(null, this.async_completion);
command.wait_until_complete.end(async_result()); command.wait_until_complete.end(async_result());
assert_false(test_article.is_in_idle(), "Post test command"); assert_false(test_article.is_in_idle(), "Post test command");
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
TestServer.Result result = this.server.wait_for_script(this.main_loop); TestServer.Result result = this.server.wait_for_script(this.main_loop);
@ -126,7 +126,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
var test_article = new ClientConnection(new_endpoint(), TIMEOUT); var test_article = new ClientConnection(new_endpoint(), TIMEOUT);
test_article.sent_command.connect(() => { sent = true; }); test_article.sent_command.connect(() => { sent = true; });
test_article.receive_failure.connect(() => { recv_fail = true; }); test_article.receive_failure.connect(() => { recv_fail = true; });
test_article.connect_async.begin(null, this.async_complete_full); test_article.connect_async.begin(null, this.async_completion);
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
var command = new TestCommand(); var command = new TestCommand();
@ -140,7 +140,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
this.main_loop.iteration(false); this.main_loop.iteration(false);
} }
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
assert_true(sent, "connection.sent_command"); assert_true(sent, "connection.sent_command");

View file

@ -47,12 +47,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
@ -71,13 +71,13 @@ class Geary.Imap.ClientSessionTest : TestCase {
var test_article = new ClientSession(new_endpoint()); var test_article = new ClientSession(new_endpoint());
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.capabilities.supports_imap4rev1()); assert_true(test_article.capabilities.supports_imap4rev1());
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
TestServer.Result result = this.server.wait_for_script(this.main_loop); TestServer.Result result = this.server.wait_for_script(this.main_loop);
@ -92,7 +92,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
GLib.Timer timer = new GLib.Timer(); GLib.Timer timer = new GLib.Timer();
timer.start(); timer.start();
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
try { try {
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
@ -117,19 +117,19 @@ class Geary.Imap.ClientSessionTest : TestCase {
var test_article = new ClientSession(new_endpoint()); var test_article = new ClientSession(new_endpoint());
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
test_article.login_async.begin( test_article.login_async.begin(
new Credentials(PASSWORD, "test", "password"), new Credentials(PASSWORD, "test", "password"),
null, null,
this.async_complete_full this.async_completion
); );
test_article.login_async.end(async_result()); test_article.login_async.end(async_result());
assert_true(test_article.capabilities.supports_imap4rev1()); assert_true(test_article.capabilities.supports_imap4rev1());
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
TestServer.Result result = this.server.wait_for_script(this.main_loop); TestServer.Result result = this.server.wait_for_script(this.main_loop);
@ -151,7 +151,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@ -159,12 +159,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.login_async.begin( test_article.login_async.begin(
new Credentials(PASSWORD, "test", "password"), new Credentials(PASSWORD, "test", "password"),
null, null,
this.async_complete_full this.async_completion
); );
test_article.login_async.end(async_result()); test_article.login_async.end(async_result());
assert_true(test_article.get_protocol_state() == AUTHORIZED); assert_true(test_article.get_protocol_state() == AUTHORIZED);
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
@ -188,12 +188,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
test_article.logout_async.begin(null, this.async_complete_full); test_article.logout_async.begin(null, this.async_completion);
test_article.logout_async.end(async_result()); test_article.logout_async.end(async_result());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
@ -219,7 +219,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@ -227,12 +227,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.login_async.begin( test_article.login_async.begin(
new Credentials(PASSWORD, "test", "password"), new Credentials(PASSWORD, "test", "password"),
null, null,
this.async_complete_full this.async_completion
); );
test_article.login_async.end(async_result()); test_article.login_async.end(async_result());
assert_true(test_article.get_protocol_state() == AUTHORIZED); assert_true(test_article.get_protocol_state() == AUTHORIZED);
test_article.logout_async.begin(null, this.async_complete_full); test_article.logout_async.begin(null, this.async_completion);
test_article.logout_async.end(async_result()); test_article.logout_async.end(async_result());
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
@ -264,7 +264,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@ -272,7 +272,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.initiate_session_async.begin( test_article.initiate_session_async.begin(
new Credentials(PASSWORD, "test", "password"), new Credentials(PASSWORD, "test", "password"),
null, null,
this.async_complete_full this.async_completion
); );
test_article.initiate_session_async.end(async_result()); test_article.initiate_session_async.end(async_result());
@ -283,7 +283,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_string("Inbox", test_article.inbox.mailbox.name); assert_string("Inbox", test_article.inbox.mailbox.name);
assert_true(test_article.inbox.mailbox.is_inbox); assert_true(test_article.inbox.mailbox.is_inbox);
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
TestServer.Result result = this.server.wait_for_script(this.main_loop); TestServer.Result result = this.server.wait_for_script(this.main_loop);
@ -308,7 +308,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@ -316,7 +316,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.initiate_session_async.begin( test_article.initiate_session_async.begin(
new Credentials(PASSWORD, "test", "password"), new Credentials(PASSWORD, "test", "password"),
null, null,
this.async_complete_full this.async_completion
); );
test_article.initiate_session_async.end(async_result()); test_article.initiate_session_async.end(async_result());
@ -327,7 +327,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_string("Inbox", test_article.inbox.mailbox.name); assert_string("Inbox", test_article.inbox.mailbox.name);
assert_true(test_article.inbox.mailbox.is_inbox); assert_true(test_article.inbox.mailbox.is_inbox);
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
TestServer.Result result = this.server.wait_for_script(this.main_loop); TestServer.Result result = this.server.wait_for_script(this.main_loop);
@ -371,7 +371,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED); assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
test_article.connect_async.begin( test_article.connect_async.begin(
CONNECT_TIMEOUT, null, this.async_complete_full CONNECT_TIMEOUT, null, this.async_completion
); );
test_article.connect_async.end(async_result()); test_article.connect_async.end(async_result());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED); assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@ -379,7 +379,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.initiate_session_async.begin( test_article.initiate_session_async.begin(
new Credentials(PASSWORD, "test", "password"), new Credentials(PASSWORD, "test", "password"),
null, null,
this.async_complete_full this.async_completion
); );
test_article.initiate_session_async.end(async_result()); test_article.initiate_session_async.end(async_result());
@ -398,7 +398,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
"user.", test_article.get_other_users_namespaces()[0].prefix "user.", test_article.get_other_users_namespaces()[0].prefix
); );
test_article.disconnect_async.begin(null, this.async_complete_full); test_article.disconnect_async.begin(null, this.async_completion);
test_article.disconnect_async.end(async_result()); test_article.disconnect_async.end(async_result());
TestServer.Result result = this.server.wait_for_script(this.main_loop); TestServer.Result result = this.server.wait_for_script(this.main_loop);

View file

@ -51,7 +51,7 @@ class Geary.Imap.DeserializerTest : TestCase {
} }
public override void tear_down() { public override void tear_down() {
this.deser.stop_async.begin((obj, ret) => { async_complete(ret); }); this.deser.stop_async.begin(this.async_completion);
async_result(); async_result();
this.stream = null; this.stream = null;
} }
@ -62,7 +62,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.data); this.stream.add_data(bytes.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert_int(2, message.size); assert_int(2, message.size);
@ -76,7 +76,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.data); this.stream.add_data(bytes.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert_int(2, message.size); assert_int(2, message.size);
@ -90,7 +90,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.data); this.stream.add_data(bytes.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert_int(2, message.size); assert_int(2, message.size);
@ -104,7 +104,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.data); this.stream.add_data(bytes.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert_int(2, message.size); assert_int(2, message.size);
@ -118,7 +118,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.data); this.stream.add_data(bytes.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert_int(2, message.size); assert_int(2, message.size);
@ -136,7 +136,7 @@ class Geary.Imap.DeserializerTest : TestCase {
// deserializer currently silently ignores lines with // deserializer currently silently ignores lines with
// malformed lists and continues parsing, so we get to the end // malformed lists and continues parsing, so we get to the end
// of the stream. // of the stream.
this.process.begin(Expect.EOS, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.EOS, this.async_completion);
this.process.end(async_result()); this.process.end(async_result());
} }
@ -150,7 +150,7 @@ class Geary.Imap.DeserializerTest : TestCase {
// deserializer currently silently ignores lines with // deserializer currently silently ignores lines with
// malformed lists and continues parsing, so we get to the end // malformed lists and continues parsing, so we get to the end
// of the stream. // of the stream.
this.process.begin(Expect.EOS, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.EOS, this.async_completion);
this.process.end(async_result()); this.process.end(async_result());
} }
@ -159,7 +159,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(greeting.data); this.stream.add_data(greeting.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == greeting); assert(message.to_string() == greeting);
@ -170,7 +170,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(greeting.data); this.stream.add_data(greeting.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == greeting); assert(message.to_string() == greeting);
@ -182,7 +182,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(greeting.data); this.stream.add_data(greeting.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == parsed); assert(message.to_string() == parsed);
@ -193,7 +193,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.data); this.stream.add_data(flags.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.DESER_FAIL, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.DESER_FAIL, this.async_completion);
this.process.end(async_result()); this.process.end(async_result());
} }
@ -202,7 +202,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.data); this.stream.add_data(flags.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == flags); assert(message.to_string() == flags);
@ -213,7 +213,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.data); this.stream.add_data(flags.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == flags); assert(message.to_string() == flags);
@ -224,7 +224,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.data); this.stream.add_data(flags.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == flags); assert(message.to_string() == flags);
@ -239,7 +239,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.data); this.stream.add_data(flags.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == expected); assert(message.to_string() == expected);
@ -250,12 +250,12 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.data); this.stream.add_data(flags.data);
this.stream.add_data(EOL.data); this.stream.add_data(EOL.data);
this.process.begin(Expect.DESER_FAIL, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.DESER_FAIL, this.async_completion);
this.process.end(async_result()); this.process.end(async_result());
} }
public void instant_eos() throws Error { public void instant_eos() throws Error {
this.process.begin(Expect.EOS, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.EOS, this.async_completion);
this.process.end(async_result()); this.process.end(async_result());
assert(this.deser.is_halted()); assert(this.deser.is_halted());
} }
@ -267,7 +267,7 @@ class Geary.Imap.DeserializerTest : TestCase {
bool eos = false; bool eos = false;
this.deser.end_of_stream.connect(() => { eos = true; }); this.deser.end_of_stream.connect(() => { eos = true; });
this.process.begin(Expect.MESSAGE, (obj, ret) => { async_complete(ret); }); this.process.begin(Expect.MESSAGE, this.async_completion);
RootParameters? message = this.process.end(async_result()); RootParameters? message = this.process.end(async_result());
assert(message.to_string() == bye); assert(message.to_string() == bye);
assert(eos); assert(eos);

View file

@ -231,7 +231,7 @@ This is the second line.
this.message_from_composed_email.begin( this.message_from_composed_email.begin(
composed, composed,
async_complete_full this.async_completion
); );
Geary.RFC822.Message message = message_from_composed_email.end(async_result()); Geary.RFC822.Message message = message_from_composed_email.end(async_result());
@ -261,7 +261,7 @@ This is the second line.
this.message_from_composed_email.begin( this.message_from_composed_email.begin(
composed, composed,
async_complete_full this.async_completion
); );
Geary.RFC822.Message message = message_from_composed_email.end(async_result()); Geary.RFC822.Message message = message_from_composed_email.end(async_result());
@ -286,7 +286,7 @@ This is the second line.
this.message_from_composed_email.begin( this.message_from_composed_email.begin(
composed, composed,
async_complete_full this.async_completion
); );
Geary.RFC822.Message message = message_from_composed_email.end(async_result()); Geary.RFC822.Message message = message_from_composed_email.end(async_result());
@ -343,7 +343,7 @@ This is the second line.
this.message_from_composed_email.begin( this.message_from_composed_email.begin(
composed, composed,
async_complete_full this.async_completion
); );
Geary.RFC822.Message message = message_from_composed_email.end(async_result()); Geary.RFC822.Message message = message_from_composed_email.end(async_result());

View file

@ -27,7 +27,7 @@ class Geary.RFC822.Utils.Test : TestCase {
public void best_encoding_default() throws GLib.Error { public void best_encoding_default() throws GLib.Error {
string test = "abc"; string test = "abc";
var stream = new GMime.StreamMem.with_buffer(test.data); var stream = new GMime.StreamMem.with_buffer(test.data);
get_best_encoding.begin(stream, 7BIT, null, async_complete_full); get_best_encoding.begin(stream, 7BIT, null, this.async_completion);
var encoding = get_best_encoding.end(async_result()); var encoding = get_best_encoding.end(async_result());
assert_true(encoding == DEFAULT); assert_true(encoding == DEFAULT);
} }
@ -38,7 +38,7 @@ class Geary.RFC822.Utils.Test : TestCase {
buf.append("long "); buf.append("long ");
} }
var stream = new GMime.StreamMem.with_buffer(buf.str.data); var stream = new GMime.StreamMem.with_buffer(buf.str.data);
get_best_encoding.begin(stream, 7BIT, null, async_complete_full); get_best_encoding.begin(stream, 7BIT, null, this.async_completion);
var encoding = get_best_encoding.end(async_result()); var encoding = get_best_encoding.end(async_result());
assert_true(encoding == QUOTEDPRINTABLE); assert_true(encoding == QUOTEDPRINTABLE);
} }
@ -46,7 +46,7 @@ class Geary.RFC822.Utils.Test : TestCase {
public void best_encoding_binary() throws GLib.Error { public void best_encoding_binary() throws GLib.Error {
uint8 test[] = { 0x20, 0x00, 0x20 }; uint8 test[] = { 0x20, 0x00, 0x20 };
var stream = new GMime.StreamMem.with_buffer(test); var stream = new GMime.StreamMem.with_buffer(test);
get_best_encoding.begin(stream, 7BIT, null, async_complete_full); get_best_encoding.begin(stream, 7BIT, null, this.async_completion);
var encoding = get_best_encoding.end(async_result()); var encoding = get_best_encoding.end(async_result());
assert_true(encoding == BASE64); assert_true(encoding == BASE64);
} }

View file

@ -34,17 +34,17 @@ class Integration.Imap.ClientSession : TestCase {
public override void tear_down() throws GLib.Error { public override void tear_down() throws GLib.Error {
if (this.session.get_protocol_state() != NOT_CONNECTED) { if (this.session.get_protocol_state() != NOT_CONNECTED) {
this.session.disconnect_async.begin(null, async_complete_full); this.session.disconnect_async.begin(null, this.async_completion);
this.session.disconnect_async.end(async_result()); this.session.disconnect_async.end(async_result());
} }
this.session = null; this.session = null;
} }
public void session_connect() throws GLib.Error { public void session_connect() throws GLib.Error {
this.session.connect_async.begin(2, null, async_complete_full); this.session.connect_async.begin(2, null, this.async_completion);
this.session.connect_async.end(async_result()); this.session.connect_async.end(async_result());
this.session.disconnect_async.begin(null, async_complete_full); this.session.disconnect_async.begin(null, this.async_completion);
this.session.disconnect_async.end(async_result()); this.session.disconnect_async.end(async_result());
} }
@ -55,7 +55,7 @@ class Integration.Imap.ClientSession : TestCase {
PASSWORD, "automated-integration-test", "password" PASSWORD, "automated-integration-test", "password"
); );
this.session.login_async.begin( this.session.login_async.begin(
password_creds, null, async_complete_full password_creds, null, this.async_completion
); );
try { try {
this.session.login_async.end(async_result()); this.session.login_async.end(async_result());
@ -78,7 +78,7 @@ class Integration.Imap.ClientSession : TestCase {
OAUTH2, "automated-integration-test", "password" OAUTH2, "automated-integration-test", "password"
); );
this.session.login_async.begin( this.session.login_async.begin(
oauth2_creds, null, async_complete_full oauth2_creds, null, this.async_completion
); );
try { try {
this.session.login_async.end(async_result()); this.session.login_async.end(async_result());
@ -92,13 +92,13 @@ class Integration.Imap.ClientSession : TestCase {
do_connect(); do_connect();
this.session.initiate_session_async.begin( this.session.initiate_session_async.begin(
this.config.credentials, null, async_complete_full this.config.credentials, null, this.async_completion
); );
this.session.initiate_session_async.end(async_result()); this.session.initiate_session_async.end(async_result());
} }
private void do_connect() throws GLib.Error { private void do_connect() throws GLib.Error {
this.session.connect_async.begin(5, null, async_complete_full); this.session.connect_async.begin(5, null, this.async_completion);
this.session.connect_async.end(async_result()); this.session.connect_async.end(async_result());
} }

View file

@ -37,7 +37,7 @@ class Integration.Smtp.ClientSession : TestCase {
public override void tear_down() throws GLib.Error { public override void tear_down() throws GLib.Error {
try { try {
this.session.logout_async.begin(false, null, async_complete_full); this.session.logout_async.begin(false, null, this.async_completion);
this.session.logout_async.end(async_result()); this.session.logout_async.end(async_result());
} catch (GLib.Error err) { } catch (GLib.Error err) {
// Oh well // Oh well
@ -52,7 +52,7 @@ class Integration.Smtp.ClientSession : TestCase {
"deliberately-invalid-password" "deliberately-invalid-password"
); );
this.session.login_async.begin( this.session.login_async.begin(
password_creds, null, async_complete_full password_creds, null, this.async_completion
); );
try { try {
this.session.login_async.end(async_result()); this.session.login_async.end(async_result());
@ -69,7 +69,7 @@ class Integration.Smtp.ClientSession : TestCase {
"deliberately-invalid-token" "deliberately-invalid-token"
); );
this.session.login_async.begin( this.session.login_async.begin(
oauth2_creds, null, async_complete_full oauth2_creds, null, this.async_completion
); );
try { try {
this.session.login_async.end(async_result()); this.session.login_async.end(async_result());
@ -97,7 +97,7 @@ class Integration.Smtp.ClientSession : TestCase {
"Geary integration test", "Geary integration test",
this.config.credentials.user this.config.credentials.user
), ),
async_complete_full this.async_completion
); );
Geary.RFC822.Message message = new_message.end(async_result()); Geary.RFC822.Message message = new_message.end(async_result());
@ -105,14 +105,14 @@ class Integration.Smtp.ClientSession : TestCase {
return_path, return_path,
message, message,
null, null,
async_complete_full this.async_completion
); );
this.session.send_email_async.end(async_result()); this.session.send_email_async.end(async_result());
} }
private void do_connect() throws GLib.Error { private void do_connect() throws GLib.Error {
this.session.login_async.begin( this.session.login_async.begin(
this.config.credentials, null, async_complete_full this.config.credentials, null, this.async_completion
); );
this.session.login_async.end(async_result()); this.session.login_async.end(async_result());
} }

View file

@ -360,17 +360,8 @@ public abstract class TestCase : GLib.Object {
* *
* @see AsyncResultWaiter.async_completion * @see AsyncResultWaiter.async_completion
*/ */
protected void async_complete(AsyncResult result) { protected void async_completion(GLib.Object? object,
this.async_waiter.async_completion(null, result); AsyncResult result) {
}
/**
* Calls the same method on the test case's default async waiter.
*
* @see AsyncResultWaiter.async_completion
*/
protected void async_complete_full(GLib.Object? object,
AsyncResult result) {
this.async_waiter.async_completion(object, result); this.async_waiter.async_completion(object, result);
} }