author Wan-Teh Chang <wtc@google.com>
Sun, 22 Mar 2009 09:44:55 -0700
changeset 26462 9560711165646da2bff775379e30997efbf7e1fd
parent 1 9b2a99adc05e53cd4010de512f50118594756650
child 58429 bacd5fbd6456709f64182e6d73afc9eb0f4a6a9a
permissions -rw-r--r--
Upgrade NSPR to NSPR_HEAD_20090321. This CVS tag includes the following changes: - Bug 439144: fixed strict aliasing issues in prdtoa.c - Bug 449665: suppress the parentheses warnings in prdtoa.c - Bug 442706: build for Symbian OS with autoconf and GNU make - Bug 432430: some more changes for the Symbian OS port - Bug 476536: added PR_ASSERT_CURRENT_THREAD_OWNS_LOCK and PR_ASSERT_CURRENT_THREAD_IN_MONITOR. - Bug 478687: made PRUint64/uint64 compatible with uint64_t for 64-bit Mac OS X - Bug 480730: PR_LoadLibrary for 64-bit MAC OS X should not search DYLD_LIBRARY_PATH if the library is specified as a pathname - Bug 480740: PR_ParseTimeString crash with dates >= year 3001 when compiled with Visual C++ 2005. - Bug 480074: better dependency resolution for import libraries - Bug 469083: ported NSPR test programs to WINCE - Bug 433790: removed some obsolete WIN16 code

package Tests;

use Util;
use strict;

my $objdir = '';

sub global_prefs {
    my ($binary, $embed_binary, $build_dir) = @_;

    my $binary_basename       = File::Basename::basename($binary);
    my $binary_dir            = File::Basename::dirname($binary);
    my $embed_binary_basename = File::Basename::basename($embed_binary);
    my $embed_binary_dir      = File::Basename::dirname($embed_binary);

    my $test_result = 'success';

    # Windows needs this for file: urls.
    my $win32_build_dir = $build_dir;
    if ($Settings::OS =~ /^WIN/ && $win32_build_dir !~ m/^.:\//) {
        chomp($win32_build_dir = `cygpath -w $win32_build_dir`);
        $win32_build_dir =~ s/\\/\//g;

    # Set prefs to run tests properly.
    # Chances are we will be timing these tests.  Bring gettime() into memory
    # by calling it once, before any tests run.

    my $pref_file = 'prefs.js';
    # Some tests need browser.dom.window.dump.enabled set to true, so
    # that JS dump() will work in optimized builds.
    Prefs::set_pref($pref_file, 'browser.dom.window.dump.enabled', 'true');
    # Set security prefs to allow us to close our own window,
    # pageloader test (and possibly other tests) needs this on.
    Prefs::set_pref($pref_file, 'dom.allow_scripts_to_close_windows', 'true');

    # Set security prefs to allow us to resize our windows.
    # DHTML and Tgfx perf tests (and possibly other tests) need this off.
    Prefs::set_pref($pref_file, 'dom.disable_window_flip', 'false');

    # Set prefs to allow us to move, resize, and raise/lower the
    # current window. Tgfx needs this.
    Prefs::set_pref($pref_file, 'dom.disable_window_flip', 'false');
    Prefs::set_pref($pref_file, 'dom.disable_window_move_resize', 'false');

    # Suppress firefox's popup blocking
    if ($Settings::BinaryName =~ /^firefox/) {
        Prefs::set_pref($pref_file, 'privacy.popups.firstTime', 'false');
        Prefs::set_pref($pref_file, 'dom.disable_open_during_load', 'false');

        # Suppress default browser dialog
        Prefs::set_pref($pref_file, 'browser.shell.checkDefaultBrowser', 'false');

        # Suppress session restore dialog
        Prefs::set_pref($pref_file, 'browser.sessionstore.resume_from_crash', 'false');
    elsif ($Settings::BinaryName eq 'Camino') {
        Prefs::set_pref($pref_file, 'camino.check_default_browser', 'false');

    # Suppress security warnings for QA test.
    if ($Settings::QATest) {
        Prefs::set_pref($pref_file, 'security.warn_submit_insecure', 'true');
    # Assume that we want to test modern skin for all tests.
    if (system("\\grep -s general.skins.selectedSkin \"$pref_file\" > /dev/null")) {
        Util::print_log("Setting general.skins.selectedSkin to modern/1.0\n");
        open PREFS, ">>$pref_file" or die "can't open $pref_file ($?)\n";
        print PREFS "user_pref(\"general.skins.selectedSkin\", \"modern/1.0\");\n";
        close PREFS;
    } else {
        Util::print_log("Modern skin already set.\n");

    if ($Settings::BinaryName eq 'Camino') {
      # stdout will be block-buffered and will not be flushed when the test
      # timeout expires and the process is killed, this would make tests
      # appear to fail.