From: Chris Nehren Date: Fri, 14 Jan 2011 13:04:57 +0000 (-0500) Subject: first trial of xvnc support X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7522d6aa63dac8ca389f71c72823213228a07756;p=scpubgit%2FTest-Harness-Selenium.git first trial of xvnc support --- diff --git a/lib/Test/Harness/Selenium.pm b/lib/Test/Harness/Selenium.pm index 3590be0..51d099f 100644 --- a/lib/Test/Harness/Selenium.pm +++ b/lib/Test/Harness/Selenium.pm @@ -31,6 +31,19 @@ BEGIN { sub new { my ($class, $self) = @_; + if($self->{xvnc}) { + $ENV{DISPLAY} = $self->{xvnc}; + my $xvnc_pid = fork(); + if(!defined $xvnc_pid) { + die "couldn't fork xvnc: $!"; + } + elsif($xvnc_pid) { + $self->{xvnc_pid} = $xvnc_pid; + } + else { + exec("Xvnc", $self->{xvnc}); + } + } bless $self, $class; } @@ -103,4 +116,11 @@ sub get_rows_for { return \@rows; } +sub DESTROY { + my($self) = @_; + if(exists $self->{xvnc_pid}) { + kill("KILL", $self->{xvnc_pid}); + } +} + 1;