Merge lp:~3v1n0/bamf/javaws-ignore-desktop into lp:bamf/0.4

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 542
Merged at revision: 518
Proposed branch: lp:~3v1n0/bamf/javaws-ignore-desktop
Merge into: lp:bamf/0.4
Diff against target: 558 lines (+252/-70)
9 files modified
src/bamf-legacy-window-test.c (+21/-0)
src/bamf-legacy-window-test.h (+1/-0)
src/bamf-legacy-window.c (+47/-0)
src/bamf-legacy-window.h (+4/-0)
src/bamf-matcher-private.h (+1/-0)
src/bamf-matcher.c (+49/-55)
tests/bamfdaemon/data/icedtea-netx-javaws.desktop (+12/-0)
tests/bamfdaemon/test-matcher.c (+107/-3)
tests/run-xvfb.sh (+10/-12)
To merge this branch: bzr merge lp:~3v1n0/bamf/javaws-ignore-desktop
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Brandon Schaefer (community) Approve
Review via email: mp+145289@code.launchpad.net

Commit message

BamfMatcher: ignore the javaws windows when setting the window hint

Description of the change

We need to avoid that a Java Web Application is associated with the default "Java Web Start" .desktop file provided by java as the default opener for jnlp files, or the bug #1098186 will show again.

Test added.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Confirmed fixes the problem :), (Even fixes it for oracale-java7)

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~3v1n0/bamf/javaws-ignore-desktop updated
542. By Marco Trevisan (Treviño)

