public void manifestFetchedByVersion() throws Exception {
ApplicationManifest manifest
= new ApplicationManifest(MANIFEST_URI, XmlUtil.parse(MANIFEST_XML));
specFactory.cache.addElement(MANIFEST_URI, manifest, 1000);
GadgetSpec cachedSpec = new GadgetSpec(ALT_SPEC_URL, ALT_LOCAL_SPEC_XML);
specFactory.cache.addElement(ALT_SPEC_URL, cachedSpec, 1000);
GadgetSpec spec = specFactory.getGadgetSpec(new GadgetContext() {
@Override
public Uri getUrl() {
return MANIFEST_URI;
}
@Override
public String getParameter(String name) {
if (name.equals(DefaultGadgetSpecFactory.VERSION_PARAM)) {
return "2.0";
}
return null;
}
});
assertEquals(ALT_LOCAL_CONTENT, spec.getView(GadgetSpec.DEFAULT_VIEW).getContent());
}