42 {
43 final SettingsChannel.ConfigurationQueue
queue =
new SettingsChannel.ConfigurationQueue();
44 final int baseId = Integer.MIN_VALUE;
45
46 queue.enqueueConfiguration(
47 new SettingsChannel.ConfigurationQueue.SentConfiguration(mock(DisplayMetrics.class)));
48 queue.enqueueConfiguration(
49 new SettingsChannel.ConfigurationQueue.SentConfiguration(mock(DisplayMetrics.class)));
50 assertEquals(baseId + 0,
queue.getConfiguration(baseId + 0).generationNumber);
51 assertEquals(baseId + 1,
queue.getConfiguration(baseId + 1).generationNumber);
52 assertEquals(baseId + 1,
queue.getConfiguration(baseId + 1).generationNumber);
53
54 queue.enqueueConfiguration(
55 new SettingsChannel.ConfigurationQueue.SentConfiguration(mock(DisplayMetrics.class)));
56 queue.enqueueConfiguration(
57 new SettingsChannel.ConfigurationQueue.SentConfiguration(mock(DisplayMetrics.class)));
58 assertEquals(baseId + 3,
queue.getConfiguration(baseId + 3).generationNumber);
59
60 assertEquals(baseId + 3,
queue.getConfiguration(baseId + 3).generationNumber);
61
62 final BasicMessageChannel.Reply replyFor4 =
63 queue.enqueueConfiguration(
64 new SettingsChannel.ConfigurationQueue.SentConfiguration(mock(DisplayMetrics.class)));
65 final BasicMessageChannel.Reply replyFor5 =
66 queue.enqueueConfiguration(
67 new SettingsChannel.ConfigurationQueue.SentConfiguration(mock(DisplayMetrics.class)));
68 replyFor4.reply(null);
69 replyFor5.reply(null);
70 assertEquals(baseId + 5,
queue.getConfiguration(baseId + 5).generationNumber);
71 assertEquals(baseId + 5,
queue.getConfiguration(baseId + 5).generationNumber);
72 }