BamfMatcher: don't abort if we can't monitor a directory, just log it

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/bamf-legacy-window-test.c'
--- src/bamf-legacy-window-test.c 2012-12-17 18:56:43 +0000
+++ src/bamf-legacy-window-test.c 2013-01-29 19:08:28 +0000
@@ -202,6 +202,16 @@
202}202}
203203
204char *204char *
205bamf_legacy_window_test_get_process_name (BamfLegacyWindow *legacy_window)
206{
207 BamfLegacyWindowTest *self;
208
209 self = BAMF_LEGACY_WINDOW_TEST (legacy_window);
210
211 return g_strdup (self->process_name);
212}
213
214char *
205bamf_legacy_window_test_get_app_id (BamfLegacyWindow *legacy_window)215bamf_legacy_window_test_get_app_id (BamfLegacyWindow *legacy_window)
206{216{
207 BamfLegacyWindowTest *self;217 BamfLegacyWindowTest *self;
@@ -379,6 +389,7 @@
379 g_free (self->wm_class_name);389 g_free (self->wm_class_name);
380 g_free (self->wm_class_instance);390 g_free (self->wm_class_instance);
381 g_free (self->exec);391 g_free (self->exec);
392 g_free (self->process_name);
382 g_free (self->application_id);393 g_free (self->application_id);
383 g_free (self->unique_bus_name);394 g_free (self->unique_bus_name);
384 g_free (self->dbus_menu_object_path);395 g_free (self->dbus_menu_object_path);
@@ -399,6 +410,7 @@
399 win_class->get_class_name = bamf_legacy_window_test_get_class_name;410 win_class->get_class_name = bamf_legacy_window_test_get_class_name;
400 win_class->get_class_instance_name = bamf_legacy_window_test_get_class_instance_name;411 win_class->get_class_instance_name = bamf_legacy_window_test_get_class_instance_name;
401 win_class->get_exec_string = bamf_legacy_window_test_get_exec_string;412 win_class->get_exec_string = bamf_legacy_window_test_get_exec_string;
413 win_class->get_process_name = bamf_legacy_window_test_get_process_name;
402 win_class->get_xid = bamf_legacy_window_test_get_xid;414 win_class->get_xid = bamf_legacy_window_test_get_xid;
403 win_class->get_pid = bamf_legacy_window_test_get_pid;415 win_class->get_pid = bamf_legacy_window_test_get_pid;
404 win_class->needs_attention = bamf_legacy_window_test_needs_attention;416 win_class->needs_attention = bamf_legacy_window_test_needs_attention;
@@ -440,6 +452,7 @@
440 copy->wm_class_name = g_strdup (self->wm_class_name);452 copy->wm_class_name = g_strdup (self->wm_class_name);
441 copy->wm_class_instance = g_strdup (self->wm_class_instance);453 copy->wm_class_instance = g_strdup (self->wm_class_instance);
442 copy->exec = g_strdup (self->exec);454 copy->exec = g_strdup (self->exec);
455 copy->process_name = g_strdup (self->process_name);
443 copy->application_id = g_strdup (self->application_id);456 copy->application_id = g_strdup (self->application_id);
444 copy->unique_bus_name = g_strdup (self->unique_bus_name);457 copy->unique_bus_name = g_strdup (self->unique_bus_name);
445 copy->dbus_menu_object_path = g_strdup (self->dbus_menu_object_path);458 copy->dbus_menu_object_path = g_strdup (self->dbus_menu_object_path);
@@ -469,5 +482,13 @@
469 self->wm_class_name = g_strdup (wmclass_name);482 self->wm_class_name = g_strdup (wmclass_name);
470 self->exec = g_strdup (exec);483 self->exec = g_strdup (exec);
471484
485 if (self->exec)
486 {
487 gchar **splitted_exec = g_strsplit (exec, " ", 2);
488 gchar *tmp = g_utf8_strrchr (splitted_exec[0], -1, G_DIR_SEPARATOR);
489 self->process_name = g_strdup (tmp ? tmp + 1 : splitted_exec[0]);
490 g_strfreev (splitted_exec);
491 }
492
472 return self;493 return self;
473}494}
474495
=== modified file 'src/bamf-legacy-window-test.h'
--- src/bamf-legacy-window-test.h 2012-12-17 18:56:43 +0000
+++ src/bamf-legacy-window-test.h 2013-01-29 19:08:28 +0000
@@ -57,6 +57,7 @@
57 char * wm_class_name;57 char * wm_class_name;
58 char * wm_class_instance;58 char * wm_class_instance;
59 char * exec;59 char * exec;
60 char * process_name;
60 char * application_id;61 char * application_id;
61 char * unique_bus_name;62 char * unique_bus_name;
62 char * dbus_menu_object_path;63 char * dbus_menu_object_path;
6364
=== modified file 'src/bamf-legacy-window.c'
--- src/bamf-legacy-window.c 2013-01-09 16:42:32 +0000
+++ src/bamf-legacy-window.c 2013-01-29 19:08:28 +0000
@@ -156,6 +156,51 @@
156}156}
157157
158char *158char *
159bamf_legacy_window_get_process_name (BamfLegacyWindow *self)
160{
161 gchar *stat_path;
162 gchar *contents;
163 gchar **lines;
164 gchar **sections;
165 gchar *result = NULL;
166 guint pid;
167
168 g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);
169
170 if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_process_name)
171 return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_process_name (self);
172
173 pid = bamf_legacy_window_get_pid (self);
174
175 if (pid <= 0)
176 return NULL;
177
178 stat_path = g_strdup_printf ("/proc/%i/status", pid);
179
180 if (g_file_get_contents (stat_path, &contents, NULL, NULL))
181 {
182 lines = g_strsplit (contents, "\n", 2);
183
184 if (lines && g_strv_length (lines) > 0)
185 {
186 sections = g_strsplit (lines[0], "\t", 0);
187 if (sections)
188 {
189 if (g_strv_length (sections) > 1)
190 result = g_strdup (sections[1]);
191
192 g_strfreev (sections);
193 }
194 g_strfreev (lines);
195 }
196 g_free (contents);
197 }
198 g_free (stat_path);
199
200 return result;
201}
202
203char *
159bamf_legacy_window_get_exec_string (BamfLegacyWindow *self)204bamf_legacy_window_get_exec_string (BamfLegacyWindow *self)
160{205{
161 gchar *result = NULL;206 gchar *result = NULL;
@@ -193,6 +238,8 @@
193 return result;238 return result;
194}239}
195240
241
242
196const char *243const char *
197bamf_legacy_window_save_mini_icon (BamfLegacyWindow *self)244bamf_legacy_window_save_mini_icon (BamfLegacyWindow *self)
198{245{
199246
=== modified file 'src/bamf-legacy-window.h'
--- src/bamf-legacy-window.h 2012-12-17 18:56:43 +0000
+++ src/bamf-legacy-window.h 2013-01-29 19:08:28 +0000
@@ -75,6 +75,7 @@
75 const char * (*get_class_name) (BamfLegacyWindow *legacy_window);75 const char * (*get_class_name) (BamfLegacyWindow *legacy_window);
76 const char * (*get_class_instance_name) (BamfLegacyWindow *legacy_window);76 const char * (*get_class_instance_name) (BamfLegacyWindow *legacy_window);
77 char * (*get_exec_string) (BamfLegacyWindow *legacy_window);77 char * (*get_exec_string) (BamfLegacyWindow *legacy_window);
78 char * (*get_process_name) (BamfLegacyWindow *legacy_window);
78 char * (*get_app_id) (BamfLegacyWindow *legacy_window);79 char * (*get_app_id) (BamfLegacyWindow *legacy_window);
79 char * (*get_unique_bus_name) (BamfLegacyWindow *legacy_window);80 char * (*get_unique_bus_name) (BamfLegacyWindow *legacy_window);
80 char * (*get_menu_object_path) (BamfLegacyWindow *legacy_window);81 char * (*get_menu_object_path) (BamfLegacyWindow *legacy_window);
@@ -143,6 +144,8 @@
143144
144char * bamf_legacy_window_get_exec_string (BamfLegacyWindow *self);145char * bamf_legacy_window_get_exec_string (BamfLegacyWindow *self);
145146
147char * bamf_legacy_window_get_process_name (BamfLegacyWindow *self);
148
146BamfLegacyWindow * bamf_legacy_window_get_transient (BamfLegacyWindow *self);149BamfLegacyWindow * bamf_legacy_window_get_transient (BamfLegacyWindow *self);
147150
148char * bamf_legacy_window_get_hint (BamfLegacyWindow *self,151char * bamf_legacy_window_get_hint (BamfLegacyWindow *self,
@@ -159,3 +162,4 @@
159BamfLegacyWindow * bamf_legacy_window_new (WnckWindow *legacy_window);162BamfLegacyWindow * bamf_legacy_window_new (WnckWindow *legacy_window);
160163
161#endif164#endif
165
162166
=== modified file 'src/bamf-matcher-private.h'
--- src/bamf-matcher-private.h 2013-01-08 18:55:38 +0000
+++ src/bamf-matcher-private.h 2013-01-29 19:08:28 +0000
@@ -51,5 +51,6 @@
51BamfApplication * bamf_matcher_get_application_by_desktop_file (BamfMatcher *self, const char *desktop_file);51BamfApplication * bamf_matcher_get_application_by_desktop_file (BamfMatcher *self, const char *desktop_file);
52BamfApplication * bamf_matcher_get_application_by_xid (BamfMatcher *self, guint xid);52BamfApplication * bamf_matcher_get_application_by_xid (BamfMatcher *self, guint xid);
53char * bamf_matcher_get_trimmed_exec (BamfMatcher *self, const char *exec);53char * bamf_matcher_get_trimmed_exec (BamfMatcher *self, const char *exec);
54gboolean bamf_matcher_is_valid_process_prefix (BamfMatcher *self, const char *exec);
5455
55#endif56#endif
5657
=== modified file 'src/bamf-matcher.c'
--- src/bamf-matcher.c 2013-01-10 00:22:00 +0000
+++ src/bamf-matcher.c 2013-01-29 19:08:28 +0000
@@ -57,7 +57,8 @@
57 "^gksu(do)?$", "^sudo$", "^su-to-root$", "^amdxdg-su$", "^java(ws)?$",57 "^gksu(do)?$", "^sudo$", "^su-to-root$", "^amdxdg-su$", "^java(ws)?$",
58 "^mono$", "^ruby$", "^padsp$", "^aoss$", "^python(\\d.\\d)?$", "^(ba)?sh$",58 "^mono$", "^ruby$", "^padsp$", "^aoss$", "^python(\\d.\\d)?$", "^(ba)?sh$",
59 "^perl$", "^env$", "^xdg-open$",59 "^perl$", "^env$", "^xdg-open$",
60 /* javaws strings: */ "^net\\.sourceforge\\.jnlp\\.runtime\\.Boot$", "^rt.jar$"60 /* javaws strings: */ "^net\\.sourceforge\\.jnlp\\.runtime\\.Boot$", "^rt\\.jar$",
61 "^com\\.sun\\.javaws\\.Main$", "^deploy\\.jar$"
61};62};
6263
63// Prefixes that must be considered starting point of exec strings64// Prefixes that must be considered starting point of exec strings
@@ -509,6 +510,30 @@
509 return (l ? (char *) l->data : NULL);510 return (l ? (char *) l->data : NULL);
510}511}
511512
513gboolean
514bamf_matcher_is_valid_process_prefix (BamfMatcher *self, const char *process_name)
515{
516 GRegex *regex;
517 gint i;
518
519 g_return_val_if_fail (BAMF_IS_MATCHER (self), TRUE);
520
521 if (!process_name || *process_name == '\0')
522 return FALSE;
523
524 for (i = 0; i < self->priv->bad_prefixes->len; ++i)
525 {
526 regex = g_array_index (self->priv->bad_prefixes, GRegex *, i);
527
528 if (g_regex_match (regex, process_name, 0, NULL))
529 {
530 return FALSE;
531 }
532 }
533
534 return TRUE;
535}
536
512/* Attempts to return the binary name for a particular execution string */537/* Attempts to return the binary name for a particular execution string */
513char *538char *
514bamf_matcher_get_trimmed_exec (BamfMatcher * self, const char * exec_string)539bamf_matcher_get_trimmed_exec (BamfMatcher * self, const char * exec_string)
@@ -564,16 +589,7 @@
564 if (good_prefix)589 if (good_prefix)
565 continue;590 continue;
566591
567 bad_prefix = FALSE;592 bad_prefix = !bamf_matcher_is_valid_process_prefix (self, part);
568 for (j = 0; j < self->priv->bad_prefixes->len; j++)
569 {
570 regex = g_array_index (self->priv->bad_prefixes, GRegex *, j);
571 if (g_regex_match (regex, part, 0, NULL))
572 {
573 bad_prefix = TRUE;
574 break;
575 }
576 }
577593
578 if (!bad_prefix)594 if (!bad_prefix)
579 {595 {
@@ -1288,7 +1304,7 @@
12881304
1289 if (error)1305 if (error)
1290 {1306 {
1291 g_warning ("Error monitoring %s: %s\n", directory, error->message);1307 g_message ("Error monitoring %s: %s\n", directory, error->message);
1292 g_error_free (error);1308 g_error_free (error);
1293 g_object_unref (file);1309 g_object_unref (file);
1294 return;1310 return;
@@ -1391,41 +1407,6 @@
1391 g_str_has_prefix (class_name, "openoffice"));1407 g_str_has_prefix (class_name, "openoffice"));
1392}1408}
13931409
1394static char *
1395get_process_name (gint pid)
1396{
1397 char *stat_path;
1398 char *contents;
1399 char **lines;
1400 char **sections;
1401 char *result = NULL;
1402
1403 if (pid <= 0)
1404 return NULL;
1405
1406 stat_path = g_strdup_printf ("/proc/%i/status", pid);
1407
1408 if (g_file_get_contents (stat_path, &contents, NULL, NULL))
1409 {
1410 lines = g_strsplit (contents, "\n", 2);
1411
1412 if (lines && g_strv_length (lines) > 0)
1413 {
1414 sections = g_strsplit (lines[0], "\t", 0);
1415 if (sections && g_strv_length (sections) > 1)
1416 {
1417 result = g_strdup (sections[1]);
1418 g_strfreev (sections);
1419 }
1420 g_strfreev (lines);
1421 }
1422 g_free (contents);
1423 }
1424 g_free (stat_path);
1425
1426 return result;
1427}
1428
1429static GList *1410static GList *
1430bamf_matcher_possible_applications_for_window_process (BamfMatcher *self, BamfLegacyWindow *window)1411bamf_matcher_possible_applications_for_window_process (BamfMatcher *self, BamfLegacyWindow *window)
1431{1412{
@@ -1466,10 +1447,9 @@
1466 return result;1447 return result;
1467 }1448 }
14681449
1469 guint pid = bamf_legacy_window_get_pid (window);1450 gchar *proc_name = bamf_legacy_window_get_process_name (window);
1470 gchar *proc_name = get_process_name (pid);
14711451
1472 if (proc_name)1452 if (bamf_matcher_is_valid_process_prefix (self, proc_name))
1473 {1453 {
1474 table_list = g_hash_table_lookup (priv->desktop_file_table, proc_name);1454 table_list = g_hash_table_lookup (priv->desktop_file_table, proc_name);
14751455
@@ -1477,15 +1457,15 @@
1477 {1457 {
1478 result = g_list_prepend (result, g_strdup (l->data));1458 result = g_list_prepend (result, g_strdup (l->data));
1479 }1459 }
1480 g_free (proc_name);
1481 }1460 }
1461 g_free (proc_name);
14821462
1483 result = g_list_reverse (result);1463 result = g_list_reverse (result);
1484 return result;1464 return result;
1485}1465}
14861466
1487static gboolean1467static gboolean
1488is_web_app_window (BamfMatcher *self, BamfLegacyWindow *window)1468is_web_app_window (BamfLegacyWindow *window)
1489{1469{
1490 const char *window_class = bamf_legacy_window_get_class_name (window);1470 const char *window_class = bamf_legacy_window_get_class_name (window);
1491 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);1471 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
@@ -1520,12 +1500,26 @@
1520}1500}
15211501
1522static gboolean1502static gboolean
1503is_javaws_window (BamfLegacyWindow *window)
1504{
1505 const char *window_class = bamf_legacy_window_get_class_name (window);
1506
1507 if (g_strcmp0 (window_class, "net-sourceforge-jnlp-runtime-Boot") == 0 ||
1508 g_strcmp0 (window_class, "com-sun-javaws-Main") == 0)
1509 {
1510 return TRUE;
1511 }
1512
1513 return FALSE;
1514}
1515
1516static gboolean
1523bamf_matcher_window_skips_hint_set (BamfMatcher *self, BamfLegacyWindow *window)1517bamf_matcher_window_skips_hint_set (BamfMatcher *self, BamfLegacyWindow *window)
1524{1518{
1525 gboolean skip_hint_set = FALSE;1519 gboolean skip_hint_set;
1526 g_return_val_if_fail (BAMF_IS_MATCHER (self), TRUE);1520 g_return_val_if_fail (BAMF_IS_MATCHER (self), TRUE);
15271521
1528 skip_hint_set = is_web_app_window (self, window);1522 skip_hint_set = is_web_app_window (window) || is_javaws_window (window);
15291523
1530 return skip_hint_set;1524 return skip_hint_set;
1531}1525}
@@ -1607,7 +1601,7 @@
16071601
1608 if (!filter_by_wmclass)1602 if (!filter_by_wmclass)
1609 {1603 {
1610 if (is_web_app_window (self, window))1604 if (is_web_app_window (window))
1611 {1605 {
1612 // This ensures that a new application is created even for unknown webapps1606 // This ensures that a new application is created even for unknown webapps
1613 filter_by_wmclass = TRUE;1607 filter_by_wmclass = TRUE;
16141608
=== added file 'tests/bamfdaemon/data/icedtea-netx-javaws.desktop'
--- tests/bamfdaemon/data/icedtea-netx-javaws.desktop 1970-01-01 00:00:00 +0000
+++ tests/bamfdaemon/data/icedtea-netx-javaws.desktop 2013-01-29 19:08:28 +0000
@@ -0,0 +1,12 @@
1[Desktop Entry]
2Name=IcedTea Java Web Start
3Name[fi]=IcedTea Java - Web Start
4Comment=IcedTea Java Web Start
5Comment[fi]=IcedTea Java - Web Start
6Exec=/usr/bin/javaws %u
7Terminal=false
8Type=Application
9Icon=javaws
10Categories=Application;Network;
11MimeType=application/x-java-jnlp-file;
12NoDisplay=true
013
=== modified file 'tests/bamfdaemon/test-matcher.c'
--- tests/bamfdaemon/test-matcher.c 2013-01-09 22:45:02 +0000
+++ tests/bamfdaemon/test-matcher.c 2013-01-29 19:08:28 +0000
@@ -34,6 +34,8 @@
34static void test_match_libreoffice_windows (void);34static void test_match_libreoffice_windows (void);
35static void test_match_gnome_control_center_panels (void);35static void test_match_gnome_control_center_panels (void);
36static void test_match_javaws_windows (void);36static void test_match_javaws_windows (void);
37static void test_match_javaws_windows_hint_ignored (void);
38static void test_match_javaws_windows_no_desktop_match (void);
37static void test_new_desktop_matches_unmatched_windows (void);39static void test_new_desktop_matches_unmatched_windows (void);
38static void test_match_transient_windows (void);40static void test_match_transient_windows (void);
39static void test_trim_exec_string (void);41static void test_trim_exec_string (void);
@@ -57,6 +59,8 @@
57 g_test_add_func (DOMAIN"/Matching/Application/LibreOffice", test_match_libreoffice_windows);59 g_test_add_func (DOMAIN"/Matching/Application/LibreOffice", test_match_libreoffice_windows);
58 g_test_add_func (DOMAIN"/Matching/Application/GnomeControlCenter", test_match_gnome_control_center_panels);60 g_test_add_func (DOMAIN"/Matching/Application/GnomeControlCenter", test_match_gnome_control_center_panels);
59 g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart", test_match_javaws_windows);61 g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart", test_match_javaws_windows);
62 g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart/HintIngored", test_match_javaws_windows_hint_ignored);
63 g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart/NoDesktopMatch", test_match_javaws_windows_no_desktop_match);
60 g_test_add_func (DOMAIN"/Matching/Windows/UnmatchedOnNewDesktop", test_new_desktop_matches_unmatched_windows);64 g_test_add_func (DOMAIN"/Matching/Windows/UnmatchedOnNewDesktop", test_new_desktop_matches_unmatched_windows);
61 g_test_add_func (DOMAIN"/Matching/Windows/Transient", test_match_transient_windows);65 g_test_add_func (DOMAIN"/Matching/Windows/Transient", test_match_transient_windows);
62 g_test_add_func (DOMAIN"/ExecStringTrimming", test_trim_exec_string);66 g_test_add_func (DOMAIN"/ExecStringTrimming", test_trim_exec_string);
@@ -571,7 +575,7 @@
571575
572 screen = bamf_legacy_screen_get_default ();576 screen = bamf_legacy_screen_get_default ();
573 matcher = bamf_matcher_get_default ();577 matcher = bamf_matcher_get_default ();
574 const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java " \578 const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws " \
575 "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \579 "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \
576 "-Xms8m -Djava.security.manager " \580 "-Xms8m -Djava.security.manager " \
577 "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \581 "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \
@@ -579,8 +583,8 @@
579 "-Dicedtea-web.bin.name=javaws " \583 "-Dicedtea-web.bin.name=javaws " \
580 "-Dicedtea-web.bin.location=/usr/bin/javaws "\584 "-Dicedtea-web.bin.location=/usr/bin/javaws "\
581 "net.sourceforge.jnlp.runtime.Boot";585 "net.sourceforge.jnlp.runtime.Boot";
582 const char *class_name = "sun-awt-X11-XFramePeer";586 const char *class_name = "net-sourceforge-jnlp-runtime-Boot";
583 const char *class_instance = "net-sourceforge-jnlp-runtime-Boot";587 const char *class_instance = "sun-awt-X11-XFramePeer";
584588
585 cleanup_matcher_tables (matcher);589 cleanup_matcher_tables (matcher);
586 export_matcher_on_bus (matcher);590 export_matcher_on_bus (matcher);
@@ -628,6 +632,93 @@
628}632}
629633
630static void634static void
635test_match_javaws_windows_hint_ignored (void)
636{
637 BamfMatcher *matcher;
638 BamfLegacyScreen *screen;
639 BamfLegacyWindowTest *test_win;
640 BamfApplication *app;
641
642 screen = bamf_legacy_screen_get_default ();
643 matcher = bamf_matcher_get_default ();
644 const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws " \
645 "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \
646 "-Xms8m -Djava.security.manager " \
647 "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \
648 "-classpath /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar " \
649 "-Dicedtea-web.bin.name=javaws " \
650 "-Dicedtea-web.bin.location=/usr/bin/javaws "\
651 "net.sourceforge.jnlp.runtime.Boot ";
652 const char *class_name = "net-sourceforge-jnlp-runtime-Boot";
653 const char *class_instance = "sun-awt-X11-XFramePeer";
654
655 cleanup_matcher_tables (matcher);
656 export_matcher_on_bus (matcher);
657
658 guint xid = g_random_int ();
659 guint pid = g_random_int ();
660 char *exec = g_strconcat (exec_prefix, "Notepad.jnlp", NULL);
661 test_win = bamf_legacy_window_test_new (xid, "Notepad", NULL, exec);
662 bamf_legacy_window_test_set_wmclass (test_win, class_name, class_instance);
663 test_win->pid = pid;
664 _bamf_legacy_screen_open_test_window (screen, test_win);
665 g_free (exec);
666
667 bamf_matcher_register_desktop_file_for_pid (matcher, DATA_DIR"/icedtea-netx-javaws.desktop", pid);
668
669 char *hint = bamf_legacy_window_get_hint (BAMF_LEGACY_WINDOW (test_win), _NET_WM_DESKTOP_FILE);
670 g_assert (hint == NULL);
671
672 app = bamf_matcher_get_application_by_xid (matcher, xid);
673 g_assert (BAMF_IS_APPLICATION (app));
674 g_assert (bamf_application_get_desktop_file (app) == NULL);
675
676 g_object_unref (matcher);
677 g_object_unref (screen);
678}
679
680static void
681test_match_javaws_windows_no_desktop_match (void)
682{
683 BamfMatcher *matcher;
684 BamfLegacyScreen *screen;
685 BamfLegacyWindowTest *test_win;
686 BamfApplication *app;
687
688 screen = bamf_legacy_screen_get_default ();
689 matcher = bamf_matcher_get_default ();
690 const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws " \
691 "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \
692 "-Xms8m -Djava.security.manager " \
693 "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \
694 "-classpath /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar " \
695 "-Dicedtea-web.bin.name=javaws " \
696 "-Dicedtea-web.bin.location=/usr/bin/javaws "\
697 "net.sourceforge.jnlp.runtime.Boot ";
698 const char *class_name = "net-sourceforge-jnlp-runtime-Boot";
699 const char *class_instance = "sun-awt-X11-XFramePeer";
700
701 cleanup_matcher_tables (matcher);
702 export_matcher_on_bus (matcher);
703
704 bamf_matcher_load_desktop_file (matcher, DATA_DIR"/icedtea-netx-javaws.desktop");
705
706 guint xid = g_random_int ();
707 char *exec = g_strconcat (exec_prefix, "Notepad.jnlp", NULL);
708 test_win = bamf_legacy_window_test_new (xid, "Notepad", NULL, exec);
709 bamf_legacy_window_test_set_wmclass (test_win, class_name, class_instance);
710 _bamf_legacy_screen_open_test_window (screen, test_win);
711 g_free (exec);
712
713 app = bamf_matcher_get_application_by_xid (matcher, xid);
714 g_assert (BAMF_IS_APPLICATION (app));
715 g_assert (bamf_application_get_desktop_file (app) == NULL);
716
717 g_object_unref (matcher);
718 g_object_unref (screen);
719}
720
721static void
631test_match_transient_windows (void)722test_match_transient_windows (void)
632{723{
633 BamfMatcher *matcher;724 BamfMatcher *matcher;
@@ -741,5 +832,18 @@
741 g_assert_cmpstr (trimmed, ==, "notepad.jnlp");832 g_assert_cmpstr (trimmed, ==, "notepad.jnlp");
742 g_free (trimmed);833 g_free (trimmed);
743834
835 exec = "/usr/lib/jvm/java-7-oracle/jre/bin/java " \
836 "-classpath /usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar " \
837 "-Djava.security.policy=file:/usr/lib/jvm/java-7-oracle/jre/lib/security/javaws.policy " \
838 "-DtrustProxy=true -Xverify:remote " \
839 "-Djnlpx.home=/usr/lib/jvm/java-7-oracle/jre/bin " \
840 "-Djnlpx.remove=true -Dsun.awt.warmup=true " \
841 "-Xbootclasspath/a:/usr/lib/jvm/java-7-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-7-oracle/jre/lib/plugin.jar " \
842 "-Xms12m -Xmx384m -Djnlpx.jvm=/usr/lib/jvm/java-7-oracle/jre/bin/java " \
843 "com.sun.javaws.Main Notepad.jnlp";
844 trimmed = bamf_matcher_get_trimmed_exec (matcher, exec);
845 g_assert_cmpstr (trimmed, ==, "notepad.jnlp");
846 g_free (trimmed);
847
744 g_object_unref (matcher);848 g_object_unref (matcher);
745}849}
746850
=== modified file 'tests/run-xvfb.sh'
--- tests/run-xvfb.sh 2012-12-05 15:46:36 +0000
+++ tests/run-xvfb.sh 2013-01-29 19:08:28 +0000
@@ -1,16 +1,14 @@
1# This script is based on the one used on dbusmenu project1# This script is based on the one used on dbusmenu project
22if [ -z "$DISPLAY" ] && [ -x "$XVFB_PATH" ]; then
3if [ -z $DISPLAY ] && [ -n "$XVFB_PATH" ]; then3
44 if [ -n "$LOG_PATH" ]; then
5if [ -n "x$LOG_PATH" ]; then5 xvfb_log=$LOG_PATH/Xvfb.out
6xvfb_log=$LOG_PATH/Xvfb.out6 else
7else7 xvfb_log=/dev/null
8xvfb_log=/dev/null8 fi
9fi9
1010XID=`for id in $(seq 100 150); do test -e /tmp/.X$id-lock || { echo $id; exit 0; }; done; exit 1`
11$XVFB_PATH -ac -noreset -screen 0 800x600x16 -help 2>/dev/null 1>&211{ $XVFB_PATH :$XID -ac -noreset -screen 0 800x600x16 -nolisten tcp -auth /dev/null > $xvfb_log 2>&1 & trap "kill -15 $! || true" 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; }
12XID=`for id in 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 9995 9996 9997 9998 9999 ; do test -e /tmp/.X$id-lock || { echo $id; exit 0; }; done; exit 1`
13{ $XVFB_PATH -ac -noreset -screen 0 800x600x16 :$XID -screen 0 800x600x16 -nolisten tcp -auth /dev/null > $xvfb_log 2>&1 & trap "kill -15 $! || true" 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; }
14DISPLAY=:$XID12DISPLAY=:$XID
15export DISPLAY13export DISPLAY
16fi14fi

Subscribers

People subscribed via source and target branches