I don't ask if it's ok to work the action or safety, I simply figure that permission to do so is implied. However, I don't dry fire without the express permission of the clerk. What I generally do is ask if they have any snap caps. More often than not, they'll tell me to just dry fire it, but it never hurts to ask. I've been in a few places that won't let you dry fire at all, nor do they provide snap caps. Personally, I don't like buying a weapon without getting a feel for the trigger though.
At the Kittery Trading Post, in Kittery, Maine, it's store policy that before you can walk out with a gun, the salesperson has to show you how to work the action and safety, load and unload, and disassemble and reassemble it. That makes sense to me. This way, they know you have a basic familiarity with the weapon and are (hopefully) less likely to negligently hurt yourself or someone else.
Frank