The claim is true. According to Congressional Quarterly's Voting Studies, in 2007 McCain voted in line with the president's position 95 percent of the time – the highest percentage rate for McCain since Bush took office – and voted in line with his party 90 percent of the time. However, McCain's support of President Bush's position has been as low as 77 percent (in 2005), and his support for his party's position has been as low as 67 percent (2001).
Please note that it is true for 2007. Still, even at its lowest ebb, Senator McCain voted in line with President Bush's position 77 percent of the time.
Additionally, also according to FactCheck, "By comparison, Obama's own record of supporting Bush policies has averaged slightly under 41 percent since the senator took office. However, Obama's voting record is no less partisan than McCain's. He has voted in line with his party an average of nearly 97 percent of the time. The truth is that neither candidate can claim a strong record of 'breaking with his party' if Senate votes are the measure."