From 413d2fd538aefaa96825dd3f86c0acd975ee83ec Mon Sep 17 00:00:00 2001 From: Tobie Langel Date: Mon, 29 Sep 2008 02:32:03 +0200 Subject: [PATCH] Add support for the Chrome browser in jstest.rb. --- CHANGELOG | 2 ++ Rakefile | 2 +- test/lib/jstest.rb | 28 ++++++++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) mode change 100644 => 100755 Rakefile diff --git a/CHANGELOG b/CHANGELOG index 79a7ea4..a35d8ef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add support for the Chrome browser in jstest.rb. (Andrew Dupont) + * Workaround a JavaScript exception in Opera. (Thomas Fuchs) * Improve NodeList detection for Safari's $A function. (Garrett Smith, jddalton) diff --git a/Rakefile b/Rakefile old mode 100644 new mode 100755 index 399568c..7d2c2a1 --- a/Rakefile +++ b/Rakefile @@ -69,7 +69,7 @@ JavaScriptTestTask.new(:test_units => [:build_unit_tests]) do |t| end end - %w( safari firefox ie konqueror opera ).each do |browser| + %w( safari firefox ie konqueror opera chrome ).each do |browser| t.browser(browser.to_sym) unless browsers_to_test && !browsers_to_test.include?(browser) end end diff --git a/test/lib/jstest.rb b/test/lib/jstest.rb index 6cfa52d..353e6d4 100644 --- a/test/lib/jstest.rb +++ b/test/lib/jstest.rb @@ -50,6 +50,32 @@ class FirefoxBrowser < Browser end end +class ChromeBrowser < Browser + def initialize(path = nil) + @path = path || File.join( + ENV['UserPath'] || "C:/Documents and Settings/Administrator", + "Local Settings", + "Application Data", + "Google", + "Chrome", + "Application", + "chrome.exe" + ) + end + + def supported? + windows? + end + + def visit(url) + system("#{@path} #{url}") + end + + def to_s + "Chrome" + end +end + class SafariBrowser < Browser def supported? macos? @@ -354,6 +380,8 @@ class JavaScriptTestTask < ::Rake::TaskLib KonquerorBrowser.new when :opera OperaBrowser.new + when :chrome + ChromeBrowser.new else browser end