This builds chromedriver when building chrome.  chromedriver is
chrome's implementation of the WebDriver protocol, which allows
for driving chrome via external software.  Most commonly this
is used in automated testing, often with Selenium, which supports
many different browsers and programming languages.

chromedriver is about 10MB uncompressed, and considering the size
of the chrome package, I don't think it is worth it to subpackage.

Tested on amd64 using ruby with the capybara and selenium-webdriver
libraries.  With only minor modifications to a test suite designed
for capybara-webkit, chromedriver was able to successfully complete
the test suite.

This does require one patch so that chromedriver can find the
chrome binary.

OKs?

Thanks,
Jeremy

Index: Makefile
===================================================================
RCS file: /cvs/ports/www/chromium/Makefile,v
retrieving revision 1.345
diff -u -p -u -p -r1.345 Makefile
--- Makefile    29 Oct 2017 14:36:53 -0000      1.345
+++ Makefile    4 Nov 2017 13:07:21 -0000
@@ -10,7 +10,7 @@ DPB_PROPERTIES=               parallel
 COMMENT=               Chromium browser
 
 V=                     62.0.3202.62
-REVISION=              0
+REVISION=              1
 
 DISTNAME=              chromium-${V}
 
@@ -97,7 +97,7 @@ BUILDTYPE=    Debug
 BUILDTYPE=     Release
 .endif
 
-ALL_TARGET=    chrome
+ALL_TARGET=    chrome chromedriver
 TEST_TARGET=   base_unittests
 
 CONFIGURE_STYLE=none # prevent python MODULE from overriding do-build
@@ -173,6 +173,7 @@ do-configure:
                --no-clean -s --gn-gen-args "${GN_ARGS}"
        @cd ${WRKSRC} && env -i ${CONFIGURE_ENV} ${WRKSRC}/out/Release/gn \
                gen --args="${GN_ARGS}" out/${BUILDTYPE}
+       ${SUBST_PROGRAM} 
${WRKSRC}/chrome/test/chromedriver/chrome/chrome_finder.cc
 
 do-build:
        @cd ${WRKSRC} && env -i ${MAKE_ENV} ninja \
@@ -182,6 +183,7 @@ do-install:
        ${INSTALL_DATA_DIR} ${PREFIX}/chrome
        ${INSTALL_PROGRAM} ${BUILDDIR}/chrome ${PREFIX}/chrome
        ${SUBST_PROGRAM} ${FILESDIR}/chrome ${PREFIX}/bin/chrome
+       ${INSTALL_PROGRAM} ${BUILDDIR}/chromedriver ${PREFIX}/bin/chromedriver
        ${INSTALL_MAN} ${BUILDDIR}/chrome.1 ${PREFIX}/man/man1
 
        ${INSTALL_DATA} ${BUILDDIR}/*.pak ${PREFIX}/chrome
Index: patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
===================================================================
RCS file: patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
diff -N patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-chrome_test_chromedriver_chrome_chrome_finder_cc      4 Nov 
2017 13:07:21 -0000
@@ -0,0 +1,24 @@
+$OpenBSD: patch-chrome_app_chrome_command_ids_h,v 1.3 2017/06/25 21:53:56 
robert Exp $
+Index: chrome/test/chromedriver/chrome/chrome_finder.cc
+--- chrome/test/chromedriver/chrome/chrome_finder.cc.orig      Fri Nov  3 
15:00:28 2017
++++ chrome/test/chromedriver/chrome/chrome_finder.cc   Fri Nov  3 15:01:35 2017
+@@ -45,6 +45,10 @@
+         installation_locations[i].Append(L"Chromium\\Application"));
+   }
+ }
++#elif 1
++void GetApplicationDirs(std::vector<base::FilePath>* locations) {
++  locations->push_back(base::FilePath("${PREFIX}/bin"));
++}
+ #elif defined(OS_LINUX)
+ void GetApplicationDirs(std::vector<base::FilePath>* locations) {
+   locations->push_back(base::FilePath("/opt/google/chrome"));
+@@ -102,7 +106,7 @@
+       base::FilePath("chromium-browser")
+ #else
+       // it will compile but won't work on other OSes
+-      base::FilePath()
++      base::FilePath("chrome"),
+ #endif
+   };
+ 
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/chromium/pkg/PLIST,v
retrieving revision 1.72
diff -u -p -u -p -r1.72 PLIST
--- pkg/PLIST   25 Oct 2017 13:47:07 -0000      1.72
+++ pkg/PLIST   4 Nov 2017 13:07:21 -0000
@@ -1,6 +1,7 @@
 @comment $OpenBSD: PLIST,v 1.72 2017/10/25 13:47:07 robert Exp $
 @pkgpath www/chromium,proprietary
 bin/chrome
+@bin bin/chromedriver
 chrome/
 @bin chrome/chrome
 chrome/chrome_100_percent.pak

Reply via email to