19
19
void app_normal () {
20
20
Midori.Test.grab_max_timeout ();
22
21
Midori.Test.idle_timeouts ();
23
22
Midori.Test.log_set_fatal_handler_for_icons ();
24
23
Midori.Paths.Test.reset_runtime_mode ();
25
24
Midori.App.set_instance_is_running (false);
26
25
var app = Midori.normal_app_new (null, "test-normal", false, null, null, -1, null);
27
26
var loop = MainContext.default ();
28
do { loop.iteration (true); } while (loop.pending ());
29
for (var i = 0 ; i < 7; i++) {
27
do { loop.iteration (true); } while (app.browser == null);
28
for (var i = 0 ; i < 3; i++) {
30
29
var tab = app.browser.add_uri ("about:blank") as Midori.View;
31
30
app.browser.close_tab (tab);
32
31
do { loop.iteration (true); } while (loop.pending ());
34
33
Midori.normal_app_on_quit (app);
36
for (var i = 0 ; i < 7; i++) {
37
app.settings.maximum_cache_size++;
38
do { loop.iteration (true); } while (loop.pending ());
42
34
Midori.Test.release_max_timeout ();
45
37
void app_normal_custom_config () {
38
Midori.Test.grab_max_timeout ();
39
Midori.Test.idle_timeouts ();
46
40
Midori.Test.log_set_fatal_handler_for_icons ();
47
41
Midori.Paths.Test.reset_runtime_mode ();
48
42
Midori.App.set_instance_is_running (false);
49
var app = Midori.normal_app_new (Midori.Paths.make_tmp_dir ("custom-configXXXXXX"),
43
string? config_dir = null;
45
config_dir = DirUtils.make_tmp ("custom-configXXXXXX");
46
} catch (Error error) {
47
GLib.error (error.message);
49
var app = Midori.normal_app_new (config_dir,
50
50
"test-custom-config-normal", false, null, null, -1, null);
51
var loop = MainContext.default ();
52
do { loop.iteration (true); } while (app.browser == null);
53
assert (check_sensible_window_size (app.browser, app.settings));
54
51
Midori.normal_app_on_quit (app);
52
Midori.Test.release_max_timeout ();
57
55
void app_private () {
82
80
assert (check_sensible_window_size (browser, browser.settings));
86
void app_extensions_load () {
87
Midori.Test.grab_max_timeout ();
89
Midori.Test.idle_timeouts ();
90
Midori.Test.log_set_fatal_handler_for_icons ();
91
Midori.Paths.Test.reset_runtime_mode ();
92
Midori.App.set_instance_is_running (false);
93
var app = Midori.normal_app_new (null, "test-extensions-normal", false, null, null, -1, null);
94
var loop = MainContext.default ();
95
do { loop.iteration (true); } while (loop.pending ());
96
/* No extensions loaded */
97
assert (app.extensions.get_length () == 0);
98
Midori.Extension.load_from_folder (app, null, false);
99
/* All extensions loaded, inactive */
100
assert (app.extensions.get_length () > 0);
102
/* Number of expected extensions matches */
103
/* FIXME Counting .so/dll doesn't see multiple extensions in one binary
106
dir = Dir.open (Midori.Paths.get_lib_path (PACKAGE_NAME), 0);
108
catch (Error error) {
109
GLib.error (error.message);
113
while ((name = dir.read_name ()) != null) {
114
if (name.has_suffix (GLib.Module.SUFFIX))
117
assert (app.extensions.get_length () == count); */
119
foreach (var item in app.extensions.get_items ())
120
assert (!(item as Midori.Extension).is_active ());
122
for (var i = 0 ; i < 7; i++) {
123
var tab = app.browser.add_uri ("about:blank") as Midori.View;
124
app.browser.close_tab (tab);
126
do { loop.iteration (true); } while (loop.pending ());
129
Midori.Test.release_max_timeout ();
132
void app_extensions_activate () {
133
Midori.Test.grab_max_timeout ();
135
Midori.Test.idle_timeouts ();
136
Midori.Test.log_set_fatal_handler_for_icons ();
137
Midori.Paths.Test.reset_runtime_mode ();
138
Midori.App.set_instance_is_running (false);
139
var app = Midori.normal_app_new (null, "test-extensions-normal", false, null, null, -1, null);
140
var loop = MainContext.default ();
141
do { loop.iteration (true); } while (loop.pending ());
142
Midori.Extension.load_from_folder (app, null, false);
144
assert (app.extensions.get_length () > 0);
147
foreach (var item in app.extensions.get_items ()) {
148
stdout.printf ("- %s\n", (item as Midori.Extension).name);
149
(item as Midori.Extension).activate (app);
151
do { loop.iteration (true); } while (loop.pending ());
153
for (var i = 0 ; i < 7; i++) {
154
var tab = app.browser.add_uri ("about:blank") as Midori.View;
155
app.browser.close_tab (tab);
157
do { loop.iteration (true); } while (loop.pending ());
159
foreach (var item in app.extensions.get_items ())
160
(item as Midori.Extension).deactivate ();
161
do { loop.iteration (true); } while (loop.pending ());
163
for (var i = 0 ; i < 7; i++) {
164
var tab = app.browser.add_uri ("about:blank") as Midori.View;
165
app.browser.close_tab (tab);
166
do { loop.iteration (true); } while (loop.pending ());
169
Midori.Test.release_max_timeout ();
173
83
void main (string[] args) {
174
84
Test.init (ref args);
175
85
Midori.App.setup (ref args, null);