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
1=== modified file 'src/bamf-legacy-window-test.c'
2--- src/bamf-legacy-window-test.c 2012-12-17 18:56:43 +0000
3+++ src/bamf-legacy-window-test.c 2013-01-29 19:08:28 +0000
4@@ -202,6 +202,16 @@
5 }
6
7 char *
8+bamf_legacy_window_test_get_process_name (BamfLegacyWindow *legacy_window)
9+{
10+ BamfLegacyWindowTest *self;
11+
12+ self = BAMF_LEGACY_WINDOW_TEST (legacy_window);
13+
14+ return g_strdup (self->process_name);
15+}
16+
17+char *
18 bamf_legacy_window_test_get_app_id (BamfLegacyWindow *legacy_window)
19 {
20 BamfLegacyWindowTest *self;
21@@ -379,6 +389,7 @@
22 g_free (self->wm_class_name);
23 g_free (self->wm_class_instance);
24 g_free (self->exec);
25+ g_free (self->process_name);
26 g_free (self->application_id);
27 g_free (self->unique_bus_name);
28 g_free (self->dbus_menu_object_path);
29@@ -399,6 +410,7 @@
30 win_class->get_class_name = bamf_legacy_window_test_get_class_name;
31 win_class->get_class_instance_name = bamf_legacy_window_test_get_class_instance_name;
32 win_class->get_exec_string = bamf_legacy_window_test_get_exec_string;
33+ win_class->get_process_name = bamf_legacy_window_test_get_process_name;
34 win_class->get_xid = bamf_legacy_window_test_get_xid;
35 win_class->get_pid = bamf_legacy_window_test_get_pid;
36 win_class->needs_attention = bamf_legacy_window_test_needs_attention;
37@@ -440,6 +452,7 @@
38 copy->wm_class_name = g_strdup (self->wm_class_name);
39 copy->wm_class_instance = g_strdup (self->wm_class_instance);
40 copy->exec = g_strdup (self->exec);
41+ copy->process_name = g_strdup (self->process_name);
42 copy->application_id = g_strdup (self->application_id);
43 copy->unique_bus_name = g_strdup (self->unique_bus_name);
44 copy->dbus_menu_object_path = g_strdup (self->dbus_menu_object_path);
45@@ -469,5 +482,13 @@
46 self->wm_class_name = g_strdup (wmclass_name);
47 self->exec = g_strdup (exec);
48
49+ if (self->exec)
50+ {
51+ gchar **splitted_exec = g_strsplit (exec, " ", 2);
52+ gchar *tmp = g_utf8_strrchr (splitted_exec[0], -1, G_DIR_SEPARATOR);
53+ self->process_name = g_strdup (tmp ? tmp + 1 : splitted_exec[0]);
54+ g_strfreev (splitted_exec);
55+ }
56+
57 return self;
58 }
59
60=== modified file 'src/bamf-legacy-window-test.h'
61--- src/bamf-legacy-window-test.h 2012-12-17 18:56:43 +0000
62+++ src/bamf-legacy-window-test.h 2013-01-29 19:08:28 +0000
63@@ -57,6 +57,7 @@
64 char * wm_class_name;
65 char * wm_class_instance;
66 char * exec;
67+ char * process_name;
68 char * application_id;
69 char * unique_bus_name;
70 char * dbus_menu_object_path;
71
72=== modified file 'src/bamf-legacy-window.c'
73--- src/bamf-legacy-window.c 2013-01-09 16:42:32 +0000
74+++ src/bamf-legacy-window.c 2013-01-29 19:08:28 +0000
75@@ -156,6 +156,51 @@
76 }
77
78 char *
79+bamf_legacy_window_get_process_name (BamfLegacyWindow *self)
80+{
81+ gchar *stat_path;
82+ gchar *contents;
83+ gchar **lines;
84+ gchar **sections;
85+ gchar *result = NULL;
86+ guint pid;
87+
88+ g_return_val_if_fail (BAMF_IS_LEGACY_WINDOW (self), NULL);
89+
90+ if (BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_process_name)
91+ return BAMF_LEGACY_WINDOW_GET_CLASS (self)->get_process_name (self);
92+
93+ pid = bamf_legacy_window_get_pid (self);
94+
95+ if (pid <= 0)
96+ return NULL;
97+
98+ stat_path = g_strdup_printf ("/proc/%i/status", pid);
99+
100+ if (g_file_get_contents (stat_path, &contents, NULL, NULL))
101+ {
102+ lines = g_strsplit (contents, "\n", 2);
103+
104+ if (lines && g_strv_length (lines) > 0)
105+ {
106+ sections = g_strsplit (lines[0], "\t", 0);
107+ if (sections)
108+ {
109+ if (g_strv_length (sections) > 1)
110+ result = g_strdup (sections[1]);
111+
112+ g_strfreev (sections);
113+ }
114+ g_strfreev (lines);
115+ }
116+ g_free (contents);
117+ }
118+ g_free (stat_path);
119+
120+ return result;
121+}
122+
123+char *
124 bamf_legacy_window_get_exec_string (BamfLegacyWindow *self)
125 {
126 gchar *result = NULL;
127@@ -193,6 +238,8 @@
128 return result;
129 }
130
131+
132+
133 const char *
134 bamf_legacy_window_save_mini_icon (BamfLegacyWindow *self)
135 {
136
137=== modified file 'src/bamf-legacy-window.h'
138--- src/bamf-legacy-window.h 2012-12-17 18:56:43 +0000
139+++ src/bamf-legacy-window.h 2013-01-29 19:08:28 +0000
140@@ -75,6 +75,7 @@
141 const char * (*get_class_name) (BamfLegacyWindow *legacy_window);
142 const char * (*get_class_instance_name) (BamfLegacyWindow *legacy_window);
143 char * (*get_exec_string) (BamfLegacyWindow *legacy_window);
144+ char * (*get_process_name) (BamfLegacyWindow *legacy_window);
145 char * (*get_app_id) (BamfLegacyWindow *legacy_window);
146 char * (*get_unique_bus_name) (BamfLegacyWindow *legacy_window);
147 char * (*get_menu_object_path) (BamfLegacyWindow *legacy_window);
148@@ -143,6 +144,8 @@
149
150 char * bamf_legacy_window_get_exec_string (BamfLegacyWindow *self);
151
152+char * bamf_legacy_window_get_process_name (BamfLegacyWindow *self);
153+
154 BamfLegacyWindow * bamf_legacy_window_get_transient (BamfLegacyWindow *self);
155
156 char * bamf_legacy_window_get_hint (BamfLegacyWindow *self,
157@@ -159,3 +162,4 @@
158 BamfLegacyWindow * bamf_legacy_window_new (WnckWindow *legacy_window);
159
160 #endif
161+
162
163=== modified file 'src/bamf-matcher-private.h'
164--- src/bamf-matcher-private.h 2013-01-08 18:55:38 +0000
165+++ src/bamf-matcher-private.h 2013-01-29 19:08:28 +0000
166@@ -51,5 +51,6 @@
167 BamfApplication * bamf_matcher_get_application_by_desktop_file (BamfMatcher *self, const char *desktop_file);
168 BamfApplication * bamf_matcher_get_application_by_xid (BamfMatcher *self, guint xid);
169 char * bamf_matcher_get_trimmed_exec (BamfMatcher *self, const char *exec);
170+gboolean bamf_matcher_is_valid_process_prefix (BamfMatcher *self, const char *exec);
171
172 #endif
173
174=== modified file 'src/bamf-matcher.c'
175--- src/bamf-matcher.c 2013-01-10 00:22:00 +0000
176+++ src/bamf-matcher.c 2013-01-29 19:08:28 +0000
177@@ -57,7 +57,8 @@
178 "^gksu(do)?$", "^sudo$", "^su-to-root$", "^amdxdg-su$", "^java(ws)?$",
179 "^mono$", "^ruby$", "^padsp$", "^aoss$", "^python(\\d.\\d)?$", "^(ba)?sh$",
180 "^perl$", "^env$", "^xdg-open$",
181- /* javaws strings: */ "^net\\.sourceforge\\.jnlp\\.runtime\\.Boot$", "^rt.jar$"
182+ /* javaws strings: */ "^net\\.sourceforge\\.jnlp\\.runtime\\.Boot$", "^rt\\.jar$",
183+ "^com\\.sun\\.javaws\\.Main$", "^deploy\\.jar$"
184 };
185
186 // Prefixes that must be considered starting point of exec strings
187@@ -509,6 +510,30 @@
188 return (l ? (char *) l->data : NULL);
189 }
190
191+gboolean
192+bamf_matcher_is_valid_process_prefix (BamfMatcher *self, const char *process_name)
193+{
194+ GRegex *regex;
195+ gint i;
196+
197+ g_return_val_if_fail (BAMF_IS_MATCHER (self), TRUE);
198+
199+ if (!process_name || *process_name == '\0')
200+ return FALSE;
201+
202+ for (i = 0; i < self->priv->bad_prefixes->len; ++i)
203+ {
204+ regex = g_array_index (self->priv->bad_prefixes, GRegex *, i);
205+
206+ if (g_regex_match (regex, process_name, 0, NULL))
207+ {
208+ return FALSE;
209+ }
210+ }
211+
212+ return TRUE;
213+}
214+
215 /* Attempts to return the binary name for a particular execution string */
216 char *
217 bamf_matcher_get_trimmed_exec (BamfMatcher * self, const char * exec_string)
218@@ -564,16 +589,7 @@
219 if (good_prefix)
220 continue;
221
222- bad_prefix = FALSE;
223- for (j = 0; j < self->priv->bad_prefixes->len; j++)
224- {
225- regex = g_array_index (self->priv->bad_prefixes, GRegex *, j);
226- if (g_regex_match (regex, part, 0, NULL))
227- {
228- bad_prefix = TRUE;
229- break;
230- }
231- }
232+ bad_prefix = !bamf_matcher_is_valid_process_prefix (self, part);
233
234 if (!bad_prefix)
235 {
236@@ -1288,7 +1304,7 @@
237
238 if (error)
239 {
240- g_warning ("Error monitoring %s: %s\n", directory, error->message);
241+ g_message ("Error monitoring %s: %s\n", directory, error->message);
242 g_error_free (error);
243 g_object_unref (file);
244 return;
245@@ -1391,41 +1407,6 @@
246 g_str_has_prefix (class_name, "openoffice"));
247 }
248
249-static char *
250-get_process_name (gint pid)
251-{
252- char *stat_path;
253- char *contents;
254- char **lines;
255- char **sections;
256- char *result = NULL;
257-
258- if (pid <= 0)
259- return NULL;
260-
261- stat_path = g_strdup_printf ("/proc/%i/status", pid);
262-
263- if (g_file_get_contents (stat_path, &contents, NULL, NULL))
264- {
265- lines = g_strsplit (contents, "\n", 2);
266-
267- if (lines && g_strv_length (lines) > 0)
268- {
269- sections = g_strsplit (lines[0], "\t", 0);
270- if (sections && g_strv_length (sections) > 1)
271- {
272- result = g_strdup (sections[1]);
273- g_strfreev (sections);
274- }
275- g_strfreev (lines);
276- }
277- g_free (contents);
278- }
279- g_free (stat_path);
280-
281- return result;
282-}
283-
284 static GList *
285 bamf_matcher_possible_applications_for_window_process (BamfMatcher *self, BamfLegacyWindow *window)
286 {
287@@ -1466,10 +1447,9 @@
288 return result;
289 }
290
291- guint pid = bamf_legacy_window_get_pid (window);
292- gchar *proc_name = get_process_name (pid);
293+ gchar *proc_name = bamf_legacy_window_get_process_name (window);
294
295- if (proc_name)
296+ if (bamf_matcher_is_valid_process_prefix (self, proc_name))
297 {
298 table_list = g_hash_table_lookup (priv->desktop_file_table, proc_name);
299
300@@ -1477,15 +1457,15 @@
301 {
302 result = g_list_prepend (result, g_strdup (l->data));
303 }
304- g_free (proc_name);
305 }
306+ g_free (proc_name);
307
308 result = g_list_reverse (result);
309 return result;
310 }
311
312 static gboolean
313-is_web_app_window (BamfMatcher *self, BamfLegacyWindow *window)
314+is_web_app_window (BamfLegacyWindow *window)
315 {
316 const char *window_class = bamf_legacy_window_get_class_name (window);
317 const char *instance_name = bamf_legacy_window_get_class_instance_name (window);
318@@ -1520,12 +1500,26 @@
319 }
320
321 static gboolean
322+is_javaws_window (BamfLegacyWindow *window)
323+{
324+ const char *window_class = bamf_legacy_window_get_class_name (window);
325+
326+ if (g_strcmp0 (window_class, "net-sourceforge-jnlp-runtime-Boot") == 0 ||
327+ g_strcmp0 (window_class, "com-sun-javaws-Main") == 0)
328+ {
329+ return TRUE;
330+ }
331+
332+ return FALSE;
333+}
334+
335+static gboolean
336 bamf_matcher_window_skips_hint_set (BamfMatcher *self, BamfLegacyWindow *window)
337 {
338- gboolean skip_hint_set = FALSE;
339+ gboolean skip_hint_set;
340 g_return_val_if_fail (BAMF_IS_MATCHER (self), TRUE);
341
342- skip_hint_set = is_web_app_window (self, window);
343+ skip_hint_set = is_web_app_window (window) || is_javaws_window (window);
344
345 return skip_hint_set;
346 }
347@@ -1607,7 +1601,7 @@
348
349 if (!filter_by_wmclass)
350 {
351- if (is_web_app_window (self, window))
352+ if (is_web_app_window (window))
353 {
354 // This ensures that a new application is created even for unknown webapps
355 filter_by_wmclass = TRUE;
356
357=== added file 'tests/bamfdaemon/data/icedtea-netx-javaws.desktop'
358--- tests/bamfdaemon/data/icedtea-netx-javaws.desktop 1970-01-01 00:00:00 +0000
359+++ tests/bamfdaemon/data/icedtea-netx-javaws.desktop 2013-01-29 19:08:28 +0000
360@@ -0,0 +1,12 @@
361+[Desktop Entry]
362+Name=IcedTea Java Web Start
363+Name[fi]=IcedTea Java - Web Start
364+Comment=IcedTea Java Web Start
365+Comment[fi]=IcedTea Java - Web Start
366+Exec=/usr/bin/javaws %u
367+Terminal=false
368+Type=Application
369+Icon=javaws
370+Categories=Application;Network;
371+MimeType=application/x-java-jnlp-file;
372+NoDisplay=true
373
374=== modified file 'tests/bamfdaemon/test-matcher.c'
375--- tests/bamfdaemon/test-matcher.c 2013-01-09 22:45:02 +0000
376+++ tests/bamfdaemon/test-matcher.c 2013-01-29 19:08:28 +0000
377@@ -34,6 +34,8 @@
378 static void test_match_libreoffice_windows (void);
379 static void test_match_gnome_control_center_panels (void);
380 static void test_match_javaws_windows (void);
381+static void test_match_javaws_windows_hint_ignored (void);
382+static void test_match_javaws_windows_no_desktop_match (void);
383 static void test_new_desktop_matches_unmatched_windows (void);
384 static void test_match_transient_windows (void);
385 static void test_trim_exec_string (void);
386@@ -57,6 +59,8 @@
387 g_test_add_func (DOMAIN"/Matching/Application/LibreOffice", test_match_libreoffice_windows);
388 g_test_add_func (DOMAIN"/Matching/Application/GnomeControlCenter", test_match_gnome_control_center_panels);
389 g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart", test_match_javaws_windows);
390+ g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart/HintIngored", test_match_javaws_windows_hint_ignored);
391+ g_test_add_func (DOMAIN"/Matching/Application/JavaWebStart/NoDesktopMatch", test_match_javaws_windows_no_desktop_match);
392 g_test_add_func (DOMAIN"/Matching/Windows/UnmatchedOnNewDesktop", test_new_desktop_matches_unmatched_windows);
393 g_test_add_func (DOMAIN"/Matching/Windows/Transient", test_match_transient_windows);
394 g_test_add_func (DOMAIN"/ExecStringTrimming", test_trim_exec_string);
395@@ -571,7 +575,7 @@
396
397 screen = bamf_legacy_screen_get_default ();
398 matcher = bamf_matcher_get_default ();
399- const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java " \
400+ const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws " \
401 "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \
402 "-Xms8m -Djava.security.manager " \
403 "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \
404@@ -579,8 +583,8 @@
405 "-Dicedtea-web.bin.name=javaws " \
406 "-Dicedtea-web.bin.location=/usr/bin/javaws "\
407 "net.sourceforge.jnlp.runtime.Boot";
408- const char *class_name = "sun-awt-X11-XFramePeer";
409- const char *class_instance = "net-sourceforge-jnlp-runtime-Boot";
410+ const char *class_name = "net-sourceforge-jnlp-runtime-Boot";
411+ const char *class_instance = "sun-awt-X11-XFramePeer";
412
413 cleanup_matcher_tables (matcher);
414 export_matcher_on_bus (matcher);
415@@ -628,6 +632,93 @@
416 }
417
418 static void
419+test_match_javaws_windows_hint_ignored (void)
420+{
421+ BamfMatcher *matcher;
422+ BamfLegacyScreen *screen;
423+ BamfLegacyWindowTest *test_win;
424+ BamfApplication *app;
425+
426+ screen = bamf_legacy_screen_get_default ();
427+ matcher = bamf_matcher_get_default ();
428+ const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws " \
429+ "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \
430+ "-Xms8m -Djava.security.manager " \
431+ "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \
432+ "-classpath /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar " \
433+ "-Dicedtea-web.bin.name=javaws " \
434+ "-Dicedtea-web.bin.location=/usr/bin/javaws "\
435+ "net.sourceforge.jnlp.runtime.Boot ";
436+ const char *class_name = "net-sourceforge-jnlp-runtime-Boot";
437+ const char *class_instance = "sun-awt-X11-XFramePeer";
438+
439+ cleanup_matcher_tables (matcher);
440+ export_matcher_on_bus (matcher);
441+
442+ guint xid = g_random_int ();
443+ guint pid = g_random_int ();
444+ char *exec = g_strconcat (exec_prefix, "Notepad.jnlp", NULL);
445+ test_win = bamf_legacy_window_test_new (xid, "Notepad", NULL, exec);
446+ bamf_legacy_window_test_set_wmclass (test_win, class_name, class_instance);
447+ test_win->pid = pid;
448+ _bamf_legacy_screen_open_test_window (screen, test_win);
449+ g_free (exec);
450+
451+ bamf_matcher_register_desktop_file_for_pid (matcher, DATA_DIR"/icedtea-netx-javaws.desktop", pid);
452+
453+ char *hint = bamf_legacy_window_get_hint (BAMF_LEGACY_WINDOW (test_win), _NET_WM_DESKTOP_FILE);
454+ g_assert (hint == NULL);
455+
456+ app = bamf_matcher_get_application_by_xid (matcher, xid);
457+ g_assert (BAMF_IS_APPLICATION (app));
458+ g_assert (bamf_application_get_desktop_file (app) == NULL);
459+
460+ g_object_unref (matcher);
461+ g_object_unref (screen);
462+}
463+
464+static void
465+test_match_javaws_windows_no_desktop_match (void)
466+{
467+ BamfMatcher *matcher;
468+ BamfLegacyScreen *screen;
469+ BamfLegacyWindowTest *test_win;
470+ BamfApplication *app;
471+
472+ screen = bamf_legacy_screen_get_default ();
473+ matcher = bamf_matcher_get_default ();
474+ const char *exec_prefix = "/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/javaws " \
475+ "-Xbootclasspath/a:/usr/share/icedtea-web/netx.jar " \
476+ "-Xms8m -Djava.security.manager " \
477+ "-Djava.security.policy=/etc/icedtea-web/javaws.policy " \
478+ "-classpath /usr/lib/jvm/java-6-openjdk-amd64/jre/lib/rt.jar " \
479+ "-Dicedtea-web.bin.name=javaws " \
480+ "-Dicedtea-web.bin.location=/usr/bin/javaws "\
481+ "net.sourceforge.jnlp.runtime.Boot ";
482+ const char *class_name = "net-sourceforge-jnlp-runtime-Boot";
483+ const char *class_instance = "sun-awt-X11-XFramePeer";
484+
485+ cleanup_matcher_tables (matcher);
486+ export_matcher_on_bus (matcher);
487+
488+ bamf_matcher_load_desktop_file (matcher, DATA_DIR"/icedtea-netx-javaws.desktop");
489+
490+ guint xid = g_random_int ();
491+ char *exec = g_strconcat (exec_prefix, "Notepad.jnlp", NULL);
492+ test_win = bamf_legacy_window_test_new (xid, "Notepad", NULL, exec);
493+ bamf_legacy_window_test_set_wmclass (test_win, class_name, class_instance);
494+ _bamf_legacy_screen_open_test_window (screen, test_win);
495+ g_free (exec);
496+
497+ app = bamf_matcher_get_application_by_xid (matcher, xid);
498+ g_assert (BAMF_IS_APPLICATION (app));
499+ g_assert (bamf_application_get_desktop_file (app) == NULL);
500+
501+ g_object_unref (matcher);
502+ g_object_unref (screen);
503+}
504+
505+static void
506 test_match_transient_windows (void)
507 {
508 BamfMatcher *matcher;
509@@ -741,5 +832,18 @@
510 g_assert_cmpstr (trimmed, ==, "notepad.jnlp");
511 g_free (trimmed);
512
513+ exec = "/usr/lib/jvm/java-7-oracle/jre/bin/java " \
514+ "-classpath /usr/lib/jvm/java-7-oracle/jre/lib/deploy.jar " \
515+ "-Djava.security.policy=file:/usr/lib/jvm/java-7-oracle/jre/lib/security/javaws.policy " \
516+ "-DtrustProxy=true -Xverify:remote " \
517+ "-Djnlpx.home=/usr/lib/jvm/java-7-oracle/jre/bin " \
518+ "-Djnlpx.remove=true -Dsun.awt.warmup=true " \
519+ "-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 " \
520+ "-Xms12m -Xmx384m -Djnlpx.jvm=/usr/lib/jvm/java-7-oracle/jre/bin/java " \
521+ "com.sun.javaws.Main Notepad.jnlp";
522+ trimmed = bamf_matcher_get_trimmed_exec (matcher, exec);
523+ g_assert_cmpstr (trimmed, ==, "notepad.jnlp");
524+ g_free (trimmed);
525+
526 g_object_unref (matcher);
527 }
528
529=== modified file 'tests/run-xvfb.sh'
530--- tests/run-xvfb.sh 2012-12-05 15:46:36 +0000
531+++ tests/run-xvfb.sh 2013-01-29 19:08:28 +0000
532@@ -1,16 +1,14 @@
533 # This script is based on the one used on dbusmenu project
534-
535-if [ -z $DISPLAY ] && [ -n "$XVFB_PATH" ]; then
536-
537-if [ -n "x$LOG_PATH" ]; then
538-xvfb_log=$LOG_PATH/Xvfb.out
539-else
540-xvfb_log=/dev/null
541-fi
542-
543-$XVFB_PATH -ac -noreset -screen 0 800x600x16 -help 2>/dev/null 1>&2
544-XID=`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`
545-{ $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; }
546+if [ -z "$DISPLAY" ] && [ -x "$XVFB_PATH" ]; then
547+
548+ if [ -n "$LOG_PATH" ]; then
549+ xvfb_log=$LOG_PATH/Xvfb.out
550+ else
551+ xvfb_log=/dev/null
552+ fi
553+
554+XID=`for id in $(seq 100 150); do test -e /tmp/.X$id-lock || { echo $id; exit 0; }; done; exit 1`
555+{ $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; }
556 DISPLAY=:$XID
557 export DISPLAY
558 fi

Subscribers

People subscribed via source and target branches