summaryrefslogtreecommitdiffstats
path: root/chrome/test/startup
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-15 20:03:28 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-15 20:03:28 +0000
commit49a541a5084e29d59bfdc1b2cbabcc96cbae6bc4 (patch)
tree57babb160479259a0b6d2c69fee4e6369774b71c /chrome/test/startup
parent3b02f10c369b3749ecee7e8ba5f5ffcfd6f74a50 (diff)
downloadchromium_src-49a541a5084e29d59bfdc1b2cbabcc96cbae6bc4.zip
chromium_src-49a541a5084e29d59bfdc1b2cbabcc96cbae6bc4.tar.gz
chromium_src-49a541a5084e29d59bfdc1b2cbabcc96cbae6bc4.tar.bz2
Don't let users set the number of cycles to be more than kNumCyclesMax in startup_tests.
BUG=none TEST=Setting STARTUP_TESTS_NUMCYCLES to 200 doesn't crash the test. Review URL: http://codereview.chromium.org/1652010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44689 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/startup')
-rw-r--r--chrome/test/startup/shutdown_test.cc12
-rw-r--r--chrome/test/startup/startup_test.cc12
2 files changed, 20 insertions, 4 deletions
diff --git a/chrome/test/startup/shutdown_test.cc b/chrome/test/startup/shutdown_test.cc
index 902db3b..bd739fb 100644
--- a/chrome/test/startup/shutdown_test.cc
+++ b/chrome/test/startup/shutdown_test.cc
@@ -58,8 +58,16 @@ class ShutdownTest : public UITest {
std::string numCyclesEnv;
if (env->GetEnv(env_vars::kStartupTestsNumCycles, &numCyclesEnv) &&
StringToInt(numCyclesEnv, &numCycles)) {
- LOG(INFO) << env_vars::kStartupTestsNumCycles << " set in environment, "
- << "so setting numCycles to " << numCycles;
+ if (numCycles <= kNumCyclesMax) {
+ LOG(INFO) << env_vars::kStartupTestsNumCycles
+ << " set in environment, so setting numCycles to "
+ << numCycles;
+ } else {
+ LOG(INFO) << env_vars::kStartupTestsNumCycles
+ << " is higher than the max, setting numCycles to "
+ << kNumCyclesMax;
+ numCycles = kNumCyclesMax;
+ }
}
TimeDelta timings[kNumCyclesMax];
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index ff9ec7e..e1aa8c9 100644
--- a/chrome/test/startup/startup_test.cc
+++ b/chrome/test/startup/startup_test.cc
@@ -70,8 +70,16 @@ class StartupTest : public UITest {
std::string numCyclesEnv;
if (env->GetEnv(env_vars::kStartupTestsNumCycles, &numCyclesEnv) &&
StringToInt(numCyclesEnv, &numCycles)) {
- LOG(INFO) << env_vars::kStartupTestsNumCycles << " set in environment, "
- << "so setting numCycles to " << numCycles;
+ if (numCycles <= kNumCyclesMax) {
+ LOG(INFO) << env_vars::kStartupTestsNumCycles
+ << " set in environment, so setting numCycles to "
+ << numCycles;
+ } else {
+ LOG(INFO) << env_vars::kStartupTestsNumCycles
+ << " is higher than the max, setting numCycles to "
+ << kNumCyclesMax;
+ numCycles = kNumCyclesMax;
+ }
}
TimeDelta timings[kNumCyclesMax];