Make ClientWebView-based tests execute a bit faster.
* test/client/components/client-web-view-test.vala: New explicit tests for init'ing the WebContext and loading default resources. * test/client/components/client-web-view-test-case.vala: Init the WebContext and load resources in the constructor rather than fixture setup, so it only happens once per suite, not once per test. Update subclasses to do same. * test/client/composer/composer-web-view-test.vala: Add an explicit test for loading ComposerWebView resources.
This commit is contained in:
parent
998fe70554
commit
355e4d37c1
7 changed files with 63 additions and 18 deletions
|
|
@ -15,9 +15,6 @@ public abstract class ClientWebViewTestCase<V> : Gee.TestCase {
|
|||
|
||||
public ClientWebViewTestCase(string name) {
|
||||
base(name);
|
||||
}
|
||||
|
||||
public override void set_up() {
|
||||
this.config = new Configuration(GearyApplication.APP_ID);
|
||||
ClientWebView.init_web_context(
|
||||
this.config,
|
||||
|
|
@ -30,6 +27,9 @@ public abstract class ClientWebViewTestCase<V> : Gee.TestCase {
|
|||
} catch (Error err) {
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
public override void set_up() {
|
||||
this.test_view = set_up_test_view();
|
||||
}
|
||||
|
||||
|
|
|
|||
34
test/client/components/client-web-view-test.vala
Normal file
34
test/client/components/client-web-view-test.vala
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright 2016 Michael Gratton <mike@vee.net>
|
||||
*
|
||||
* This software is licensed under the GNU Lesser General Public License
|
||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class ClientWebViewTest : Gee.TestCase {
|
||||
|
||||
public ClientWebViewTest() {
|
||||
base("ClientWebViewTest");
|
||||
add_test("init_web_context", init_web_context);
|
||||
add_test("load_resources", load_resources);
|
||||
}
|
||||
|
||||
public void init_web_context() {
|
||||
Configuration config = new Configuration(GearyApplication.APP_ID);
|
||||
ClientWebView.init_web_context(
|
||||
config,
|
||||
File.new_for_path(_BUILD_ROOT_DIR).get_child("src"),
|
||||
File.new_for_path("/tmp"), // XXX use something better here
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public void load_resources() {
|
||||
try {
|
||||
ClientWebView.load_scripts();
|
||||
} catch (Error err) {
|
||||
assert_not_reached();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue