At least in my state of California, the emissions testing systems I've seen when I get my vehicle tested only place one axle on rollers. The other axle is on the ground. During the test, the driven axle spins at up to 65 MPH, while the non-driven axle doesn't spin at all. If the vehicle being tested has features such as ABS or traction control, then the car needs to know that it's on a tester in order to avoid doing potentially dangerous things.
The problem here is not that the vehicles detect that they're on a tester and perform specific actions, since doing so is a critical engineering requirement. The problem is that they disable emissions controls when they are not on a tester.