Goodness of Fit Using $CDF$ I don't have a tremendous amount of experience with testing goodness of fit, and I've just begun studying it rigorously.  A though occurred to me, and since it occurred to me, I'm sure it exists, and is probably called "naive (something)."
If I have a continuous distribution on $\mathbb{R}$ with $CDF$, $g$, and a set of values $X = \{x_1,\dots,x_n\}$ drawn $i.i.d$ from this distribution, isn't the set $Y = \{g(x_1), \dots, g(x_n)\}$ of interest?  Aren't these $i.i.d$ draws from the uniform distribution on $[0,1]$?  Doesn't this reduce the problem of goodness of fit in this case, to understanding goodness of fit of the uniform distribution?
I know not all distributions on $\mathbb{R}$ have closed form $CDF$s, and in order to extend this to discrete distributions one would have to add sampling from the mass associated with $x_i$ in each case, but this still seems pretty reasonable to me.
My questions are: does a theory along these lines exists (if so, what's it called?)?  What are the limitations of this idea?  Any references, or packages?
Thank you very much in advance!
 A: Goodness of fit is of concern when $g$ is estimated from the data, and herein lies the rub: in the formula for $Y$, you have to understand that "$g$" itself is random (and conditional on all the $x_i$).
You will have used some kind of procedure (which for simplicity let's assume is non-randomized)
$$t_n:\mathbb{R}^n\to \Omega$$
(where $\Omega$ is some prespecified set of possible distributions on $\mathbb{R}$) to create the estimate
$$\hat G = t_n(x_1,x_2,\ldots, x_n).$$
When $\hat G$ is continuous let its density be $\hat g$, with $\hat g(x) = \frac{d}{dx}\hat G(x)$, allowing us to write
$$Y = (\ldots, \frac{d}{dx} t_n(X_1,X_2,\ldots,X_n)(x) |_{x=X_i},\ldots)$$
for iid random variables $X_i$.  $Y_i$ will almost never have a uniform distribution.  (See below for an example.)
The idea is a good one, though.  The right way to capitalize on it is via the likelihood, which also is a function of the $\hat g(x_i)$.  You compare the fit to one obtained with a model that could capture lack of fit and use a deviance statistic.  The art lies in identifying the likely forms in which reality could differ from the original model and including them in a superset of distributions $\Omega^\prime \supset \Omega$.

I have not offered a mathematical proof of the key assertion that the components of $Y$ are rarely uniform, for two reasons.  First, the detailed notation should at least suggest the situation is more complicated than indicated by the original notation (in the question) that assumes $g$ is known.  Second, it suffices only to provide a counterexample.  One that nobody could impugn as "pathological" is the standard estimator of a Normal distribution, 
$$(\hat \mu, \hat \sigma^2) = \left(\frac{1}{n}\sum_{i=1}^n x_i, \frac{1}{n-1}\sum_{i=1}^n (x_i - \hat\mu)^2\right).$$
The results of a quick, easy simulation (in R) are decidedly non-uniform in the tails.

The left hand side is a histogram of all $3\times 1000$ values of $g(x_i)$ for $1000$ independent simulations of size $n=3$.  The right hand side is its uniform Q-Q plot.  A uniform histogram would have bars of approximately equal height.  A uniform Q-Q plot would lie extremely close to a diagonal line.  The visually evident deviations in these plots reveal the non-uniformity.
set.seed(17)                        # Allows these results to be reproduced exactly
n <- 3                              # Sample size
n.sim <- 1e3                        # Number of simulation trials
x <- matrix(rnorm(n*n.sim), nrow=n) # Data are in columns
m <- colMeans(x)
s <- apply(x, 2, sd)
y <- mapply(pnorm, x, m, s)         # Columns are the g(x_i)
par(mfrow=c(1,2))
hist(y)
plot(sort(y), type="l", main="Uniform QQ Plot of y")

A: There are a whole collection of such tests, collectively called ECDF-tests* - intended for fully specified distributions, that have this property.
*(short for 'empirical CDF', since they compare the sample cdf to the fully specified one in some way)
The property you mention makes those tests distribution-free -- the distribution of the test statistic will be the same no matter the form of the original fully specified cdf.
These tests include the Kolmogorov-Smirnov test, the Cramér-von Mises and the Anderson-Darling test (among others).
https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test
https://en.wikipedia.org/wiki/Cram%C3%A9r%E2%80%93von_Mises_criterion#Cram.C3.A9r.E2.80.93von_Mises_test_.28one_sample.29
https://en.wikipedia.org/wiki/Anderson%E2%80%93Darling_test
A good starting place might be D'Agostino, R.B. & Stephens, M.A. Goodness of fit techniques
