[evolution] Use a single WebProcess for test-html-editor-units by default
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Use a single WebProcess for test-html-editor-units by default
- Date: Wed, 11 Jan 2017 11:49:29 +0000 (UTC)
commit 34ccc4fa279209cedaf9fb2c422432403659aeef
Author: Milan Crha <mcrha redhat com>
Date: Wed Jan 11 12:49:09 2017 +0100
Use a single WebProcess for test-html-editor-units by default
A parameter --multiple-web-processes had been added to restore
the previous behaviour.
src/e-util/test-html-editor-units-utils.c | 28 ++++++++++++++++++++++++++++
src/e-util/test-html-editor-units-utils.h | 5 +++++
src/e-util/test-html-editor-units.c | 7 +++++++
3 files changed, 40 insertions(+), 0 deletions(-)
---
diff --git a/src/e-util/test-html-editor-units-utils.c b/src/e-util/test-html-editor-units-utils.c
index 0dccbb5..8b130f8 100644
--- a/src/e-util/test-html-editor-units-utils.c
+++ b/src/e-util/test-html-editor-units-utils.c
@@ -25,6 +25,8 @@
static guint event_processing_delay_ms = 25;
static gboolean in_background = FALSE;
+static gboolean use_multiple_web_processes = FALSE;
+static GObject *global_web_context = NULL;
void
test_utils_set_event_processing_delay_ms (guint value)
@@ -50,6 +52,24 @@ test_utils_get_background (void)
return in_background;
}
+void
+test_utils_set_multiple_web_processes (gboolean multiple_web_processes)
+{
+ use_multiple_web_processes = multiple_web_processes;
+}
+
+gboolean
+test_utils_get_multiple_web_processes (void)
+{
+ return use_multiple_web_processes;
+}
+
+void
+test_utils_free_global_memory (void)
+{
+ g_clear_object (&global_web_context);
+}
+
typedef struct _UndoContent {
gchar *html;
gchar *plain;
@@ -190,6 +210,14 @@ test_utils_html_editor_created_cb (GObject *source_object,
g_signal_connect (cnt_editor, "web-process-crashed",
G_CALLBACK (test_utils_web_process_crashed_cb), NULL);
+ if (!test_utils_get_multiple_web_processes () && !global_web_context &&
+ WEBKIT_IS_WEB_VIEW (cnt_editor)) {
+ WebKitWebContext *web_context;
+
+ web_context = webkit_web_view_get_context (WEBKIT_WEB_VIEW (cnt_editor));
+ global_web_context = g_object_ref (web_context);
+ }
+
gtk_window_set_focus (GTK_WINDOW (fixture->window), GTK_WIDGET (cnt_editor));
gtk_widget_show (fixture->window);
diff --git a/src/e-util/test-html-editor-units-utils.h b/src/e-util/test-html-editor-units-utils.h
index d5ab9e6..02343c5 100644
--- a/src/e-util/test-html-editor-units-utils.h
+++ b/src/e-util/test-html-editor-units-utils.h
@@ -45,6 +45,11 @@ guint test_utils_get_event_processing_delay_ms
(void);
void test_utils_set_background (gboolean background);
gboolean test_utils_get_background (void);
+void test_utils_set_multiple_web_processes
+ (gboolean multiple_web_processes);
+gboolean test_utils_get_multiple_web_processes
+ (void);
+void test_utils_free_global_memory (void);
void test_utils_add_test (const gchar *name,
ETestFixtureSimpleFunc func);
void test_utils_fixture_set_up (TestFixture *fixture,
diff --git a/src/e-util/test-html-editor-units.c b/src/e-util/test-html-editor-units.c
index 526c432..6a5f032 100644
--- a/src/e-util/test-html-editor-units.c
+++ b/src/e-util/test-html-editor-units.c
@@ -2665,6 +2665,7 @@ main (gint argc,
gchar *test_keyfile_filename;
gint cmd_delay = -1;
gboolean background = FALSE;
+ gboolean multiple_web_processes = FALSE;
GOptionEntry entries[] = {
{ "cmd-delay", '\0', 0,
G_OPTION_ARG_INT, &cmd_delay,
@@ -2674,6 +2675,10 @@ main (gint argc,
G_OPTION_ARG_NONE, &background,
"Use to run tests in the background, not stealing focus and such.",
NULL },
+ { "multiple-web-processes", '\0', 0,
+ G_OPTION_ARG_NONE, &multiple_web_processes,
+ "Use multiple web processes for each test being run. Default is to use single web process.",
+ NULL },
{ NULL }
};
GOptionContext *context;
@@ -2714,6 +2719,7 @@ main (gint argc,
if (cmd_delay > 0)
test_utils_set_event_processing_delay_ms ((guint) cmd_delay);
test_utils_set_background (background);
+ test_utils_set_multiple_web_processes (multiple_web_processes);
e_util_init_main_thread (NULL);
e_passwords_init ();
@@ -2826,6 +2832,7 @@ main (gint argc,
e_util_cleanup_settings ();
e_spell_checker_free_global_memory ();
+ test_utils_free_global_memory ();
g_unlink (test_keyfile_filename);
g_free (test_keyfile_filename);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]