Revert "Revert "Merge branch 'mjog/558-webkit-shared-process' into 'mainline'""
This reverts commitcbe6e0ba9b, which reinstates commite4a5b85698. See !411 and !374
This commit is contained in:
parent
d0fff267f8
commit
d7af23201c
28 changed files with 418 additions and 245 deletions
|
|
@ -6,35 +6,42 @@
|
|||
*/
|
||||
|
||||
|
||||
public abstract class ClientWebViewTestCase<V> : TestCase {
|
||||
public abstract class Components.WebViewTestCase<V> : TestCase {
|
||||
|
||||
protected V? test_view = null;
|
||||
protected Application.Configuration? config = null;
|
||||
|
||||
protected ClientWebViewTestCase(string name) {
|
||||
protected WebViewTestCase(string name) {
|
||||
base(name);
|
||||
}
|
||||
|
||||
public override void set_up() {
|
||||
this.config = new Application.Configuration(Application.Client.SCHEMA_ID);
|
||||
this.config.enable_debug = true;
|
||||
ClientWebView.init_web_context(
|
||||
|
||||
WebView.init_web_context(
|
||||
this.config,
|
||||
File.new_for_path(_BUILD_ROOT_DIR).get_child("src"),
|
||||
File.new_for_path("/tmp") // XXX use something better here
|
||||
);
|
||||
try {
|
||||
ClientWebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
WebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
} catch (GLib.Error err) {
|
||||
GLib.assert_not_reached();
|
||||
}
|
||||
|
||||
this.test_view = set_up_test_view();
|
||||
}
|
||||
|
||||
public override void set_up() {
|
||||
this.test_view = set_up_test_view();
|
||||
protected override void tear_down() {
|
||||
this.config = null;
|
||||
this.test_view = null;
|
||||
}
|
||||
|
||||
protected abstract V set_up_test_view();
|
||||
|
||||
protected virtual void load_body_fixture(string html = "") {
|
||||
ClientWebView client_view = (ClientWebView) this.test_view;
|
||||
WebView client_view = (WebView) this.test_view;
|
||||
client_view.load_html(html);
|
||||
while (!client_view.is_content_loaded) {
|
||||
Gtk.main_iteration();
|
||||
|
|
@ -42,7 +49,7 @@ public abstract class ClientWebViewTestCase<V> : TestCase {
|
|||
}
|
||||
|
||||
protected WebKit.JavascriptResult run_javascript(string command) throws Error {
|
||||
ClientWebView view = (ClientWebView) this.test_view;
|
||||
WebView view = (WebView) this.test_view;
|
||||
view.run_javascript.begin(command, null, this.async_completion);
|
||||
return view.run_javascript.end(async_result());
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class ClientWebViewTest : TestCase {
|
||||
public class Components.WebViewTest : TestCase {
|
||||
|
||||
public ClientWebViewTest() {
|
||||
base("ClientWebViewTest");
|
||||
public WebViewTest() {
|
||||
base("Components.WebViewTest");
|
||||
add_test("init_web_context", init_web_context);
|
||||
add_test("load_resources", load_resources);
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ public class ClientWebViewTest : TestCase {
|
|||
Application.Client.SCHEMA_ID
|
||||
);
|
||||
config.enable_debug = true;
|
||||
ClientWebView.init_web_context(
|
||||
WebView.init_web_context(
|
||||
config,
|
||||
File.new_for_path(_BUILD_ROOT_DIR).get_child("src"),
|
||||
File.new_for_path("/tmp") // XXX use something better here
|
||||
|
|
@ -27,7 +27,7 @@ public class ClientWebViewTest : TestCase {
|
|||
|
||||
public void load_resources() throws GLib.Error {
|
||||
try {
|
||||
ClientWebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
WebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
} catch (GLib.Error err) {
|
||||
assert_not_reached();
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
public class Composer.WebViewTest : ClientWebViewTestCase<Composer.WebView> {
|
||||
public class Composer.WebViewTest : Components.WebViewTestCase<Composer.WebView> {
|
||||
|
||||
|
||||
public WebViewTest() {
|
||||
|
|
|
|||
|
|
@ -5,24 +5,24 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
class ClientPageStateTest : ClientWebViewTestCase<ClientWebView> {
|
||||
class Components.PageStateTest : WebViewTestCase<WebView> {
|
||||
|
||||
|
||||
private class TestClientWebView : ClientWebView {
|
||||
private class TestWebView : Components.WebView {
|
||||
|
||||
public TestClientWebView(Application.Configuration config) {
|
||||
public TestWebView(Application.Configuration config) {
|
||||
base(config);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public ClientPageStateTest() {
|
||||
base("ClientPageStateTest");
|
||||
public PageStateTest() {
|
||||
base("Components.PageStateTest");
|
||||
add_test("content_loaded", content_loaded);
|
||||
|
||||
try {
|
||||
ClientWebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
WebView.load_resources(GLib.File.new_for_path("/tmp"));
|
||||
} catch (GLib.Error err) {
|
||||
GLib.assert_not_reached();
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ class ClientPageStateTest : ClientWebViewTestCase<ClientWebView> {
|
|||
assert(content_loaded_triggered);
|
||||
}
|
||||
|
||||
protected override ClientWebView set_up_test_view() {
|
||||
protected override WebView set_up_test_view() {
|
||||
WebKit.UserScript test_script;
|
||||
test_script = new WebKit.UserScript(
|
||||
"var geary = new PageState()",
|
||||
|
|
@ -55,7 +55,7 @@ class ClientPageStateTest : ClientWebViewTestCase<ClientWebView> {
|
|||
null
|
||||
);
|
||||
|
||||
ClientWebView view = new TestClientWebView(this.config);
|
||||
WebView view = new TestWebView(this.config);
|
||||
view.get_user_content_manager().add_script(test_script);
|
||||
return view;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
class Composer.PageStateTest : ClientWebViewTestCase<Composer.WebView> {
|
||||
class Composer.PageStateTest : Components.WebViewTestCase<Composer.WebView> {
|
||||
|
||||
public const string COMPLETE_BODY_TEMPLATE =
|
||||
"""<div id="geary-body" dir="auto">%s<div><br></div><div><br></div></div><div id="geary-signature" dir="auto"></div>""";
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
class ConversationPageStateTest : ClientWebViewTestCase<ConversationWebView> {
|
||||
class ConversationPageStateTest : Components.WebViewTestCase<ConversationWebView> {
|
||||
|
||||
public ConversationPageStateTest() {
|
||||
base("ConversationPageStateTest");
|
||||
|
|
|
|||
|
|
@ -82,9 +82,9 @@ test_client_sources = [
|
|||
'client/application/application-certificate-manager-test.vala',
|
||||
'client/application/application-client-test.vala',
|
||||
'client/application/application-configuration-test.vala',
|
||||
'client/components/client-web-view-test.vala',
|
||||
'client/components/client-web-view-test-case.vala',
|
||||
'client/components/components-validator-test.vala',
|
||||
'client/components/components-web-view-test-case.vala',
|
||||
'client/components/components-web-view-test.vala',
|
||||
'client/composer/composer-web-view-test.vala',
|
||||
'client/composer/composer-widget-test.vala',
|
||||
'client/util/util-avatar-test.vala',
|
||||
|
|
@ -92,7 +92,7 @@ test_client_sources = [
|
|||
'client/util/util-email-test.vala',
|
||||
'client/util/util-js-test.vala',
|
||||
|
||||
'js/client-page-state-test.vala',
|
||||
'js/components-page-state-test.vala',
|
||||
'js/composer-page-state-test.vala',
|
||||
'js/conversation-page-state-test.vala',
|
||||
|
||||
|
|
|
|||
|
|
@ -53,10 +53,10 @@ int main(string[] args) {
|
|||
client.add_suite(new Application.CertificateManagerTest().suite);
|
||||
client.add_suite(new Application.ClientTest().suite);
|
||||
client.add_suite(new Application.ConfigurationTest().suite);
|
||||
client.add_suite(new ClientWebViewTest().suite);
|
||||
client.add_suite(new Components.WebViewTest().suite);
|
||||
client.add_suite(new Components.ValidatorTest().suite);
|
||||
client.add_suite(new Composer.WebViewTest().suite);
|
||||
client.add_suite(new Composer.WidgetTest().suite);
|
||||
client.add_suite(new Components.ValidatorTest().suite);
|
||||
client.add_suite(new Util.Avatar.Test().suite);
|
||||
client.add_suite(new Util.Cache.Test().suite);
|
||||
client.add_suite(new Util.Email.Test().suite);
|
||||
|
|
@ -64,7 +64,7 @@ int main(string[] args) {
|
|||
|
||||
TestSuite js = new TestSuite("js");
|
||||
|
||||
js.add_suite(new ClientPageStateTest().suite);
|
||||
js.add_suite(new Components.PageStateTest().suite);
|
||||
js.add_suite(new Composer.PageStateTest().suite);
|
||||
js.add_suite(new ConversationPageStateTest().suite);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue