### Question:
ChromeLauncher implements AutoCloseable { public ChromeService launch(Path chromeBinaryPath, ChromeArguments chromeArguments) throws ChromeProcessException { int port = launchChromeProcess(chromeBinaryPath, chromeArguments); return new ChromeServiceImpl(port); } ChromeLauncher();  ChromeLauncher(ChromeLauncherConfiguration configuration);  ChromeLauncher(
      ProcessLauncher processLauncher,
      Environment environment,
      ShutdownHookRegistry shutdownHookRegistry,
      ChromeLauncherConfiguration configuration); ChromeService launch(Path chromeBinaryPath, ChromeArguments chromeArguments); ChromeService launch(ChromeArguments chromeArguments); ChromeService launch(boolean headless); ChromeService launch(); Path getChromeBinaryPath(); @Override void close(); int exitValue(); boolean isAlive(); static final String ENV_CHROME_PATH; }### Answer:
@Test public void testLaunchHeadlessWithBinary() throws IOException, InterruptedException, ChromeProcessTimeoutException { expect(environment.getEnv("CHROME_PATH")).andReturn("/test-binary-path"); expect(processLauncher.isExecutable("/test-binary-path")).andReturn(true); shutdownHookRegistry.register(anyObject()); final String trigger = "\r\n\r\nDevTools listening on ws: expect(process.getInputStream()).andReturn(new ByteArrayInputStream(trigger.getBytes())); Capture<List<String>> captureArguments = Capture.newInstance(); expect(processLauncher.launch(eq("/test-binary-path"), capture(captureArguments))) .andReturn(process); expect(FilesUtils.randomTempDir("cdt-user-data-dir")).andReturn("temp-user-data-dir"); replayAll(); PowerMock.replay(FilesUtils.class); ChromeService launch = launcher.launch(); verifyAll(); PowerMock.verify(FilesUtils.class); assertNotNull(launch); assertTrue(launch instanceof ChromeServiceImpl); assertEquals(9123, ((ChromeServiceImpl) launch).getPort()); List<String> arguments = captureArguments.getValue(); assertEquals(20, arguments.size()); assertTrue(arguments.contains("--no-first-run")); assertTrue(arguments.contains("--remote-debugging-port=0")); assertTrue(arguments.contains("--mute-audio")); assertTrue(arguments.contains("--disable-client-side-phishing-detection")); assertTrue(arguments.contains("--disable-popup-blocking")); assertTrue(arguments.contains("--disable-default-apps")); assertTrue(arguments.contains("--disable-extensions")); assertTrue(arguments.contains("--metrics-recording-only")); assertTrue(arguments.contains("--no-default-browser-check")); assertTrue(arguments.contains("--disable-background-timer-throttling")); assertTrue(arguments.contains("--disable-translate")); assertTrue(arguments.contains("--safebrowsing-disable-auto-update")); assertTrue(arguments.contains("--headless")); assertTrue(arguments.contains("--hide-scrollbars")); assertTrue(arguments.contains("--disable-background-networking")); assertTrue(arguments.contains("--disable-prompt-on-repost")); assertTrue(arguments.contains("--disable-hang-monitor")); assertTrue(arguments.contains("--disable-sync")); assertTrue(arguments.contains("--disable-gpu")); assertTrue(arguments.contains("--user-data-dir=temp-user-data-dir")); }