Mechanical shutter even electronically controlled isn't very accurate because it depends a lot on the curtain speed so there is a need for checking. I wonder at final assembly don't they check it.
I'm sure they check it during assembly. However, whatever diagnostics and test fixtures they have access to are far beyond us. For all we know, in some cameras, the shutter module might have its own internal instrumentation and diagnostics - it might be able to measure something like when the second curtain fires or when it closes, and whether that's in spec. We know that many electronic SLRs have an option for second curtain flash sync, so they have access to at least two different timings (first and second curtain). That doesn't guarantee that the second curtain goes mechanically just after the timer fires the sync, but in practice it seems to work.
It is likely that when the shutter throws an error, the service recommendation is "replace the shutter unit." So the testing may be limited to "does it work within spec?" If not, they put in a new one, they don't adjust some gears.
It occurred to me that if you want to estimate the shutter timing at fast speeds, you could take advantage of the focal plane shutter slit vs electronic flash timing. Normally of course that's a disadvantage, but if you have a flash unit that can be set to a repeatable short time (like with a 1/128 power setting), you can take pictures at various different shutter speeds faster than the sync speed, and see how much of the frame is exposed. You wouldn't get an absolute measure of time unless you measure the duration of the flash pulse (perhaps with a fast photodiode and an oscilloscope). However, this would be a way to compare two different cameras' shutter speeds, if that is your concern.