diff options
author | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 18:28:20 +0000 |
---|---|---|
committer | gspencer@google.com <gspencer@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 18:28:20 +0000 |
commit | 19f6ea2445f731935707d3258414cb685300c613 (patch) | |
tree | 028a2bf7b9b3f24fa7984a8ddfd2e54397f8d98f /o3d | |
parent | c774c953ba1a748254528c26d1e5e72ad8ccbf27 (diff) | |
download | chromium_src-19f6ea2445f731935707d3258414cb685300c613.zip chromium_src-19f6ea2445f731935707d3258414cb685300c613.tar.gz chromium_src-19f6ea2445f731935707d3258414cb685300c613.tar.bz2 |
This makes selenium in Firefox work on the Mac.
Review URL: http://codereview.chromium.org/201046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25639 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/serializer/cross/serializer.cc | 4 | ||||
-rw-r--r-- | o3d/tests/selenium/mac_chrome.sh | 2 | ||||
-rw-r--r-- | o3d/tests/selenium/selenium.gyp | 64 | ||||
-rw-r--r-- | o3d/tests/selenium/unpack_firefox.py | 90 |
4 files changed, 152 insertions, 8 deletions
diff --git a/o3d/serializer/cross/serializer.cc b/o3d/serializer/cross/serializer.cc index f83f102..0aff9de 100644 --- a/o3d/serializer/cross/serializer.cc +++ b/o3d/serializer/cross/serializer.cc @@ -324,10 +324,10 @@ class PropertiesVisitor : public VisitorBase<PropertiesVisitor> { writer_->BeginCompacting(); writer_->OpenArray(); const Skin::InfluencesArray& influences_array = skin->influences(); - for (int i = 0; i != influences_array.size(); ++i) { + for (Skin::InfluencesArray::size_type i = 0; i != influences_array.size(); ++i) { const Skin::Influences& influences = influences_array[i]; writer_->OpenArray(); - for (int j = 0; j != influences.size(); ++j) { + for (Skin::Influences::size_type j = 0; j != influences.size(); ++j) { const Skin::Influence& influence = influences[j]; Serialize(writer_, influence.matrix_index); Serialize(writer_, influence.weight); diff --git a/o3d/tests/selenium/mac_chrome.sh b/o3d/tests/selenium/mac_chrome.sh new file mode 100644 index 0000000..68a0c87 --- /dev/null +++ b/o3d/tests/selenium/mac_chrome.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" "$@" diff --git a/o3d/tests/selenium/selenium.gyp b/o3d/tests/selenium/selenium.gyp index b9aa09f..f89e8f7 100644 --- a/o3d/tests/selenium/selenium.gyp +++ b/o3d/tests/selenium/selenium.gyp @@ -76,10 +76,37 @@ 'python<(EXECUTABLE_SUFFIX)', 'o3d/tests/selenium/main.py', '<@(selenium_args)', + '--browserpath=<(browser_path)', '--browser=*firefox', '--screenshotsdir=<(PRODUCT_DIR)/tests/selenium/screenshots_firefox', ], }, + 'conditions': [ + ['OS=="win"', + { + 'variables': { + 'browser_path': '', + }, + } + ], + ['OS=="linux"', + { + 'variables': { + 'browser_path': '', + }, + }, + ], + ['OS=="mac"', + { + 'dependencies': [ + 'unpack_firefox', + ], + 'variables': { + 'browser_path': '<(PRODUCT_DIR)/selenium_firefox/Firefox.app/Contents/MacOS/firefox-bin', + }, + }, + ], + ], }, { 'target_name': 'selenium_chrome', @@ -99,26 +126,30 @@ 'python<(EXECUTABLE_SUFFIX)', 'main.py', '<@(selenium_args)', + '--browserpath=<(browser_path)', '--browser=*googlechrome', '--screenshotsdir=<(PRODUCT_DIR)/tests/selenium/screenshots_chrome', ], }, 'conditions': [ + ['OS=="win"', + { + 'variables': { + 'browser_path': '', + }, + } + ], ['OS=="linux"', { 'variables': { - 'selenium_args': [ - '--browserpath=/usr/bin/google-chrome', - ], + 'browser_path': '/usr/bin/google-chrome', }, }, ], ['OS=="mac"', { 'variables': { - 'selenium_args': [ - '--browserpath="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"', - ], + 'browser_path': 'mac_chrome.sh', }, }, ], @@ -139,6 +170,27 @@ { 'targets': [ { + 'target_name': 'unpack_firefox', + 'type': 'none', + 'actions': [ + { + 'action_name': 'unpack_firefox', + 'inputs': [ + '<(PRODUCT_DIR)/O3D.plugin', + ], + 'outputs': [ + '<(PRODUCT_DIR)/selenium_firefox', + ], + 'action': [ + 'python', + 'unpack_firefox.py', + '--plugin_path=<(PRODUCT_DIR)/O3D.plugin', + '--product_path=<(PRODUCT_DIR)', + ], + }, + ], + }, + { 'target_name': 'selenium_safari', 'type': 'none', 'dependencies': [ diff --git a/o3d/tests/selenium/unpack_firefox.py b/o3d/tests/selenium/unpack_firefox.py new file mode 100644 index 0000000..4cafefc --- /dev/null +++ b/o3d/tests/selenium/unpack_firefox.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +import sys +import os +import shutil +import subprocess + +script_dir = os.path.normpath(os.path.dirname(os.path.abspath(__file__))) +o3d_dir = os.path.dirname(os.path.dirname(script_dir)) +src_dir = os.path.dirname(o3d_dir) +third_party_dir = os.path.join(src_dir, 'third_party') +internal_dir = os.path.join(src_dir, 'o3d-internal') +gflags_dir = os.path.join(third_party_dir, 'gflags', 'python') +sys.path.append(gflags_dir) + +import gflags + +# Command line flags +FLAGS = gflags.FLAGS +gflags.DEFINE_boolean("cleanup", False, + "If this is set, then the script cleans up " + "instead of unpacking.") +gflags.DEFINE_string("plugin_path", "", "This is the path to the plugin.") +gflags.DEFINE_string("product_path", "", + "This is the path to the built products.") + +if sys.platform != "darwin": + print "This script is only for use on Mac OS X" + sys.exit(-1) + +def Cleanup(dir): + shutil.rmtree(dir, ignore_errors=True) + +def InstallInternal(internal_firefox_dir, firefox_dir): + firefox_app = os.path.join(firefox_dir, 'Firefox.app') + firefox_tgz = os.path.join(internal_firefox_dir, 'firefox.tgz') + print "Unpacking Firefox in '%s' to staging area." % firefox_tgz + os.mkdir(firefox_dir) + subprocess.call(['tar', '-C', firefox_dir, 'xfz', firefox_tgz]) + dest_plugin_path = os.path.join(firefox_app, 'Contents', 'MacOS', + 'plugins', + os.path.basename(FLAGS.plugin_path)) + os.symlink(FLAGS.plugin_path, dest_plugin_path) + return 0 + +def Install(firefox_dir): + # No hermetic version, look for Firefox.app in /Applications + source_app = '/Applications/Firefox.app' + print "Copying Firefox in '%s' to staging area." % source_app + + if not os.path.exists(source_app): + print "Unable to find Firefox in %s, is it installed?" % source_app + sys.exit(-1) + + firefox_app = os.path.join(firefox_dir, 'Firefox.app') + dest_plugin_path = os.path.join(firefox_app, 'Contents', 'MacOS', + 'plugins', + os.path.basename(FLAGS.plugin_path)) + os.mkdir(firefox_dir) + subprocess.call(['ditto', source_app, firefox_app]) + os.symlink(FLAGS.plugin_path, dest_plugin_path) + return 0 + +def main(args): + internal_firefox_dir = os.path.join(internal_dir, 'firefox') + if not os.path.exists(FLAGS.plugin_path): + print "Plugin '%s' is missing." % FLAGS.plugin_path + sys.exit(-1) + + if not os.path.exists(FLAGS.product_path): + print "Product path '%s' is missing." % FLAGS.product_path + sys.exit(-1) + + # Cleanup any residual stuff. + firefox_dir = os.path.join(FLAGS.product_path, 'selenium_firefox') + Cleanup(firefox_dir) + + if not FLAGS.cleanup: + # if we have a hermetic version of Firefox, then use it. + if os.path.exists(internal_firefox_dir): + sys.exit(InstallInternal(internal_firefox_dir, firefox_dir)) + # Otherwise, we just copy what the user has installed. + else: + if not FLAGS.cleanup: + sys.exit(Install(firefox_dir)) + sys.exit(0) + +if __name__ == "__main__": + bare_args = FLAGS(sys.argv) + main(bare_args) |