When did Mexico give up Texas and California?

At the end of the Mexican-American War (1846-1848).