[geary/mjog/async-unit-test-improvements: 4/6] test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/mjog/async-unit-test-improvements: 4/6] test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's
- Date: Fri, 10 Apr 2020 04:33:35 +0000 (UTC)
commit 196f05e595f2175c12b12dec21f466cc2d425c69
Author: Michael Gratton <mike vee net>
Date: Fri Apr 10 12:58:09 2020 +1000
test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's
test/client/accounts/accounts-manager-test.vala | 18 ++++----
.../components/client-web-view-test-case.vala | 5 +--
test/client/composer/composer-web-view-test.vala | 28 ++++++------
test/engine/api/geary-attachment-test.vala | 36 ++++------------
test/engine/app/app-conversation-monitor-test.vala | 10 ++---
.../common/common-contact-harvester-test.vala | 20 +++------
.../common/common-contact-store-impl-test.vala | 28 ++++++------
test/engine/db/db-database-test.vala | 21 +++------
test/engine/db/db-versioned-database-test.vala | 3 +-
test/engine/imap-db/imap-db-account-test.vala | 34 +++++++--------
test/engine/imap-db/imap-db-attachment-test.vala | 4 +-
test/engine/imap-db/imap-db-database-test.vala | 6 +--
test/engine/imap-db/imap-db-folder-test.vala | 26 +++++------
.../imap-engine-generic-account-test.vala | 10 +----
.../transport/imap-client-connection-test.vala | 14 +++---
.../imap/transport/imap-client-session-test.vala | 50 +++++++++++-----------
.../imap/transport/imap-deserializer-test.vala | 38 ++++++++--------
test/engine/rfc822-message-test.vala | 8 ++--
test/engine/rfc822-utils-test.vala | 6 +--
test/integration/imap/client-session.vala | 14 +++---
test/integration/smtp/client-session.vala | 12 +++---
test/test-case.vala | 13 +-----
22 files changed, 175 insertions(+), 229 deletions(-)
---
diff --git a/test/client/accounts/accounts-manager-test.vala b/test/client/accounts/accounts-manager-test.vala
index 5a883957..0495133f 100644
--- a/test/client/accounts/accounts-manager-test.vala
+++ b/test/client/accounts/accounts-manager-test.vala
@@ -82,7 +82,7 @@ class Accounts.ManagerTest : TestCase {
this.test.create_account.begin(
account, new GLib.Cancellable(),
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
this.test.create_account.end(async_result());
@@ -95,7 +95,7 @@ class Accounts.ManagerTest : TestCase {
public void create_orphan_account() throws GLib.Error {
this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
Geary.AccountInformation account1 =
this.test.new_orphan_account.end(async_result());
@@ -103,13 +103,13 @@ class Accounts.ManagerTest : TestCase {
this.test.create_account.begin(
account1, new GLib.Cancellable(),
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
this.test.create_account.end(async_result());
this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
Geary.AccountInformation account2 =
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 {
this.test.create_account.begin(
account, new GLib.Cancellable(),
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
this.test.create_account.end(async_result());
this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
Geary.AccountInformation account1 =
this.test.new_orphan_account.end(async_result());
@@ -133,13 +133,13 @@ class Accounts.ManagerTest : TestCase {
this.test.create_account.begin(
account1, new GLib.Cancellable(),
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
this.test.create_account.end(async_result());
this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
Geary.AccountInformation account2 =
this.test.new_orphan_account.end(async_result());
@@ -154,7 +154,7 @@ class Accounts.ManagerTest : TestCase {
this.test.new_orphan_account.begin(
Geary.ServiceProvider.OTHER, this.primary_mailbox, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
Geary.AccountInformation account =
this.test.new_orphan_account.end(async_result());
diff --git a/test/client/components/client-web-view-test-case.vala
b/test/client/components/client-web-view-test-case.vala
index d1212afb..a1abab26 100644
--- a/test/client/components/client-web-view-test-case.vala
+++ b/test/client/components/client-web-view-test-case.vala
@@ -43,10 +43,7 @@ public abstract class ClientWebViewTestCase<V> : TestCase {
protected WebKit.JavascriptResult run_javascript(string command) throws Error {
ClientWebView view = (ClientWebView) this.test_view;
- view.run_javascript.begin(
- command, null, (obj, res) => { async_complete(res); }
- );
-
+ view.run_javascript.begin(command, null, this.async_completion);
return view.run_javascript.end(async_result());
}
diff --git a/test/client/composer/composer-web-view-test.vala
b/test/client/composer/composer-web-view-test.vala
index bac7e7f0..2d2f25a0 100644
--- a/test/client/composer/composer-web-view-test.vala
+++ b/test/client/composer/composer-web-view-test.vala
@@ -54,7 +54,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public void get_html() throws GLib.Error {
string BODY = "<p>para</p>";
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());
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 {
string BODY = "<p>para</p>";
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());
assert_string(PageStateTest.COMPLETE_BODY_TEMPLATE.printf(BODY), html);
}
public void get_text() throws Error {
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 {
assert(this.test_view.get_text.end(async_result()) == "para\n\n\n\n\n");
} catch (Error err) {
@@ -80,7 +80,7 @@ public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
public void get_text_with_quote() throws Error {
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 {
assert(this.test_view.get_text.end(async_result()) ==
"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 {
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 {
assert(this.test_view.get_text.end(async_result()) ==
"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
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 {
assert(this.test_view.get_text.end(async_result()) ==
"""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
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 {
assert(this.test_view.get_text.end(async_result()) ==
"""> A long, long, long, long, long, long line. Well, longer than
@@ -157,7 +157,7 @@ long long, long long, long.
</div>
""");
- this.test_view.get_text.begin((obj, ret) => { async_complete(ret); });
+ this.test_view.get_text.begin(this.async_completion);
try {
assert(this.test_view.get_text.end(async_result()) ==
"""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 {
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 {
assert(this.test_view.get_text.end(async_result()) ==
"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 {
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 {
assert(this.test_view.get_text.end(async_result()) ==
"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 {
load_body_fixture(" I like my space ");
- this.test_view.get_text.begin((obj, ret) => { async_complete(ret); });
+ this.test_view.get_text.begin(this.async_completion);
try {
assert(this.test_view.get_text.end(async_result()) ==
" 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";
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());
assert_true(BODY in html, "Body not present");
assert_true(SIG1 in html, "Signature 1 not present");
const string SIG2 = "signature text 2";
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());
assert_true(BODY in html, "Body not present");
assert_false(SIG1 in html, "Signature 1 still present");
assert_true(SIG2 in html, "Signature 2 not present");
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());
assert_true(BODY in html, "Body not present");
assert_false(SIG1 in html, "Signature 1 still present");
diff --git a/test/engine/api/geary-attachment-test.vala b/test/engine/api/geary-attachment-test.vala
index 814ca7b7..6db441cf 100644
--- a/test/engine/api/geary-attachment-test.vala
+++ b/test/engine/api/geary-attachment-test.vala
@@ -83,9 +83,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == TEST_FILENAME);
}
@@ -102,9 +100,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
}
@@ -121,9 +117,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
}
@@ -139,9 +133,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
}
@@ -157,9 +149,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
}
@@ -176,9 +166,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(ALT_TEXT, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(ALT_TEXT, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == RESULT_FILENAME);
}
@@ -194,9 +182,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert(test.get_safe_file_name.end(async_result()) == TEST_FILENAME);
}
@@ -214,9 +200,7 @@ class Geary.AttachmentTest : TestCase {
this.file
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
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)
);
- test.get_safe_file_name.begin(null, (obj, ret) => {
- async_complete(ret);
- });
+ test.get_safe_file_name.begin(null, this.async_completion);
assert_string(TEST_FILENAME, test.get_safe_file_name.end(async_result()));
}
diff --git a/test/engine/app/app-conversation-monitor-test.vala
b/test/engine/app/app-conversation-monitor-test.vala
index 81043dca..3bec1de7 100644
--- a/test/engine/app/app-conversation-monitor-test.vala
+++ b/test/engine/app/app-conversation-monitor-test.vala
@@ -78,7 +78,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
this.base_folder.expect_call("close_async");
monitor.start_monitoring.begin(
- NONE, test_cancellable, (obj, res) => { async_complete(res); }
+ NONE, test_cancellable, this.async_completion
);
monitor.start_monitoring.end(async_result());
@@ -88,7 +88,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
}
monitor.stop_monitoring.begin(
- test_cancellable, (obj, res) => { async_complete(res); }
+ test_cancellable, this.async_completion
);
monitor.stop_monitoring.end(async_result());
@@ -108,7 +108,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
.throws(new EngineError.SERVER_UNAVAILABLE("Mock error"));
monitor.start_monitoring.begin(
- NONE, null, (obj, res) => { async_complete(res); }
+ NONE, null, this.async_completion
);
try {
monitor.start_monitoring.end(async_result());
@@ -246,7 +246,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
// error out during later tests
this.base_folder.expect_call("close_async");
monitor.stop_monitoring.begin(
- null, (obj, res) => { async_complete(res); }
+ null, this.async_completion
);
monitor.stop_monitoring.end(async_result());
}
@@ -477,7 +477,7 @@ class Geary.App.ConversationMonitorTest : TestCase {
}
monitor.start_monitoring.begin(
- NONE, test_cancellable, (obj, res) => { async_complete(res); }
+ NONE, test_cancellable, this.async_completion
);
monitor.start_monitoring.end(async_result());
diff --git a/test/engine/common/common-contact-harvester-test.vala
b/test/engine/common/common-contact-harvester-test.vala
index fcb7bf2a..fb5efbf7 100644
--- a/test/engine/common/common-contact-harvester-test.vala
+++ b/test/engine/common/common-contact-harvester-test.vala
@@ -64,9 +64,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
);
whitelisted.harvest_from_email.begin(
- Collection.single(this.email), null,
- (obj, ret) => { async_complete(ret); }
- );
+ Collection.single(this.email), null, this.async_completion);
whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations();
@@ -92,9 +90,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
);
whitelisted.harvest_from_email.begin(
- Collection.single(this.email), null,
- (obj, ret) => { async_complete(ret); }
- );
+ Collection.single(this.email), null, this.async_completion);
whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations();
@@ -113,9 +109,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
);
whitelisted.harvest_from_email.begin(
- Collection.single(this.email), null,
- (obj, ret) => { async_complete(ret); }
- );
+ Collection.single(this.email), null, this.async_completion);
whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations();
@@ -142,9 +136,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
);
whitelisted.harvest_from_email.begin(
- Collection.single(this.email), null,
- (obj, ret) => { async_complete(ret); }
- );
+ Collection.single(this.email), null, this.async_completion);
whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations();
@@ -171,9 +163,7 @@ class Geary.ContactHarvesterImplTest : TestCase {
);
whitelisted.harvest_from_email.begin(
- Collection.single(this.email), null,
- (obj, ret) => { async_complete(ret); }
- );
+ Collection.single(this.email), null, this.async_completion);
whitelisted.harvest_from_email.end(async_result());
this.store.assert_expectations();
diff --git a/test/engine/common/common-contact-store-impl-test.vala
b/test/engine/common/common-contact-store-impl-test.vala
index 2bc50dea..2e65e776 100644
--- a/test/engine/common/common-contact-store-impl-test.vala
+++ b/test/engine/common/common-contact-store-impl-test.vala
@@ -42,7 +42,7 @@ class Geary.ContactStoreImplTest : TestCase {
);
this.db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.db.open.end(async_result());
@@ -79,7 +79,7 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "Test example com"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Contact? existing = test_article.get_by_rfc822.end(async_result());
assert_non_null(existing, "Existing contact");
@@ -92,7 +92,7 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "test example com"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Contact? missing = test_article.get_by_rfc822.end(async_result());
assert_null(missing, "Missing contact");
@@ -104,7 +104,7 @@ class Geary.ContactStoreImplTest : TestCase {
0,
10,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Collection<Contact> results = test_article.search.end(
async_result()
@@ -118,7 +118,7 @@ class Geary.ContactStoreImplTest : TestCase {
0,
10,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Collection<Contact> results = test_article.search.end(
async_result()
@@ -139,7 +139,7 @@ class Geary.ContactStoreImplTest : TestCase {
0,
10,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Collection<Contact> results = test_article.search.end(
async_result()
@@ -173,7 +173,7 @@ class Geary.ContactStoreImplTest : TestCase {
0,
10,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Collection<Contact> results = test_article.search.end(
async_result()
@@ -204,7 +204,7 @@ class Geary.ContactStoreImplTest : TestCase {
0,
10,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Collection<Contact> results = test_article.search.end(
async_result()
@@ -226,14 +226,14 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.update_contacts.begin(
Collection.single(not_persisted),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
test_article.update_contacts.end(async_result());
test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "New example com"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Contact? persisted = test_article.get_by_rfc822.end(async_result());
assert_non_null(persisted, "persisted");
@@ -255,13 +255,13 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.update_contacts.begin(
Collection.single(not_updated),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
test_article.update_contacts.end(async_result());
test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "Test example com"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Contact? updated = test_article.get_by_rfc822.end(async_result());
assert_non_null(updated, "updated");
@@ -276,13 +276,13 @@ class Geary.ContactStoreImplTest : TestCase {
test_article.update_contacts.begin(
Collection.single(not_updated),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
test_article.update_contacts.end(async_result());
test_article.get_by_rfc822.begin(
new RFC822.MailboxAddress(null, "Test example com"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Contact? updated_again = test_article.get_by_rfc822.end(async_result());
assert_false(updated_again.flags.always_load_remote_images(), "Removed flags");
diff --git a/test/engine/db/db-database-test.vala b/test/engine/db/db-database-test.vala
index c8e746bd..2a72bccd 100644
--- a/test/engine/db/db-database-test.vala
+++ b/test/engine/db/db-database-test.vala
@@ -21,10 +21,7 @@ class Geary.Db.DatabaseTest : TestCase {
public void transient_open() throws Error {
Database db = new Geary.Db.Database.transient();
- db.open.begin(
- Geary.Db.DatabaseFlags.NONE, null,
- (obj, ret) => { async_complete(ret); }
- );
+ db.open.begin(Geary.Db.DatabaseFlags.NONE, null, this.async_completion);
db.open.end(async_result());
// 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);
- db.open.begin(
- Geary.Db.DatabaseFlags.NONE, null,
- (obj, ret) => { async_complete(ret); }
- );
+ db.open.begin(Geary.Db.DatabaseFlags.NONE, null, this.async_completion);
db.open.end(async_result());
// 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")
);
db.open.begin(
- Geary.Db.DatabaseFlags.CREATE_FILE, null,
- (obj, ret) => { async_complete(ret); }
+ Geary.Db.DatabaseFlags.CREATE_FILE, null, this.async_completion
);
db.open.end(async_result());
@@ -86,7 +79,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_DIRECTORY |
Geary.Db.DatabaseFlags.CREATE_FILE,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
@@ -111,7 +104,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_DIRECTORY |
Geary.Db.DatabaseFlags.CREATE_FILE,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
@@ -135,7 +128,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_FILE |
Geary.Db.DatabaseFlags.CHECK_CORRUPTION,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
@@ -160,7 +153,7 @@ class Geary.Db.DatabaseTest : TestCase {
Geary.Db.DatabaseFlags.CREATE_FILE |
Geary.Db.DatabaseFlags.CHECK_CORRUPTION,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
diff --git a/test/engine/db/db-versioned-database-test.vala b/test/engine/db/db-versioned-database-test.vala
index 4e12962f..53ac49ee 100644
--- a/test/engine/db/db-versioned-database-test.vala
+++ b/test/engine/db/db-versioned-database-test.vala
@@ -34,8 +34,7 @@ class Geary.Db.VersionedDatabaseTest : TestCase {
);
db.open.begin(
- Geary.Db.DatabaseFlags.CREATE_FILE, null,
- (obj, ret) => { async_complete(ret); }
+ Geary.Db.DatabaseFlags.CREATE_FILE, null, this.async_completion
);
db.open.end(async_result());
diff --git a/test/engine/imap-db/imap-db-account-test.vala b/test/engine/imap-db/imap-db-account-test.vala
index 61b62506..c526372d 100644
--- a/test/engine/imap-db/imap-db-account-test.vala
+++ b/test/engine/imap-db/imap-db-account-test.vala
@@ -48,7 +48,7 @@ class Geary.ImapDB.AccountTest : TestCase {
);
this.account.open_async.begin(
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.open_async.end(async_result());
@@ -59,7 +59,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.root = null;
this.account.close_async.begin(
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.close_async.end(async_result());
this.account = null;
@@ -91,7 +91,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.clone_folder_async.begin(
folder,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.clone_folder_async.end(async_result());
@@ -130,7 +130,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.clone_folder_async.begin(
folder,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
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.imap_folder_root,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Collection<Geary.ImapDB.Folder> result =
this.account.list_folders_async.end(async_result());
@@ -167,7 +167,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.list_folders_async.begin(
test1.get_path(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
result = this.account.list_folders_async.end(async_result());
@@ -178,7 +178,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.list_folders_async.begin(
test2.get_path(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
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.root.get_child("test1").get_child("test2"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.delete_folder_async.end(async_result());
this.account.delete_folder_async.begin(
this.root.get_child("test1"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.delete_folder_async.end(async_result());
}
@@ -221,7 +221,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.delete_folder_async.begin(
this.root.get_child("test1"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
try {
this.account.delete_folder_async.end(async_result());
@@ -242,7 +242,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.delete_folder_async.begin(
this.root.get_child("test3"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
try {
this.account.delete_folder_async.end(async_result());
@@ -263,7 +263,7 @@ class Geary.ImapDB.AccountTest : TestCase {
this.account.fetch_folder_async.begin(
this.root.get_child("test1"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
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.root.get_child("test1").get_child("test2"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
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.root.get_child("test3"),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
try {
this.account.fetch_folder_async.end(async_result());
@@ -330,7 +330,7 @@ class Geary.ImapDB.AccountTest : TestCase {
}).to_linked_list(),
Email.Field.RECEIVERS,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.List<Email> result = this.account.list_email.end(
async_result()
@@ -344,7 +344,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Collection.single(new EmailIdentifier(3, null)),
Email.Field.RECEIVERS,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
try {
this.account.list_email.end(async_result());
@@ -357,7 +357,7 @@ class Geary.ImapDB.AccountTest : TestCase {
Collection.single(new EmailIdentifier(1, null)),
Email.Field.BODY,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
try {
this.account.list_email.end(async_result());
diff --git a/test/engine/imap-db/imap-db-attachment-test.vala
b/test/engine/imap-db/imap-db-attachment-test.vala
index bf201b70..e8e2f260 100644
--- a/test/engine/imap-db/imap-db-attachment-test.vala
+++ b/test/engine/imap-db/imap-db-attachment-test.vala
@@ -119,7 +119,7 @@ class Geary.ImapDB.AttachmentIoTest : TestCase {
this.db = new Geary.Db.Database.transient();
this.db.open.begin(
Geary.Db.DatabaseFlags.NONE, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
this.db.open.end(async_result());
this.db.exec("""
@@ -150,7 +150,7 @@ CREATE TABLE MessageAttachmentTable (
Files.recursive_delete_async.begin(
this.tmp_dir, GLib.Priority.DEFAULT, null,
- (obj, res) => { async_complete(res); }
+ this.async_completion
);
Files.recursive_delete_async.end(async_result());
this.tmp_dir = null;
diff --git a/test/engine/imap-db/imap-db-database-test.vala b/test/engine/imap-db/imap-db-database-test.vala
index 1341f2d8..1fb73683 100644
--- a/test/engine/imap-db/imap-db-database-test.vala
+++ b/test/engine/imap-db/imap-db-database-test.vala
@@ -42,7 +42,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
@@ -102,7 +102,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
@@ -136,7 +136,7 @@ class Geary.ImapDB.DatabaseTest : TestCase {
db.open.begin(
Geary.Db.DatabaseFlags.CREATE_FILE, null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
db.open.end(async_result());
diff --git a/test/engine/imap-db/imap-db-folder-test.vala b/test/engine/imap-db/imap-db-folder-test.vala
index 496afd10..17baabdc 100644
--- a/test/engine/imap-db/imap-db-folder-test.vala
+++ b/test/engine/imap-db/imap-db-folder-test.vala
@@ -47,7 +47,7 @@ class Geary.ImapDB.FolderTest : TestCase {
);
this.account.open_async.begin(
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.open_async.end(async_result());
@@ -58,7 +58,7 @@ class Geary.ImapDB.FolderTest : TestCase {
this.account.list_folders_async.begin(
this.account.imap_folder_root,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.folder = traverse<Folder>(
this.account.list_folders_async.end(async_result())
@@ -69,7 +69,7 @@ class Geary.ImapDB.FolderTest : TestCase {
this.folder = null;
this.account.close_async.begin(
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.account.close_async.end(async_result());
this.account = null;
@@ -87,7 +87,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true,
new MockContactHarvester(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result());
@@ -107,7 +107,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true,
new MockContactHarvester(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result());
@@ -127,7 +127,7 @@ class Geary.ImapDB.FolderTest : TestCase {
false,
new MockContactHarvester(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result());
@@ -157,7 +157,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true,
new MockContactHarvester(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result());
@@ -172,7 +172,7 @@ class Geary.ImapDB.FolderTest : TestCase {
fixture_fields | mock.fields,
Folder.ListFlags.NONE,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Email? merged = null;
try {
@@ -208,7 +208,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true,
new MockContactHarvester(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Map<Email,bool> results =
this.folder.create_or_merge_email_async.end(async_result());
@@ -242,7 +242,7 @@ class Geary.ImapDB.FolderTest : TestCase {
true,
new MockContactHarvester(),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Gee.Map<Email,bool> results =
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(
Collection.single_map(test, test_flags),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
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(
Collection.single_map(test, test_flags),
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
this.folder.set_email_flags_async.end(async_result());
@@ -347,7 +347,7 @@ class Geary.ImapDB.FolderTest : TestCase {
Email.Field.FLAGS,
Folder.ListFlags.INCLUDE_MARKED_FOR_REMOVE,
null,
- (obj, ret) => { async_complete(ret); }
+ this.async_completion
);
Email? merged = null;
try {
diff --git a/test/engine/imap-engine/imap-engine-generic-account-test.vala
b/test/engine/imap-engine/imap-engine-generic-account-test.vala
index b22af954..6225970f 100644
--- a/test/engine/imap-engine/imap-engine-generic-account-test.vala
+++ b/test/engine/imap-engine/imap-engine-generic-account-test.vala
@@ -57,18 +57,12 @@ public class Geary.ImapEngine.GenericAccountTest : TestCase {
this.tmp_dir,
GLib.File.new_for_path(_SOURCE_ROOT_DIR).get_child("sql")
);
- this.local_account.open_async.begin(
- null,
- (obj, ret) => { async_complete(ret); }
- );
+ this.local_account.open_async.begin(null, this.async_completion);
this.local_account.open_async.end(async_result());
}
public override void tear_down() throws GLib.Error {
- this.local_account.close_async.begin(
- null,
- (obj, ret) => { async_complete(ret); }
- );
+ this.local_account.close_async.begin(null, this.async_completion);
this.local_account.close_async.end(async_result());
this.local_account = null;
this.config = null;
diff --git a/test/engine/imap/transport/imap-client-connection-test.vala
b/test/engine/imap/transport/imap-client-connection-test.vala
index c98f0dc5..cbbf9a78 100644
--- a/test/engine/imap/transport/imap-client-connection-test.vala
+++ b/test/engine/imap/transport/imap-client-connection-test.vala
@@ -40,13 +40,13 @@ class Geary.Imap.ClientConnectionTest : TestCase {
public void connect_disconnect() throws GLib.Error {
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());
assert_non_null(test_article.get_remote_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());
assert_null(test_article.get_remote_address());
@@ -71,7 +71,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
var test_article = new ClientConnection(
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());
assert_false(test_article.is_in_idle(), "Initial idle state");
@@ -98,12 +98,12 @@ class Geary.Imap.ClientConnectionTest : TestCase {
var command = new TestCommand();
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());
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());
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);
test_article.sent_command.connect(() => { sent = 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());
var command = new TestCommand();
@@ -140,7 +140,7 @@ class Geary.Imap.ClientConnectionTest : TestCase {
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());
assert_true(sent, "connection.sent_command");
diff --git a/test/engine/imap/transport/imap-client-session-test.vala
b/test/engine/imap/transport/imap-client-session-test.vala
index 7ff91357..8e2195a8 100644
--- a/test/engine/imap/transport/imap-client-session-test.vala
+++ b/test/engine/imap/transport/imap-client-session-test.vala
@@ -47,12 +47,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
assert_true(test_article.get_protocol_state() == NOT_CONNECTED);
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());
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());
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());
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());
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());
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();
timer.start();
test_article.connect_async.begin(
- CONNECT_TIMEOUT, null, this.async_complete_full
+ CONNECT_TIMEOUT, null, this.async_completion
);
try {
test_article.connect_async.end(async_result());
@@ -117,19 +117,19 @@ class Geary.Imap.ClientSessionTest : TestCase {
var test_article = new ClientSession(new_endpoint());
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.login_async.begin(
new Credentials(PASSWORD, "test", "password"),
null,
- this.async_complete_full
+ this.async_completion
);
test_article.login_async.end(async_result());
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());
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);
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());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@@ -159,12 +159,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.login_async.begin(
new Credentials(PASSWORD, "test", "password"),
null,
- this.async_complete_full
+ this.async_completion
);
test_article.login_async.end(async_result());
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());
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);
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());
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());
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);
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());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@@ -227,12 +227,12 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.login_async.begin(
new Credentials(PASSWORD, "test", "password"),
null,
- this.async_complete_full
+ this.async_completion
);
test_article.login_async.end(async_result());
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());
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);
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());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@@ -272,7 +272,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.initiate_session_async.begin(
new Credentials(PASSWORD, "test", "password"),
null,
- this.async_complete_full
+ this.async_completion
);
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_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());
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);
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());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@@ -316,7 +316,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.initiate_session_async.begin(
new Credentials(PASSWORD, "test", "password"),
null,
- this.async_complete_full
+ this.async_completion
);
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_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());
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);
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());
assert_true(test_article.get_protocol_state() == UNAUTHORIZED);
@@ -379,7 +379,7 @@ class Geary.Imap.ClientSessionTest : TestCase {
test_article.initiate_session_async.begin(
new Credentials(PASSWORD, "test", "password"),
null,
- this.async_complete_full
+ this.async_completion
);
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
);
- 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());
TestServer.Result result = this.server.wait_for_script(this.main_loop);
diff --git a/test/engine/imap/transport/imap-deserializer-test.vala
b/test/engine/imap/transport/imap-deserializer-test.vala
index f090057e..0759025a 100644
--- a/test/engine/imap/transport/imap-deserializer-test.vala
+++ b/test/engine/imap/transport/imap-deserializer-test.vala
@@ -51,7 +51,7 @@ class Geary.Imap.DeserializerTest : TestCase {
}
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();
this.stream = null;
}
@@ -62,7 +62,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.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());
assert_int(2, message.size);
@@ -76,7 +76,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.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());
assert_int(2, message.size);
@@ -90,7 +90,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.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());
assert_int(2, message.size);
@@ -104,7 +104,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.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());
assert_int(2, message.size);
@@ -118,7 +118,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(bytes.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());
assert_int(2, message.size);
@@ -136,7 +136,7 @@ class Geary.Imap.DeserializerTest : TestCase {
// deserializer currently silently ignores lines with
// malformed lists and continues parsing, so we get to the end
// 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());
}
@@ -150,7 +150,7 @@ class Geary.Imap.DeserializerTest : TestCase {
// deserializer currently silently ignores lines with
// malformed lists and continues parsing, so we get to the end
// 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());
}
@@ -159,7 +159,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(greeting.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());
assert(message.to_string() == greeting);
@@ -170,7 +170,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(greeting.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());
assert(message.to_string() == greeting);
@@ -182,7 +182,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(greeting.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());
assert(message.to_string() == parsed);
@@ -193,7 +193,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.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());
}
@@ -202,7 +202,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.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());
assert(message.to_string() == flags);
@@ -213,7 +213,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.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());
assert(message.to_string() == flags);
@@ -224,7 +224,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.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());
assert(message.to_string() == flags);
@@ -239,7 +239,7 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.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());
assert(message.to_string() == expected);
@@ -250,12 +250,12 @@ class Geary.Imap.DeserializerTest : TestCase {
this.stream.add_data(flags.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());
}
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());
assert(this.deser.is_halted());
}
@@ -267,7 +267,7 @@ class Geary.Imap.DeserializerTest : TestCase {
bool eos = false;
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());
assert(message.to_string() == bye);
assert(eos);
diff --git a/test/engine/rfc822-message-test.vala b/test/engine/rfc822-message-test.vala
index 2f1ab3f9..cc3f0a40 100644
--- a/test/engine/rfc822-message-test.vala
+++ b/test/engine/rfc822-message-test.vala
@@ -231,7 +231,7 @@ This is the second line.
this.message_from_composed_email.begin(
composed,
- async_complete_full
+ this.async_completion
);
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(
composed,
- async_complete_full
+ this.async_completion
);
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(
composed,
- async_complete_full
+ this.async_completion
);
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(
composed,
- async_complete_full
+ this.async_completion
);
Geary.RFC822.Message message = message_from_composed_email.end(async_result());
diff --git a/test/engine/rfc822-utils-test.vala b/test/engine/rfc822-utils-test.vala
index d150b71f..1691fa41 100644
--- a/test/engine/rfc822-utils-test.vala
+++ b/test/engine/rfc822-utils-test.vala
@@ -27,7 +27,7 @@ class Geary.RFC822.Utils.Test : TestCase {
public void best_encoding_default() throws GLib.Error {
string test = "abc";
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());
assert_true(encoding == DEFAULT);
}
@@ -38,7 +38,7 @@ class Geary.RFC822.Utils.Test : TestCase {
buf.append("long ");
}
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());
assert_true(encoding == QUOTEDPRINTABLE);
}
@@ -46,7 +46,7 @@ class Geary.RFC822.Utils.Test : TestCase {
public void best_encoding_binary() throws GLib.Error {
uint8 test[] = { 0x20, 0x00, 0x20 };
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());
assert_true(encoding == BASE64);
}
diff --git a/test/integration/imap/client-session.vala b/test/integration/imap/client-session.vala
index f6221f63..d4f1c3d8 100644
--- a/test/integration/imap/client-session.vala
+++ b/test/integration/imap/client-session.vala
@@ -34,17 +34,17 @@ class Integration.Imap.ClientSession : TestCase {
public override void tear_down() throws GLib.Error {
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 = null;
}
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.disconnect_async.begin(null, async_complete_full);
+ this.session.disconnect_async.begin(null, this.async_completion);
this.session.disconnect_async.end(async_result());
}
@@ -55,7 +55,7 @@ class Integration.Imap.ClientSession : TestCase {
PASSWORD, "automated-integration-test", "password"
);
this.session.login_async.begin(
- password_creds, null, async_complete_full
+ password_creds, null, this.async_completion
);
try {
this.session.login_async.end(async_result());
@@ -78,7 +78,7 @@ class Integration.Imap.ClientSession : TestCase {
OAUTH2, "automated-integration-test", "password"
);
this.session.login_async.begin(
- oauth2_creds, null, async_complete_full
+ oauth2_creds, null, this.async_completion
);
try {
this.session.login_async.end(async_result());
@@ -92,13 +92,13 @@ class Integration.Imap.ClientSession : TestCase {
do_connect();
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());
}
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());
}
diff --git a/test/integration/smtp/client-session.vala b/test/integration/smtp/client-session.vala
index 30b03eb4..b6c0c801 100644
--- a/test/integration/smtp/client-session.vala
+++ b/test/integration/smtp/client-session.vala
@@ -37,7 +37,7 @@ class Integration.Smtp.ClientSession : TestCase {
public override void tear_down() throws GLib.Error {
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());
} catch (GLib.Error err) {
// Oh well
@@ -52,7 +52,7 @@ class Integration.Smtp.ClientSession : TestCase {
"deliberately-invalid-password"
);
this.session.login_async.begin(
- password_creds, null, async_complete_full
+ password_creds, null, this.async_completion
);
try {
this.session.login_async.end(async_result());
@@ -69,7 +69,7 @@ class Integration.Smtp.ClientSession : TestCase {
"deliberately-invalid-token"
);
this.session.login_async.begin(
- oauth2_creds, null, async_complete_full
+ oauth2_creds, null, this.async_completion
);
try {
this.session.login_async.end(async_result());
@@ -97,7 +97,7 @@ class Integration.Smtp.ClientSession : TestCase {
"Geary integration test",
this.config.credentials.user
),
- async_complete_full
+ this.async_completion
);
Geary.RFC822.Message message = new_message.end(async_result());
@@ -105,14 +105,14 @@ class Integration.Smtp.ClientSession : TestCase {
return_path,
message,
null,
- async_complete_full
+ this.async_completion
);
this.session.send_email_async.end(async_result());
}
private void do_connect() throws GLib.Error {
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());
}
diff --git a/test/test-case.vala b/test/test-case.vala
index 901be037..b9c78720 100644
--- a/test/test-case.vala
+++ b/test/test-case.vala
@@ -360,17 +360,8 @@ public abstract class TestCase : GLib.Object {
*
* @see AsyncResultWaiter.async_completion
*/
- protected void async_complete(AsyncResult result) {
- this.async_waiter.async_completion(null, 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) {
+ protected void async_completion(GLib.Object? object,
+ AsyncResult result) {
this.async_waiter.async_completion(object, result);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]