Created
September 9, 2008 15:41
-
-
Save savetheclocktower/9696 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 9c8f4bd13483e7eea28a78a7fffffcc5cc337c21 Mon Sep 17 00:00:00 2001 | |
From: Andrew Dupont <prototype@andrewdupont.net> | |
Date: Tue, 9 Sep 2008 10:38:34 -0500 | |
Subject: [PATCH] Preliminary support for Google Chrome in unit tests. | |
--- | |
Rakefile | 2 +- | |
test/lib/jstest.rb | 28 ++++++++++++++++++++++++++++ | |
2 files changed, 29 insertions(+), 1 deletions(-) | |
mode change 100644 => 100755 Rakefile | |
diff --git a/Rakefile b/Rakefile | |
old mode 100644 | |
new mode 100755 | |
index 50da90e..b0873d5 | |
--- a/Rakefile | |
+++ b/Rakefile | |
@@ -70,7 +70,7 @@ JavaScriptTestTask.new(:test_units) 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 78fa737..73ab9f9 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) | |
+ @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 | |
-- | |
1.5.3.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment