Dictionary.com
Thesaurus.com

had been masturbating

  • past perfect progressive
    of masturbate.
    masturbate
    verb (used without object)
    to engage in masturbation.