### Question:
ChromeServiceImpl implements ChromeService { @Override public List<ChromeTab> getTabs() throws ChromeServiceException { return Arrays.asList(request(ChromeTab[].class, "http: } ChromeServiceImpl(String host, int port, WebSocketServiceFactory webSocketServiceFactory);  ChromeServiceImpl(String host, int port);  ChromeServiceImpl(int port);  ChromeServiceImpl(int port, WebSocketServiceFactory webSocketServiceFactory); void setWebSocketServiceFactory(WebSocketServiceFactory webSocketServiceFactory); @Override List<ChromeTab> getTabs(); @Override ChromeTab createTab(); @Override ChromeTab createTab(String tab); @Override void activateTab(ChromeTab tab); @Override void closeTab(ChromeTab tab); @Override ChromeVersion getVersion(); @Override synchronized ChromeDevToolsService createDevToolsService(ChromeTab tab); @Override synchronized ChromeDevToolsService createDevToolsService(
      ChromeTab tab, ChromeDevToolsServiceConfiguration chromeDevToolsServiceConfiguration); int getPort(); String getHost(); void clearChromeDevToolsServiceCache(ChromeTab tab); static String inputStreamToString(InputStream inputStream); static final String ABOUT_BLANK_PAGE; }### Answer:
@Test(expected = ChromeServiceException.class) public void testGetTabsOnBadHost() throws IOException, ChromeServiceException, InterruptedException { ChromeServiceImpl service = new ChromeServiceImpl("unknown-schema: service.getTabs(); }
@Test public void testGetTabs() throws IOException, ChromeServiceException, InterruptedException { MockWebServer server = new MockWebServer(); InputStream fixture = getFixture("chrome/tabs.json"); server.enqueue(new MockResponse().setBody(ChromeServiceImpl.inputStreamToString(fixture))); server.start(); ChromeServiceImpl service = new ChromeServiceImpl(server.getHostName(), server.getPort()); List<ChromeTab> tabs = service.getTabs(); RecordedRequest request = server.takeRequest(); assertEquals(1, server.getRequestCount()); assertEquals("GET /json/list HTTP/1.1", request.getRequestLine()); assertFalse(tabs.isEmpty()); assertEquals(2, tabs.size()); assertEquals("", tabs.get(0).getDescription()); assertEquals( "/devtools/inspector.html?ws=localhost:9222/devtools/page/(2C5C79DD1137419CC8839D61D91CEB2A)", tabs.get(0).getDevtoolsFrontendUrl()); assertEquals( "https: tabs.get(0).getFaviconUrl()); assertEquals("(2C5C79DD1137419CC8839D61D91CEB2A)", tabs.get(0).getId()); assertEquals("Google", tabs.get(0).getTitle()); assertEquals("page", tabs.get(0).getType()); assertTrue(tabs.get(0).isPageType()); assertEquals( "https: assertEquals( "ws: tabs.get(0).getWebSocketDebuggerUrl()); server.shutdown(); }