Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: chrome/test/perf/feature_startup_test.cc

Issue 14273023: Rebuild test history databases when starting up performance_ui_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Speed up profile generation Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/perftimer.h" 7 #include "base/perftimer.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 24 matching lines...) Expand all
35 35
36 void PrintTimings(const char* label, TimeDelta timings[kNumCycles], 36 void PrintTimings(const char* label, TimeDelta timings[kNumCycles],
37 bool important) { 37 bool important) {
38 std::string times; 38 std::string times;
39 for (int i = 0; i < kNumCycles; ++i) 39 for (int i = 0; i < kNumCycles; ++i)
40 base::StringAppendF(&times, "%.2f,", timings[i].InMillisecondsF()); 40 base::StringAppendF(&times, "%.2f,", timings[i].InMillisecondsF());
41 perf_test::PrintResultList( 41 perf_test::PrintResultList(
42 "new_tab", std::string(), label, times, "ms", important); 42 "new_tab", std::string(), label, times, "ms", important);
43 } 43 }
44 44
45 void InitProfile(UITestBase::ProfileType profile_type) { 45 void InitProfile(perf_test::ProfileType profile_type) {
46 profile_type_ = profile_type; 46 profile_type_ = profile_type;
47 47
48 // Install the location of the test profile file. 48 // Install the location of the test profile file.
49 set_template_user_data(UITest::ComputeTypicalUserDataSource( 49 set_template_user_data(GetPathForProfileType(profile_type));
50 profile_type));
51 } 50 }
52 51
53 // Run the test, by bringing up a browser and timing the new tab startup. 52 // Run the test, by bringing up a browser and timing the new tab startup.
54 // |want_warm| is true if we should output warm-disk timings, false if 53 // |want_warm| is true if we should output warm-disk timings, false if
55 // we should report cold timings. 54 // we should report cold timings.
56 void RunStartupTest(const char* label, bool want_warm, bool important, 55 void RunStartupTest(const char* label, bool want_warm, bool important,
57 UITestBase::ProfileType profile_type) { 56 perf_test::ProfileType profile_type) {
58 InitProfile(profile_type); 57 InitProfile(profile_type);
59 58
60 TimeDelta timings[kNumCycles]; 59 TimeDelta timings[kNumCycles];
61 for (int i = 0; i < kNumCycles; ++i) { 60 for (int i = 0; i < kNumCycles; ++i) {
62 UITest::SetUp(); 61 UITest::SetUp();
63 62
64 // Switch to the "new tab" tab, which should be any new tab after the 63 // Switch to the "new tab" tab, which should be any new tab after the
65 // first (the first is about:blank). 64 // first (the first is about:blank).
66 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); 65 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
67 ASSERT_TRUE(window.get()); 66 ASSERT_TRUE(window.get());
(...skipping 27 matching lines...) Expand all
95 timings[i] = TimeDelta::FromMilliseconds(load_time); 94 timings[i] = TimeDelta::FromMilliseconds(load_time);
96 95
97 window = NULL; 96 window = NULL;
98 UITest::TearDown(); 97 UITest::TearDown();
99 } 98 }
100 99
101 PrintTimings(label, timings, important); 100 PrintTimings(label, timings, important);
102 } 101 }
103 102
104 void RunNewTabTimingTest() { 103 void RunNewTabTimingTest() {
105 InitProfile(UITestBase::DEFAULT_THEME); 104 InitProfile(perf_test::DEFAULT_THEME);
106 105
107 TimeDelta scriptstart_times[kNumCycles]; 106 TimeDelta scriptstart_times[kNumCycles];
108 TimeDelta domcontentloaded_times[kNumCycles]; 107 TimeDelta domcontentloaded_times[kNumCycles];
109 TimeDelta onload_times[kNumCycles]; 108 TimeDelta onload_times[kNumCycles];
110 109
111 for (int i = 0; i < kNumCycles; ++i) { 110 for (int i = 0; i < kNumCycles; ++i) {
112 UITest::SetUp(); 111 UITest::SetUp();
113 112
114 // Switch to the "new tab" tab, which should be any new tab after the 113 // Switch to the "new tab" tab, which should be any new tab after the
115 // first (the first is about:blank). 114 // first (the first is about:blank).
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 149
151 window = NULL; 150 window = NULL;
152 UITest::TearDown(); 151 UITest::TearDown();
153 } 152 }
154 153
155 PrintTimings("script_start", scriptstart_times, false /* important */); 154 PrintTimings("script_start", scriptstart_times, false /* important */);
156 PrintTimings("domcontent_loaded", domcontentloaded_times, 155 PrintTimings("domcontent_loaded", domcontentloaded_times,
157 false /* important */); 156 false /* important */);
158 PrintTimings("onload", onload_times, false /* important */); 157 PrintTimings("onload", onload_times, false /* important */);
159 } 158 }
159
160 private:
161 // Are we using a profile with a complex theme?
162 perf_test::ProfileType profile_type_;
160 }; 163 };
161 164
162 // FLAKY: http://crbug.com/69940 165 // FLAKY: http://crbug.com/69940
163 TEST_F(NewTabUIStartupTest, DISABLED_PerfRefCold) { 166 TEST_F(NewTabUIStartupTest, DISABLED_PerfRefCold) {
164 UseReferenceBuild(); 167 UseReferenceBuild();
165 RunStartupTest("tab_cold_ref", false /* cold */, true /* important */, 168 RunStartupTest("tab_cold_ref", false /* cold */, true /* important */,
166 UITestBase::DEFAULT_THEME); 169 perf_test::DEFAULT_THEME);
167 } 170 }
168 171
169 // FLAKY: http://crbug.com/69940 172 // FLAKY: http://crbug.com/69940
170 TEST_F(NewTabUIStartupTest, DISABLED_PerfCold) { 173 TEST_F(NewTabUIStartupTest, DISABLED_PerfCold) {
171 RunStartupTest("tab_cold", false /* cold */, true /* important */, 174 RunStartupTest("tab_cold", false /* cold */, true /* important */,
172 UITestBase::DEFAULT_THEME); 175 perf_test::DEFAULT_THEME);
173 } 176 }
174 177
175 // FLAKY: http://crbug.com/69940 178 // FLAKY: http://crbug.com/69940
176 TEST_F(NewTabUIStartupTest, DISABLED_PerfRefWarm) { 179 TEST_F(NewTabUIStartupTest, DISABLED_PerfRefWarm) {
177 UseReferenceBuild(); 180 UseReferenceBuild();
178 RunStartupTest("tab_warm_ref", true /* warm */, true /* not important */, 181 RunStartupTest("tab_warm_ref", true /* warm */, true /* not important */,
179 UITestBase::DEFAULT_THEME); 182 perf_test::DEFAULT_THEME);
180 } 183 }
181 184
182 // FLAKY: http://crbug.com/69940 185 // FLAKY: http://crbug.com/69940
183 TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) { 186 TEST_F(NewTabUIStartupTest, DISABLED_PerfWarm) {
184 RunStartupTest("tab_warm", true /* warm */, true /* not important */, 187 RunStartupTest("tab_warm", true /* warm */, true /* not important */,
185 UITestBase::DEFAULT_THEME); 188 perf_test::DEFAULT_THEME);
186 } 189 }
187 190
188 // FLAKY: http://crbug.com/69940 191 // FLAKY: http://crbug.com/69940
189 TEST_F(NewTabUIStartupTest, DISABLED_ComplexThemeCold) { 192 TEST_F(NewTabUIStartupTest, DISABLED_ComplexThemeCold) {
190 RunStartupTest("tab_complex_theme_cold", false /* cold */, 193 RunStartupTest("tab_complex_theme_cold", false /* cold */,
191 false /* not important */, 194 false /* not important */,
192 UITestBase::COMPLEX_THEME); 195 perf_test::COMPLEX_THEME);
193 } 196 }
194 197
195 // FLAKY: http://crbug.com/69940 198 // FLAKY: http://crbug.com/69940
196 TEST_F(NewTabUIStartupTest, DISABLED_NewTabTimingTestsCold) { 199 TEST_F(NewTabUIStartupTest, DISABLED_NewTabTimingTestsCold) {
197 RunNewTabTimingTest(); 200 RunNewTabTimingTest();
198 } 201 }
199 202
200 } // namespace 203 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698