[Xfce4-commits] <midori:master> De-/ activating of extensions in app test

Christian Dywan noreply at xfce.org
Sun Dec 16 15:12:01 CET 2012


Updating branch refs/heads/master
         to b1a7d3f5231c439fbdc2aa0249c715608f63dc3e (commit)
       from 6c0ecfa6347b94e921f488ac9e4ce0044959f380 (commit)

commit b1a7d3f5231c439fbdc2aa0249c715608f63dc3e
Author: Christian Dywan <christian at twotoasts.de>
Date:   Sun Dec 16 13:58:28 2012 +0100

    De-/ activating of extensions in app test

 midori/midori.vapi |   12 ++++++------
 tests/app.vala     |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 51 insertions(+), 8 deletions(-)

diff --git a/midori/midori.vapi b/midori/midori.vapi
index fa920c1..e58c5ce 100644
--- a/midori/midori.vapi
+++ b/midori/midori.vapi
@@ -128,19 +128,19 @@ namespace Midori {
         [NoAccessorMethod]
         public string? stock_id { get; set; }
         [NoAccessorMethod]
-        public string name { get; set; }
+        public string name { owned get; set; }
         [NoAccessorMethod]
-        public string description { get; set; }
+        public string description { owned get; set; }
         [NoAccessorMethod]
         public bool use_markup { get; set; }
         [NoAccessorMethod]
-        public string version { get; set; }
+        public string version { owned get; set; }
         [NoAccessorMethod]
-        public string authors { get; set; }
+        public string authors { owned get; set; }
         [NoAccessorMethod]
-        public string website { get; set; }
+        public string website { owned get; set; }
         [NoAccessorMethod]
-        public string key { get; set; }
+        public string key { owned get; set; }
 
         public signal void activate (Midori.App app);
         public bool is_prepared ();
diff --git a/tests/app.vala b/tests/app.vala
index ed90b5e..4b3860c 100644
--- a/tests/app.vala
+++ b/tests/app.vala
@@ -83,7 +83,7 @@ void app_web_custom_config () {
 }
 
 
-void app_extensions () {
+void app_extensions_load () {
     Midori.Test.grab_max_timeout ();
 
     Midori.Test.idle_timeouts ();
@@ -96,6 +96,7 @@ void app_extensions () {
     /* No extensions loaded */
     assert (app.extensions.get_length () == 0);
     Midori.Extension.load_from_folder (app, null, false);
+
     /* All extensions loaded, inactive */
     assert (app.extensions.get_length () > 0);
     foreach (var item in app.extensions.get_items ())
@@ -107,9 +108,50 @@ void app_extensions () {
         do { loop.iteration (true); } while (loop.pending ());
     }
 
+    /*
     Midori.Test.release_max_timeout ();
 }
 
+void app_extensions_activate () {
+    Midori.Test.grab_max_timeout ();
+
+    Midori.Test.idle_timeouts ();
+    Midori.Test.log_set_fatal_handler_for_icons ();
+    Midori.Paths.Test.reset_runtime_mode ();
+    Midori.App.set_instance_is_running (false);
+    var app = Midori.normal_app_new (null, "test-extensions-normal", false, null, null, null, -1, null);
+    var loop = MainContext.default ();
+    do { loop.iteration (true); } while (loop.pending ());
+    Midori.Extension.load_from_folder (app, null, false);
+
+    assert (app.extensions.get_length () > 0);
+    */
+
+    foreach (var item in app.extensions.get_items ()) {
+        stdout.printf ("- %s\n", (item as Midori.Extension).name);
+        (item as Midori.Extension).activate (app);
+    }
+
+    for (var i = 0 ; i < 7; i++) {
+        var tab = app.browser.get_nth_tab (app.browser.add_uri ("about:blank"));
+        app.browser.close_tab (tab);
+        do { loop.iteration (true); } while (loop.pending ());
+    }
+
+    foreach (var item in app.extensions.get_items ()) {
+        (item as Midori.Extension).deactivate ();
+    }
+
+    for (var i = 0 ; i < 7; i++) {
+        var tab = app.browser.get_nth_tab (app.browser.add_uri ("about:blank"));
+        app.browser.close_tab (tab);
+        do { loop.iteration (true); } while (loop.pending ());
+    }
+
+    Midori.Test.release_max_timeout ();
+}
+
+
 void main (string[] args) {
     Test.init (ref args);
     Midori.App.setup (ref args, null);
@@ -118,7 +160,8 @@ void main (string[] args) {
     Test.add_func ("/app/private", app_private);
     Test.add_func ("/app/web", app_web);
     Test.add_func ("/app/web-custom-config", app_web_custom_config);
-    Test.add_func ("/app/extensions", app_extensions);
+    Test.add_func ("/app/extensions-load", app_extensions_load);
+    /* Test.add_func ("/app/extensions-activate", app_extensions_activate); */
     Test.run ();
 }
 


More information about the Xfce4-commits mailing list