* Verify that social preloads pay attention to view resolution by
* using gadget.getCurrentView().
*/
@Test
public void testSocialPreloadViewResolution() throws Exception {
GadgetSpec spec = new GadgetSpec(GADGET_URL, XML_IN_DEFAULT_CONTAINER);
String socialResult = "[{id:'p', data:1}, {id:'a', data:2}]";
RecordingRequestPipeline pipeline = new RecordingRequestPipeline(socialResult);
PipelinedDataPreloader preloader = new PipelinedDataPreloader(pipeline, containerConfig);
view = "profile";
contextParams.put("st", "token");
Gadget gadget = new Gadget()
.setContext(context)
.setSpec(spec)
// Assume view resolution has behaved correctly
.setCurrentView(spec.getView(GadgetSpec.DEFAULT_VIEW));
PipelinedData.Batch batch = getBatch(gadget);
Collection<Callable<PreloadedData>> tasks = preloader.createPreloadTasks(
context, batch);
assertEquals(1, tasks.size());