}
public void testFilesLoadedAreAddedToTheBrowserFileSet() throws Exception {
CapturedBrowsers browsers = new CapturedBrowsers(new BrowserIdStrategy(new MockTime(0)));
String id = "1";
SlaveBrowser slave =
new SlaveBrowser(new TimeImpl(), id, new BrowserInfo(), 20, null, CaptureHandler.QUIRKS,
RunnerType.CLIENT, BrowserState.CAPTURED, new Instant(0));
browsers.addSlave(slave);
BrowserQueryResponseHandler handler =
new BrowserQueryResponseHandler(null, null, browsers, streamedResponses);
List<FileResult> fileResults = new LinkedList<FileResult>();
fileResults.add(new FileResult(new FileSource("/test/filename1.js", "filename1.js", 123, -1), true, ""));
fileResults.add(new FileResult(new FileSource("/test/filename2.js", "filename2.js", 456, -1), true, ""));
fileResults.add(new FileResult(new FileSource("/test/filename3.js", "filename3.js", 789, -1), true, ""));
slave.createCommand("awaitingResponse");
slave.dequeueCommand();
slave.createCommand("BrowserCommand");
Response response = new Response();
response.setType(ResponseType.FILE_LOAD_RESULT.name());
response.setResponse(gson.toJson(new LoadedFiles(fileResults)));
handler.service("1", gson.toJson(response), "", null, writer);
Set<FileInfo> fileInfos = slave.getFileSet();
assertEquals(3, fileInfos.size());
Iterator<FileInfo> iterator = fileInfos.iterator();
FileInfo info1 = iterator.next();