Backported some tests from angular1.2 branch.