Brooks, 43, a former editor of two Murdoch tabloids - the Sun and the now-defunct News of The World - has twice been arrested and questioned by police about illegal eavesdropping and obstruction of justice. She has not been charged with any offense, but is currently on bail pending further investigations, so the inquiry lawyer did not question her directly about phone hacking allegations.
Brooks said Cameron was a friend and a neighbor in the picturesque Cotswolds area of southern England.
After she quit, Brooks said, she received "indirect messages" of support - text messages sent by the aides of politicians, but relaying their thoughts - including from Cameron.
"I received some indirect messages from No. 10, No. 11, the Home Office and Foreign Office," Brooks said, referring to Cameron, Treasury chief George Osborne, and other leading cabinet members.
She agreed with inquiry lawyer Robert Jay that a message from Cameron had told her to "keep your head up" and expressed regret that he could not offer more support publicly, because of the political pressure he was under over the hacking scandal.
Brooks said she and Cameron would trade texts at least once a week, or twice a week during busier periods such as Britain's 2010 national election.
"He would sign them off 'DC,"' said Brooks, who showed composure and flashes of humor as she testified. "Occasionally he would sign them off LOL, 'lots of love,' until I told him it meant 'laugh out loud.' "
Brooks confirmed that she had discussed tabloid phone hacking with Cameron, including after toxic revelations that the News of the World had hacked murdered schoolgirl Milly Dowler's phone when she disappeared in 2002. The girl was later found dead.
Public revulsion over the hacking of Dowler's phone led Murdoch to shut down the 168-year-old News of the World in July, and saw Cameron set up the ethics inquiry.