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 Aug. 29, 2018, 9:15 a.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
Index: test/browsers/chromium.js
diff --git a/test/browsers/chromium.js b/test/browsers/chromium.js
new file mode 100644
index 0000000000000000000000000000000000000000..4f0d24191b330bb0ff9ba50e658bdad0eddd6f13
--- /dev/null
+++ b/test/browsers/chromium.js
@@ -0,0 +1,48 @@
+/*
+ * 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.getDriver = function(devenvPathAbsolute)
+{
+ return ensureChromium(CHROMIUM_REVISION).then(chromiumPath =>
+ {
+ let options = new chrome.Options()
+ .setChromeBinaryPath(chromiumPath)
+ .addArguments("--no-sandbox")
+ .addArguments(`load-extension=${devenvPathAbsolute}`);
+
+ return new webdriver.Builder()
+ .forBrowser("chrome")
+ .setChromeOptions(options)
+ .build();
+ });
+};

Powered by Google App Engine
This is Rietveld