// Generate URI, turn into UriBuilder for validation
Uri result = manager.makeRenderingUri(gadget);
assertNotNull(result);
UriBuilder uri = new UriBuilder(result);
assertEquals("", uri.getScheme());
assertEquals(UNLOCKED_DOMAIN, uri.getAuthority());
assertEquals(IFRAME_PATH, uri.getPath());
assertEquals(SPEC_URI.toString(), uri.getQueryParameter(Param.URL.getKey()));
assertEquals(CONTAINER, uri.getQueryParameter(Param.CONTAINER.getKey()));
assertEquals(VIEW, uri.getQueryParameter(Param.VIEW.getKey()));
assertEquals(LANG, uri.getQueryParameter(Param.LANG.getKey()));
assertEquals(COUNTRY, uri.getQueryParameter(Param.COUNTRY.getKey()));
assertEquals("0", uri.getQueryParameter(Param.DEBUG.getKey()));
assertEquals("0", uri.getQueryParameter(Param.NO_CACHE.getKey()));
assertEquals("0", uri.getQueryParameter(Param.SANITIZE.getKey()));
assertEquals(prefVal, uri.getFragmentParameter("up_" + prefKey));
// Only the params that are needed.
assertEquals(TYPE_HTML_NUM_BASE_PARAMS, uri.getQueryParameters().size());
assertEquals(1, uri.getFragmentParameters().size());
Map<String, Uri> uris = manager.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(VIEW, htmlGadgetUri.getQueryParameter(Param.VIEW.getKey()));
assertEquals(LANG, htmlGadgetUri.getQueryParameter(Param.LANG.getKey()));
assertEquals(COUNTRY, htmlGadgetUri.getQueryParameter(Param.COUNTRY.getKey()));
assertEquals("0", htmlGadgetUri.getQueryParameter(Param.DEBUG.getKey()));
assertEquals("0", htmlGadgetUri.getQueryParameter(Param.NO_CACHE.getKey()));
assertEquals("0", htmlGadgetUri.getQueryParameter(Param.SANITIZE.getKey()));
assertEquals(prefVal, 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(ANOTHER_VIEW, urlGadgetUri.getQueryParameter(Param.VIEW.getKey()));
assertEquals(LANG, urlGadgetUri.getQueryParameter(Param.LANG.getKey()));
assertEquals(COUNTRY, urlGadgetUri.getQueryParameter(Param.COUNTRY.getKey()));
assertEquals("0", urlGadgetUri.getQueryParameter(Param.DEBUG.getKey()));
assertEquals("0", urlGadgetUri.getQueryParameter(Param.NO_CACHE.getKey()));
assertEquals("0", urlGadgetUri.getQueryParameter(Param.SANITIZE.getKey()));
assertEquals(prefVal, 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(manager.tokenForRenderingCalled());
assertTrue(manager.schemeCalled());
assertTrue(manager.addExtrasCalled());
}