// Templatized results.
Uri resultTpl = managerTpl.makeRenderingUri(gadget);
assertNotNull(resultTpl);
UriBuilder uriTpl = new UriBuilder(resultTpl);
assertEquals("", uriTpl.getScheme());
assertEquals(UNLOCKED_DOMAIN, uriTpl.getAuthority());
assertEquals(IFRAME_PATH, uriTpl.getPath());
assertEquals(SPEC_URI.toString(), uriTpl.getQueryParameter(Param.URL.getKey()));
assertEquals(CONTAINER, uriTpl.getQueryParameter(Param.CONTAINER.getKey()));
assertEquals(tplKey(Param.VIEW.getKey()), uriTpl.getQueryParameter(Param.VIEW.getKey()));
assertEquals(tplKey(Param.LANG.getKey()), uriTpl.getQueryParameter(Param.LANG.getKey()));
assertEquals(tplKey(Param.COUNTRY.getKey()), uriTpl.getQueryParameter(Param.COUNTRY.getKey()));
assertEquals(tplKey(Param.DEBUG.getKey()), uriTpl.getQueryParameter(Param.DEBUG.getKey()));
assertEquals(tplKey(Param.NO_CACHE.getKey()),
uriTpl.getQueryParameter(Param.NO_CACHE.getKey()));
assertEquals(tplKey(Param.SANITIZE.getKey()),
uriTpl.getQueryParameter(Param.SANITIZE.getKey()));
assertEquals(tplKey("up_" + prefKey), uriTpl.getFragmentParameter("up_" + prefKey));
// Only the params that are needed.
assertEquals(TYPE_HTML_NUM_BASE_PARAMS, uriTpl.getQueryParameters().size());
assertEquals(1, uriTpl.getFragmentParameters().size());
Map<String, Uri> uris = managerTpl.makeAllRenderingUris(gadget);
assertNotNull(uris);
UriBuilder htmlGadgetUri = new UriBuilder(uris.get(VIEW));
assertEquals("", htmlGadgetUri.getScheme());
assertEquals(UNLOCKED_DOMAIN, htmlGadgetUri.getAuthority());
assertEquals(IFRAME_PATH, htmlGadgetUri.getPath());
assertEquals(SPEC_URI.toString(), htmlGadgetUri.getQueryParameter(Param.URL.getKey()));
assertEquals(CONTAINER, htmlGadgetUri.getQueryParameter(Param.CONTAINER.getKey()));
assertEquals(tplKey(Param.VIEW.getKey()), htmlGadgetUri.getQueryParameter(Param.VIEW.getKey()));
assertEquals(tplKey(Param.LANG.getKey()), htmlGadgetUri.getQueryParameter(Param.LANG.getKey()));
assertEquals(tplKey(Param.COUNTRY.getKey()), htmlGadgetUri.getQueryParameter(Param.COUNTRY.getKey()));
assertEquals(tplKey(Param.DEBUG.getKey()), htmlGadgetUri.getQueryParameter(Param.DEBUG.getKey()));
assertEquals(tplKey(Param.NO_CACHE.getKey()),
htmlGadgetUri.getQueryParameter(Param.NO_CACHE.getKey()));
assertEquals(tplKey(Param.SANITIZE.getKey()),
htmlGadgetUri.getQueryParameter(Param.SANITIZE.getKey()));
assertEquals(tplKey("up_" + prefKey), htmlGadgetUri.getFragmentParameter("up_" + prefKey));
// Only the params that are needed.
assertEquals(TYPE_HTML_NUM_BASE_PARAMS, htmlGadgetUri.getQueryParameters().size());
assertEquals(1, htmlGadgetUri.getFragmentParameters().size());
UriBuilder urlGadgetUri = new UriBuilder(uris.get(ANOTHER_VIEW));
assertEquals("http", urlGadgetUri.getScheme());
assertEquals("example.com", urlGadgetUri.getAuthority());
assertEquals("/gadget.xml", urlGadgetUri.getPath());
assertNull(urlGadgetUri.getQueryParameter(Param.URL.getKey()));
assertEquals(CONTAINER, urlGadgetUri.getQueryParameter(Param.CONTAINER.getKey()));
assertEquals(tplKey(Param.VIEW.getKey()), urlGadgetUri.getQueryParameter(Param.VIEW.getKey()));
assertEquals(tplKey(Param.LANG.getKey()), urlGadgetUri.getQueryParameter(Param.LANG.getKey()));
assertEquals(tplKey(Param.COUNTRY.getKey()), urlGadgetUri.getQueryParameter(Param.COUNTRY.getKey()));
assertEquals(tplKey(Param.DEBUG.getKey()), urlGadgetUri.getQueryParameter(Param.DEBUG.getKey()));
assertEquals(tplKey(Param.NO_CACHE.getKey()),
urlGadgetUri.getQueryParameter(Param.NO_CACHE.getKey()));
assertEquals(tplKey(Param.SANITIZE.getKey()),
urlGadgetUri.getQueryParameter(Param.SANITIZE.getKey()));
assertEquals(tplKey("up_" + prefKey), urlGadgetUri.getQueryParameter("up_" + prefKey));
// Only the params that are needed.
assertEquals(TYPE_URL_NUM_BASE_PARAMS + 1, urlGadgetUri.getQueryParameters().size());
assertEquals(0, urlGadgetUri.getFragmentParameters().size());
assertFalse(managerTpl.tokenForRenderingCalled());
assertTrue(managerTpl.schemeCalled());
assertTrue(managerTpl.addExtrasCalled());
}