For completeness i'm going to give the proof of the swap test:
The initial state is given as, where I will use a slight abuse of notation on the R.H.S ($|0\rangle|a\rangle|b\rangle \equiv |0\rangle \otimes|a\rangle \otimes|b\rangle$, where $|a\rangle$ and $|b\rangle$ are states NOT bases).
$|\phi_1 \rangle = a_0b_0|000\rangle + a_1b_0|010\rangle + a_0b_1|001\rangle + a_1b_1|011\rangle = |0\rangle|a\rangle|b\rangle$
applying $H$
$H|0\rangle|a\rangle|b\rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|a\rangle|b\rangle $,
Now, if we were to take the measurement of either $|0\rangle$ or $|1\rangle$ now the inner products of the measurements would give:
$P(0) = (\frac{1}{\sqrt{2}}\langle b|\langle a| \langle 0|)(\frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle) = \frac{1}{2}$
Which isn't very useful, so by applying the swap:
$|\phi_3\rangle = \frac{1}{\sqrt{2}}|0\rangle|a\rangle|b\rangle + \frac{1}{\sqrt{2}}|1\rangle|b\rangle|a\rangle$
we will see that this changes the inner product of the measurements.
Applying the second $H$
$H|\phi_3\rangle = \frac{1}{2}|0\rangle|a\rangle|b\rangle + \frac{1}{2}|1\rangle|a\rangle|b\rangle + \frac{1}{2}|0\rangle|b\rangle|a\rangle - \frac{1}{2}|1\rangle|b\rangle|a\rangle = \frac{1}{2}|0\rangle \left[|a\rangle|b\rangle + |b\rangle|a\rangle\right] + \frac{1}{2}|1\rangle \left[|a\rangle|b\rangle - |b\rangle|a\rangle \right]$.
So first by inspection we can see with at least probability $\frac{1}{2}$ that we will measure the first qubit in $|0\rangle$.
Now we take the inner product for the $|0\rangle$ measurement:
$P(0) = \frac{1}{4}(\langle a|\langle b| + \langle b|\langle a|)\langle 0 |0\rangle(|a\rangle|b\rangle + |b\rangle|a\rangle) = \frac{1}{4}(\langle a| \langle b| a \rangle |b\rangle + \langle a| \langle b| b \rangle |a\rangle + \langle b| \langle a| a \rangle |b\rangle + \langle b| \langle a| b \rangle |a\rangle) = \frac{1}{2} + \frac{1}{2}\langle b| \langle a| b \rangle |a\rangle = \frac{1}{2} + \frac{1}{2}|\langle a|b\rangle|^2 $
(remembering the abuse of notation s.t. $\langle a | b \rangle \neq 0$ because it is the inner product of the states $|a\rangle = a_0|0\rangle + a_1|1\rangle$ and not the bases of type $|a\rangle$ and $|b\rangle$. However by completion we know that $\langle a | a \rangle = 1$)
Finally how can $\langle b| \langle a| b \rangle |a\rangle)$ be the fidelity? We will use some rearranging and remeber that the inner product is a scalar, however we need to be careful because it is a complex scalar! So we can write
$\langle b| \langle a| b \rangle |a\rangle = \langle a| b \rangle\langle b| a \rangle$,
by shuffling the scalar terms, and we can also see that
$\langle b| \langle a| b \rangle |a\rangle = \langle a| b \rangle\langle b| a \rangle = \langle a| \langle b| a \rangle |b\rangle$
However $ \langle a| b \rangle \neq \langle b| a \rangle$ so we can't just square the inner product term. But we can use the relation via the complex conjugate:
$\langle b| a \rangle = \langle a| b \rangle^\dagger$.
Hence we can write this as the modulus squared
$\langle a| b \rangle\langle b| a \rangle = \langle a| b \rangle\langle a| b \rangle^\dagger = |\langle a| b \rangle|^2$