Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / testing / tinderbox-standalone-tests / Tests.pm
blob59a046636ad3c466b2a575892e9877b623360499
1 package Tests;
3 use Util;
4 use strict;
6 my $objdir = '';
8 sub global_prefs {
9 my ($binary, $embed_binary, $build_dir) = @_;
11 my $binary_basename = File::Basename::basename($binary);
12 my $binary_dir = File::Basename::dirname($binary);
13 my $embed_binary_basename = File::Basename::basename($embed_binary);
14 my $embed_binary_dir = File::Basename::dirname($embed_binary);
16 my $test_result = 'success';
18 # Windows needs this for file: urls.
19 my $win32_build_dir = $build_dir;
20 if ($Settings::OS =~ /^WIN/ && $win32_build_dir !~ m/^.:\//) {
21 chomp($win32_build_dir = `cygpath -w $win32_build_dir`);
22 $win32_build_dir =~ s/\\/\//g;
26 # Set prefs to run tests properly.
28 # Chances are we will be timing these tests. Bring gettime() into memory
29 # by calling it once, before any tests run.
30 Time::PossiblyHiRes::getTime();
32 my $pref_file = 'prefs.js';
34 # Some tests need browser.dom.window.dump.enabled set to true, so
35 # that JS dump() will work in optimized builds.
36 Prefs::set_pref($pref_file, 'browser.dom.window.dump.enabled', 'true');
38 # Set security prefs to allow us to close our own window,
39 # pageloader test (and possibly other tests) needs this on.
40 Prefs::set_pref($pref_file, 'dom.allow_scripts_to_close_windows', 'true');
42 # Set security prefs to allow us to resize our windows.
43 # DHTML and Tgfx perf tests (and possibly other tests) need this off.
44 Prefs::set_pref($pref_file, 'dom.disable_window_flip', 'false');
46 # Set prefs to allow us to move, resize, and raise/lower the
47 # current window. Tgfx needs this.
48 Prefs::set_pref($pref_file, 'dom.disable_window_flip', 'false');
49 Prefs::set_pref($pref_file, 'dom.disable_window_move_resize', 'false');
51 # Suppress firefox's popup blocking
52 if ($Settings::BinaryName =~ /^firefox/) {
53 Prefs::set_pref($pref_file, 'privacy.popups.firstTime', 'false');
54 Prefs::set_pref($pref_file, 'dom.disable_open_during_load', 'false');
56 # Suppress default browser dialog
57 Prefs::set_pref($pref_file, 'browser.shell.checkDefaultBrowser', 'false');
59 # Suppress session restore dialog
60 Prefs::set_pref($pref_file, 'browser.sessionstore.resume_from_crash', 'false');
62 elsif ($Settings::BinaryName eq 'Camino') {
63 Prefs::set_pref($pref_file, 'camino.check_default_browser', 'false');
66 # Suppress security warnings for QA test.
67 if ($Settings::QATest) {
68 Prefs::set_pref($pref_file, 'security.warn_submit_insecure', 'true');
72 # Assume that we want to test modern skin for all tests.
74 if (system("\\grep -s general.skins.selectedSkin \"$pref_file\" > /dev/null")) {
75 Util::print_log("Setting general.skins.selectedSkin to modern/1.0\n");
76 open PREFS, ">>$pref_file" or die "can't open $pref_file ($?)\n";
77 print PREFS "user_pref(\"general.skins.selectedSkin\", \"modern/1.0\");\n";
78 close PREFS;
79 } else {
80 Util::print_log("Modern skin already set.\n");
83 if ($Settings::BinaryName eq 'Camino') {
84 # stdout will be block-buffered and will not be flushed when the test
85 # timeout expires and the process is killed, this would make tests
86 # appear to fail.
87 $ENV{'MOZ_UNBUFFERED_STDIO'} = 1;