from a very condensed point of view:

normally, the PCM allows the engine vacuum that would normally draw fumes from the CCP and allow the tank to vent as necessary. it also controls a solenoid that prevents the tank from venting vacuum. so the solenoid is switched when the engine is creating vacuum, causing a vacuum to exist in the tank. the tank pressure/vacuum sensor is read to determine if there is enough vacuum to consider it a pass. this tests a couple of things at once, mostly CCP and fuel tank integrity.

i might be able to grab a better explanation, but that's essentially how it all works.