Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/browsers/chromium.js

Issue 29866577: Issue 6887 - add Chrome to "npm test" (Closed)
Patch Set: Created Sept. 1, 2018, 2:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/all.js ('k') | test/browsers/firefox.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/browsers/chromium.js
diff --git a/test/browsers/chromium.js b/test/browsers/chromium.js
new file mode 100644
index 0000000000000000000000000000000000000000..6990f2a59905559aa3b5f9dcef2a2520ac08144d
--- /dev/null
+++ b/test/browsers/chromium.js
@@ -0,0 +1,50 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-present eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+"use strict";
+
+// The Chromium version is a build number, quite obscure.
+// Chromium 63.0.3239.x is 508578
+// Chromium 65.0.3325.0 is 530368
+// We currently want Chromiun 63, as we still support it and that's the
+// loweset version that supports WebDriver.
+const CHROMIUM_REVISION = 508578;
+
+const webdriver = require("selenium-webdriver");
+const chrome = require("selenium-webdriver/chrome");
+const {ensureChromium} = require("../../adblockpluscore/test/runners/" +
+ "chromium_download");
+
+exports.platform = "chrome";
+
+exports.ensureBrowser = function()
+{
+ return ensureChromium(CHROMIUM_REVISION);
+};
+
+exports.getDriver = function(browserBinary, devenvPath)
+{
+ let options = new chrome.Options()
+ .setChromeBinaryPath(browserBinary)
+ .addArguments("--no-sandbox")
+ .addArguments(`load-extension=${devenvPath}`);
+
+ return new webdriver.Builder()
+ .forBrowser("chrome")
+ .setChromeOptions(options)
+ .build();
+};
« no previous file with comments | « test/all.js ('k') | test/browsers/firefox.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld