Three different methods of measuring cosmology with gamma-ray bursts ( GRBs ) have been proposed since a relation between the \gamma -ray energy E _ { \gamma } of a GRB jet and the peak energy E _ { p } of the \nu F _ { \nu } spectrum in the burst frame was reported by Ghirlanda and coauthors . In Method I , to calculate the probability for a favored cosmology , only the contribution of the E _ { \gamma } - E _ { p } relation that is already best fitted for this cosmology is considered . We apply this method to a sample of 17 GRBs , and obtain the mass density \Omega _ { M } = 0.15 ^ { +0.45 } _ { -0.13 } ( 1 \sigma ) for a flat \Lambda CDM universe . In Method II , to calculate the probability for some certain cosmology , contributions of all the possible E _ { \gamma } - E _ { p } relations that are best fitted for their corresponding cosmologies are taken into account . With this method , we find a constraint on the mass density 0.14 < \Omega _ { M } < 0.69 ( 1 \sigma ) for a flat universe . In Method III , to obtain the probability for some cosmology , contributions of all the possible E _ { \gamma } - E _ { p } relations associated with their unequal weights are considered . With this method , we obtain an inspiring constraint on the mass density 0.16 < \Omega _ { M } < 0.45 ( 1 \sigma ) for a flat universe , and a \chi ^ { 2 } _ { dof } = 19.08 / 15 = 1.27 for the concordance model of \Omega _ { M } = 0.27 . Compared with the previous two methods , Method III makes the observed 17 GRBs place much more stringent confidence intervals at the same confidence levels . Furthermore , we perform a Monte Carlo simulation and use a larger sample to investigate the cosmographic capabilities of GRBs with different methods . We find that , a larger GRB sample could be used to effectively measure cosmology , no matter whether the E _ { \gamma } - E _ { p } relation is calibrated by low- z bursts or not . Ongoing observations on GRBs in the Swift era are expected to make the cosmological utility of GRBs progress from its babyhood into childhood .