That's generally my way of doing things as well. An extension of the Golden Rule, I suppose. If I owned a restaurant I wouldn't want people loitering about taking up space that could be used by the paying customers who support my business.
I did, however, one time use a McDonald's restroom without ordering anything. I was on the highway and my bladder was about to rupture. I pulled over at an exit and went in to the McDonald's and used the restroom. Upon emerging I thought to buy a soda or something; anything to justify my having used their facilities. But the queues were going nearly out the door, and I would have waited there forever to purchase something.