  The accelerating expansion of the Universe poses a major challenge to our
understanding of fundamental physics. One promising avenue is to modify general
relativity and obtain a new description of the gravitational force. Because
gravitation dominates the other forces mostly on large scales, cosmological
probes provide an ideal testing ground for theories of gravity. In this thesis,
we describe two complementary approaches to the problem of testing gravity
using cosmology.
  In the first part, we discuss the cosmological solutions of massive gravity
and its generalisation to a bimetric theory. These theories describe a graviton
with a small mass, and can potentially explain the late-time acceleration in a
technically-natural way. We describe these self-accelerating solutions and
investigate the cosmological perturbations in depth, beginning with an
investigation of their linear stability, followed by the construction of a
method for solving these perturbations in the quasistatic limit. This allows
the predictions of stable bimetric models to be compared to observations of
structure formation. Next, we discuss prospects for theories in which matter
"doubly couples" to both metrics, and examine the cosmological expansion
history in both massive gravity and bigravity with a specific double coupling
which is ghost-free at low energies.
  In the second and final part, we study the consequences of Lorentz violation
during inflation. We consider Einstein-aether theory, in which a vector field
spontaneously breaks Lorentz symmetry and couples nonminimally to the metric,
and allow the vector to couple in a general way to a scalar field. Specialising
to inflation, we discuss the slow-roll solutions in background and at the
perturbative level. The system exhibits a severe instability which places
constraints on such a vector-scalar coupling to be at least five orders of
magnitude stronger [...]
