}
}
}-*/;
public void testCoverageDataIsFlushedToLocalStorageOnBeforeUnload() {
Storage localStorage = Storage.getLocalStorageIfSupported();
assertNotNull("Test browser does not support localStorage", localStorage);
// No coverage initially
assertNull("Found unexpected initial coverage", localStorage.getItem("gwt_coverage"));
CoverageTestModule.method();
// Trigger the onbeforeunload handler to flush the coverage information to localStorage.
fireOnBeforeUnloadEvent();
String coverageAsJson = localStorage.getItem("gwt_coverage");
assertNotNull("No coverage data found", coverageAsJson);
JSONObject coverage = JSONParser.parseStrict(coverageAsJson).isObject();
assertNotNull("Coverage data was not valid JSON", coverage);
JSONObject fileCoverage =