The device you see pictured here -- from the cover of Justin Timberlake's 2013 album "The 20/20 Experience" -- is called a phoropter.
Used primarily to help determine a patient's glasses/contact lens prescription, it has been around for over 100 years. It contains dozens of different lenses which can correct for hyperopia, myopia, or astigmatism. With you seated comfortably, with both eyes open, and your forehead up against the back of the phoropter, the eye doctor will show you an eye chart and check each eye individually with different combinations of lenses. He or she will ask you which is sharper: #1, #2, or if they are the same. The goal is to find two options that appear the same to you in terms of clarity/sharpness. Based on the results, a prescription for eyeglasses or contact lenses can be issued.