My roomba does not just keep sweeping until it runs out of power. It terminates quickly in a small space and terminates slower in a large space. To terminate it must somehow sense the size of the space it is working in and compare it to some register of how long it has operated.
Roombas try to build up a (very limited) model of how big the room is from the longest uninterrrupted traversal it can sense. See “Can you tell me more about the cleaning algorithm that the Roomba uses?” in http://www.botjunkie.com/2010/05/17/botjunkie-interview-nancy-dussault-smith-on-irobots-roomba/