diff options
Diffstat (limited to 'chrome/test/startup')
-rw-r--r-- | chrome/test/startup/feature_startup_test.cc | 49 | ||||
-rw-r--r-- | chrome/test/startup/startup_test.cc | 25 |
2 files changed, 23 insertions, 51 deletions
diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc index 08b44e1..ce37879 100644 --- a/chrome/test/startup/feature_startup_test.cc +++ b/chrome/test/startup/feature_startup_test.cc @@ -39,20 +39,18 @@ class NewTabUIStartupTest : public UITest { static const int kNumCycles = 5; - void PrintTimings(const char* label, TimeDelta timings[kNumCycles]) { - printf("\n%s = [", label); - for (int i = 0; i < kNumCycles; ++i) { - if (i > 0) - printf(","); - printf("%.2f", timings[i].InMillisecondsF()); - } - printf("]\n"); + void PrintTimings(const wchar_t* label, TimeDelta timings[kNumCycles], + bool important) { + std::wstring times; + for (int i = 0; i < kNumCycles; ++i) + StringAppendF(×, L"%.2f,", timings[i].InMillisecondsF()); + PrintResultList(L"new_tab", L"", label, times, L"ms", important); } // Run the test, by bringing up a browser and timing the new tab startup. // |want_warm| is true if we should output warm-disk timings, false if // we should report cold timings. - void RunStartupTest(bool want_warm) { + void RunStartupTest(const wchar_t* label, bool want_warm, bool important) { // Install the location of the test profile file. set_template_user_data(ComputeTypicalUserDataSource()); @@ -94,41 +92,18 @@ class NewTabUIStartupTest : public UITest { UITest::TearDown(); } - // The buildbot log-scraper looks for this "__.._pages" line to tell when - // the test has completed and how many pages it loaded. - printf("\n__ts_pages = [about:blank]\n"); - PrintTimings("__ts_timings", timings); + PrintTimings(label, timings, important); } }; -// The name of this test is important, since the buildbot runs with a gTest -// filter. -typedef NewTabUIStartupTest NewTabUIStartupTestReference; - } // namespace +// TODO(pamg): run these tests with a reference build? + TEST_F(NewTabUIStartupTest, PerfCold) { - RunStartupTest(false); + RunStartupTest(L"tab_cold", false /* not cold */, true /* important */); } TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) { - RunStartupTest(true); -} - -TEST_F(NewTabUIStartupTestReference, FakePerfForLogScraperCold) { - // Print an empty reference-test result line so the log-scraper is happy. - // TODO(pamg): really run the test with a reference build? - TimeDelta timings[kNumCycles]; - for (int i = 0; i < kNumCycles; ++i) - timings[i] = TimeDelta::FromMilliseconds(0); - PrintTimings("__ts_reference_timings", timings); -} - -TEST_F(NewTabUIStartupTestReference, FakePerfForLogScraperWarm) { - // Print an empty reference-test result line so the log-scraper is happy. - // TODO(pamg): really run the test with a reference build? - TimeDelta timings[kNumCycles]; - for (int i = 0; i < kNumCycles; ++i) - timings[i] = TimeDelta::FromMilliseconds(0); - PrintTimings("__ts_reference_timings", timings); + RunStartupTest(L"tab_warm", true /* cold */, false /* not important */); } diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc index d6b8c3b..10d0bff 100644 --- a/chrome/test/startup/startup_test.cc +++ b/chrome/test/startup/startup_test.cc @@ -4,6 +4,7 @@ #include "base/file_util.h" #include "base/path_service.h" +#include "base/string_util.h" #include "base/time.h" #include "chrome/common/chrome_paths.h" #include "chrome/test/ui/ui_test.h" @@ -32,7 +33,7 @@ class StartupTest : public UITest { void SetUp() {} void TearDown() {} - void RunStartupTest(const char* label, bool test_cold) { + void RunStartupTest(const wchar_t* label, bool test_cold, bool important) { const int kNumCycles = 20; // Make a backup of gears.dll so we can overwrite the original, which @@ -73,14 +74,10 @@ class StartupTest : public UITest { ASSERT_TRUE(file_util::Delete(chrome_dll_copy, false)); ASSERT_TRUE(file_util::Delete(gears_dll_copy, false)); - printf("\n__ts_pages = [%s]\n", pages_.c_str()); - printf("\n%s = [", label); - for (int i = 0; i < kNumCycles; ++i) { - if (i > 0) - printf(","); - printf("%.2f", timings[i].InMillisecondsF()); - } - printf("]\n"); + std::wstring times; + for (int i = 0; i < kNumCycles; ++i) + StringAppendF(×, L"%.2f,", timings[i].InMillisecondsF()); + PrintResultList(L"startup", L"", label, times, L"ms", important); } protected: @@ -117,24 +114,24 @@ class StartupFileTest : public StartupTest { } // namespace TEST_F(StartupTest, Perf) { - RunStartupTest("__ts_timings", false); + RunStartupTest(L"warm", false /* not cold */, true /* important */); } TEST_F(StartupReferenceTest, Perf) { - RunStartupTest("__ts_reference_timings", false); + RunStartupTest(L"warm_ref", false /* not cold */, true /* important */); } // TODO(mpcomplete): Should we have reference timings for all these? TEST_F(StartupTest, PerfCold) { - RunStartupTest("__ts_cold_timings", true); + RunStartupTest(L"cold", true /* cold */, false /* not important */); } TEST_F(StartupFileTest, PerfGears) { - RunStartupTest("__ts_gears_timings", false); + RunStartupTest(L"gears", false /* not cold */, false /* not important */); } TEST_F(StartupFileTest, PerfColdGears) { - RunStartupTest("__ts_cold_gears_timings", true); + RunStartupTest(L"gears_cold", true /* cold */, false /* not important */); } |