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

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

Issue 14566005: Delete page cycler performance_ui_test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/basictypes.h"
6 #include "base/command_line.h"
7 #include "base/file_util.h"
8 #include "base/files/file_path.h"
9 #include "base/path_service.h"
10 #include "base/process_util.h"
11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_piece.h"
13 #include "base/strings/sys_string_conversions.h"
14 #include "base/test/test_timeouts.h"
15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/net/url_fixer_upper.h"
17 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_paths.h"
19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/test/automation/tab_proxy.h"
21 #include "chrome/test/automation/window_proxy.h"
22 #include "chrome/test/base/chrome_process_util.h"
23 #include "chrome/test/base/test_switches.h"
24 #include "chrome/test/perf/perf_test.h"
25 #include "chrome/test/ui/ui_perf_test.h"
26 #include "googleurl/src/gurl.h"
27 #include "net/base/net_util.h"
28
29 #ifndef NDEBUG
30 static const int kTestIterations = 2;
31 static const int kDatabaseTestIterations = 2;
32 static const int kWebPageReplayIterations = 2;
33 #else
34 static const int kTestIterations = 10;
35 // For some unknown reason, the DB perf tests are much much slower on the
36 // Vista perf bot, so we have to cut down the number of iterations to 5
37 // to make sure each test finishes in less than 10 minutes.
38 static const int kDatabaseTestIterations = 5;
39 static const int kWebPageReplayIterations = 5;
40 #endif
41 static const int kIDBTestIterations = 5;
42
43 // URL at which data files may be found for HTTP tests. The document root of
44 // this URL's server should point to data/page_cycler/.
45 static const char kBaseUrl[] = "http://localhost:8000/";
46
47 // The following port numbers must match those in
48 // src/tools/python/google/webpagereplay_utils.py.
49 static const char kWebPageReplayHttpPort[] = "8080";
50 static const char kWebPageReplayHttpsPort[] = "8413";
51
52 namespace {
53
54 void PopulateBufferCache(const base::FilePath& test_dir) {
55 // This will recursively walk the directory given and read all the
56 // files it finds. This is done so the system file cache is likely
57 // to have as much loaded as possible. Without this, the tests of
58 // this build gets one set of timings and then the reference build
59 // test, gets slightly faster ones (even if the reference build is
60 // the same binary). The hope is by forcing all the possible data
61 // into the cache we equalize the tests for comparing timing data.
62
63 // We don't want to walk into .svn dirs, so we have to do the tree walk
64 // ourselves.
65
66 std::vector<base::FilePath> dirs;
67 dirs.push_back(test_dir);
68 const base::FilePath svn_dir(FILE_PATH_LITERAL(".svn"));
69
70 for (size_t idx = 0; idx < dirs.size(); ++idx) {
71 file_util::FileEnumerator dir_enumerator(dirs[idx], false,
72 file_util::FileEnumerator::DIRECTORIES);
73 base::FilePath path;
74 for (path = dir_enumerator.Next();
75 !path.empty();
76 path = dir_enumerator.Next()) {
77 if (path.BaseName() != svn_dir)
78 dirs.push_back(path);
79 }
80 }
81
82 unsigned int loaded = 0;
83
84 // We seem to have some files in the data dirs that are just there for
85 // reference, make a quick attempt to skip them by matching suffixes.
86 std::vector<base::FilePath::StringType> ignore_suffixes;
87 ignore_suffixes.push_back(FILE_PATH_LITERAL(".orig.html"));
88 ignore_suffixes.push_back(FILE_PATH_LITERAL(".html-original"));
89
90 std::vector<base::FilePath>::const_iterator iter;
91 for (iter = dirs.begin(); iter != dirs.end(); ++iter) {
92 file_util::FileEnumerator file_enumerator(*iter, false,
93 file_util::FileEnumerator::FILES);
94 base::FilePath path;
95 for (path = file_enumerator.Next();
96 !path.empty();
97 path = file_enumerator.Next()) {
98 const base::FilePath base_name = path.BaseName();
99 const size_t base_name_size = base_name.value().size();
100
101 bool should_skip = false;
102 std::vector<base::FilePath::StringType>::const_iterator ignore_iter;
103 for (ignore_iter = ignore_suffixes.begin();
104 ignore_iter != ignore_suffixes.end();
105 ++ignore_iter) {
106 const base::FilePath::StringType &suffix = *ignore_iter;
107
108 if ((base_name_size > suffix.size()) &&
109 (base_name.value().compare(base_name_size - suffix.size(),
110 suffix.size(), suffix) == 0)) {
111 should_skip = true;
112 break;
113 }
114 }
115 if (should_skip)
116 continue;
117
118 // Read the file fully to get it into the cache.
119 // We don't care what the contents are.
120 if (file_util::ReadFileToString(path, NULL))
121 ++loaded;
122 }
123 }
124 VLOG(1) << "Buffer cache should be primed with " << loaded << " files.";
125 }
126
127 class PageCyclerTest : public UIPerfTest {
128 public:
129 PageCyclerTest() : print_times_only_(false),
130 num_test_iterations_(kTestIterations) {
131 show_window_ = true;
132 dom_automation_enabled_ = true;
133
134 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
135 if (parsed_command_line.HasSwitch(switches::kPageCyclerIterations)) {
136 std::string str = parsed_command_line.GetSwitchValueASCII(
137 switches::kPageCyclerIterations);
138 base::StringToInt(str, &num_test_iterations_);
139 }
140 }
141
142 virtual void SetLaunchSwitches() OVERRIDE {
143 UIPerfTest::SetLaunchSwitches();
144
145 // Expose garbage collection for the page cycler tests.
146 launch_arguments_.AppendSwitchASCII(switches::kJavaScriptFlags,
147 "--expose_gc");
148 }
149
150 virtual base::FilePath GetDataPath(const char* name) {
151 // Make sure the test data is checked out
152 base::FilePath test_path;
153 PathService::Get(base::DIR_SOURCE_ROOT, &test_path);
154 test_path = test_path.Append(FILE_PATH_LITERAL("data"));
155 test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler"));
156 test_path = test_path.AppendASCII(name);
157 return test_path;
158 }
159
160 virtual bool HasErrors(const std::string /*timings*/) {
161 return false;
162 }
163
164 virtual int GetTestIterations() {
165 return num_test_iterations_;
166 }
167
168 virtual void GetTestUrl(const char* name, bool use_http, GURL *test_url) {
169 base::FilePath test_path = GetDataPath(name);
170 ASSERT_TRUE(file_util::DirectoryExists(test_path))
171 << "Missing test directory " << test_path.value();
172 PopulateBufferCache(test_path);
173
174 if (use_http) {
175 *test_url = GURL(std::string(kBaseUrl) + name + "/start.html");
176 } else {
177 test_path = test_path.Append(FILE_PATH_LITERAL("start.html"));
178 *test_url = net::FilePathToFileURL(test_path);
179 }
180
181 // run N iterations
182 GURL::Replacements replacements;
183 const std::string query_string =
184 "iterations=" + base::IntToString(GetTestIterations()) + "&auto=1";
185 replacements.SetQuery(
186 query_string.c_str(),
187 url_parse::Component(0, query_string.length()));
188 *test_url = test_url->ReplaceComponents(replacements);
189 }
190
191 // For HTTP tests, the name must be safe for use in a URL without escaping.
192 void RunPageCycler(const char* name, std::wstring* pages,
193 std::string* timings, bool use_http) {
194 GURL test_url;
195 GetTestUrl(name, use_http, &test_url);
196
197 scoped_refptr<TabProxy> tab(GetActiveTab());
198 ASSERT_TRUE(tab.get());
199 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(test_url));
200
201 // Wait for the test to finish.
202 ASSERT_TRUE(WaitUntilCookieValue(
203 tab.get(), test_url, "__pc_done",
204 TestTimeouts::large_test_timeout(), "1"));
205
206 std::string cookie;
207 ASSERT_TRUE(tab->GetCookieByName(test_url, "__pc_pages", &cookie));
208 pages->assign(UTF8ToWide(cookie));
209 ASSERT_FALSE(pages->empty());
210
211 // Wait for the report.html to be loaded.
212 ASSERT_TRUE(WaitUntilCookieValue(
213 tab.get(), test_url, "__navigated_to_report",
214 TestTimeouts::action_max_timeout(), "1"));
215
216 // Get the timing cookie value from the DOM automation.
217 std::wstring wcookie;
218 ASSERT_TRUE(tab->ExecuteAndExtractString(
219 std::wstring(),
220 L"window.domAutomationController.send("
221 L"JSON.stringify(__get_timings()));",
222 &wcookie));
223 cookie = base::SysWideToNativeMB(wcookie);
224
225 // JSON.stringify() encapsulates the returned string in quotes, strip them.
226 std::string::size_type start_idx = cookie.find("\"");
227 std::string::size_type end_idx = cookie.find_last_of("\"");
228 if (start_idx != std::string::npos &&
229 end_idx != std::string::npos &&
230 start_idx < end_idx) {
231 cookie = cookie.substr(start_idx+1, end_idx-start_idx-1);
232 }
233
234 timings->assign(cookie);
235 ASSERT_FALSE(timings->empty());
236 }
237
238 // When use_http is true, the test name passed here will be used directly in
239 // the path to the test data, so it must be safe for use in a URL without
240 // escaping. (No pound (#), question mark (?), semicolon (;), non-ASCII, or
241 // other funny stuff.)
242 void RunTestWithSuffix(const char* graph, const char* name, bool use_http,
243 const char* suffix) {
244 std::wstring pages;
245 std::string timings;
246 size_t start_size = base::GetSystemCommitCharge();
247 RunPageCycler(name, &pages, &timings, use_http);
248 if (timings.empty() || HasErrors(timings))
249 return;
250 size_t stop_size = base::GetSystemCommitCharge();
251
252 if (!print_times_only_) {
253 PrintMemoryUsageInfo(suffix);
254 PrintIOPerfInfo(suffix);
255 perf_test::PrintSystemCommitCharge(suffix, stop_size - start_size,
256 false /* not important */);
257 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistograms());
258 }
259
260 std::string trace_name = "t" + std::string(suffix);
261
262 printf("Pages: [%s]\n", base::SysWideToNativeMB(pages).c_str());
263
264 perf_test::PrintResultList(
265 graph, std::string(), trace_name, timings, "ms", true /* important */);
266 }
267
268 void RunTest(const char* graph, const char* name, bool use_http) {
269 RunTestWithSuffix(graph, name, use_http, "");
270 }
271
272 private:
273 void PrintMemoryHistogram(const std::string& name,
274 const std::string& units) {
275 scoped_refptr<TabProxy> tab(GetActiveTab());
276 ASSERT_TRUE(tab.get());
277 std::wstring whistogram;
278 ASSERT_TRUE(tab->ExecuteAndExtractString(
279 std::wstring(),
280 L"window.domAutomationController.send("
281 L"window.domAutomationController.getHistogram ? "
282 L"window.domAutomationController.getHistogram(\"" +
283 base::SysUTF8ToWide(name) + L"\") : '')",
284 &whistogram));
285 std::string histogram = base::SysWideToNativeMB(whistogram);
286 printf("HISTOGRAM %s: %s = %s %s\n",
287 name.c_str(), name.c_str(), histogram.c_str(), units.c_str());
288 }
289
290 void PrintMemoryHistograms() {
291 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistogram(
292 "V8.MemoryExternalFragmentationTotal", "percent"));
293 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistogram(
294 "V8.MemoryHeapSampleTotalCommitted", "kb"));
295 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistogram(
296 "V8.MemoryHeapSampleTotalUsed", "kb"));
297 }
298
299 protected:
300 bool print_times_only_;
301 int num_test_iterations_;
302 };
303
304 class PageCyclerReferenceTest : public PageCyclerTest {
305 public:
306 virtual void SetUp() {
307 UseReferenceBuild();
308 PageCyclerTest::SetUp();
309 }
310
311 void RunTest(const char* graph, const char* name, bool use_http) {
312 // Run the test.
313 PageCyclerTest::RunTestWithSuffix(graph, name, use_http, "_ref");
314 }
315 };
316
317 class PageCyclerExtensionTest : public PageCyclerTest {
318 public:
319 // Note: we delay the SetUp until RunTest is called so that we can set
320 // the user_data_dir based on the test name.
321 virtual void SetUp() {}
322 void RunTest(const char* graph, const char* extension_profile,
323 const char* output_suffix, const char* name, bool use_http) {
324 // Set up the extension profile directory.
325 ASSERT_TRUE(extension_profile != NULL);
326 base::FilePath data_dir;
327 PathService::Get(chrome::DIR_TEST_DATA, &data_dir);
328 data_dir = data_dir.AppendASCII("extensions").AppendASCII("profiles").
329 AppendASCII(extension_profile);
330 ASSERT_TRUE(file_util::DirectoryExists(data_dir));
331 set_template_user_data(data_dir);
332
333 // Now run the test.
334 PageCyclerTest::SetUp();
335 PageCyclerTest::RunTestWithSuffix(graph, name, use_http, output_suffix);
336 }
337 };
338
339 class PageCyclerExtensionWebRequestTest : public PageCyclerExtensionTest {
340 public:
341 PageCyclerExtensionWebRequestTest()
342 : PageCyclerExtensionTest()
343 {
344 // Enable experimental extension APIs for webrequest tests.
345 launch_arguments_.AppendSwitch(switches::kEnableExperimentalExtensionApis);
346 }
347 };
348
349 class PageCyclerAccessibilityTest : public PageCyclerTest {
350 public:
351 PageCyclerAccessibilityTest()
352 : PageCyclerTest()
353 {
354 // Enable accessibility support, to compare the performance overhead
355 // when accessibility is enabled to when it's off.
356 launch_arguments_.AppendSwitch(switches::kForceRendererAccessibility);
357 }
358 };
359
360 static base::FilePath GetDatabaseDataPath(const char* name) {
361 base::FilePath test_path;
362 PathService::Get(base::DIR_SOURCE_ROOT, &test_path);
363 test_path = test_path.Append(FILE_PATH_LITERAL("tools"));
364 test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler"));
365 test_path = test_path.Append(FILE_PATH_LITERAL("database"));
366 test_path = test_path.AppendASCII(name);
367 return test_path;
368 }
369
370 static base::FilePath GetIndexedDatabaseDataPath(const char* name) {
371 base::FilePath test_path;
372 PathService::Get(base::DIR_SOURCE_ROOT, &test_path);
373 test_path = test_path.Append(FILE_PATH_LITERAL("tools"));
374 test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler"));
375 test_path = test_path.Append(FILE_PATH_LITERAL("indexed_db"));
376 test_path = test_path.AppendASCII(name);
377 return test_path;
378 }
379
380 static bool HasDatabaseErrors(const std::string timings) {
381 size_t pos = 0;
382 size_t new_pos = 0;
383 std::string time_str;
384 int time = 0;
385 do {
386 new_pos = timings.find(',', pos);
387 if (new_pos == std::string::npos)
388 new_pos = timings.length();
389 if (!base::StringToInt(base::StringPiece(timings.begin() + pos,
390 timings.begin() + new_pos),
391 &time)) {
392 LOG(ERROR) << "Invalid time reported: " << time_str;
393 return true;
394 }
395 if (time < 0) {
396 switch (time) {
397 case -1:
398 LOG(ERROR) << "Error while opening the database.";
399 break;
400 case -2:
401 LOG(ERROR) << "Error while setting up the database.";
402 break;
403 case -3:
404 LOG(ERROR) << "Error while running the transactions.";
405 break;
406 default:
407 LOG(ERROR) << "Unknown error: " << time;
408 }
409 return true;
410 }
411
412 pos = new_pos + 1;
413 } while (pos < timings.length());
414
415 return false;
416 }
417
418 class PageCyclerDatabaseTest : public PageCyclerTest {
419 public:
420 PageCyclerDatabaseTest() {
421 print_times_only_ = true;
422 }
423
424 virtual base::FilePath GetDataPath(const char* name) OVERRIDE {
425 return GetDatabaseDataPath(name);
426 }
427
428 virtual bool HasErrors(const std::string timings) OVERRIDE {
429 return HasDatabaseErrors(timings);
430 }
431
432 virtual int GetTestIterations() OVERRIDE {
433 return kDatabaseTestIterations;
434 }
435 };
436
437 class PageCyclerDatabaseReferenceTest : public PageCyclerReferenceTest {
438 public:
439 PageCyclerDatabaseReferenceTest() {
440 print_times_only_ = true;
441 }
442
443 virtual base::FilePath GetDataPath(const char* name) OVERRIDE {
444 return GetDatabaseDataPath(name);
445 }
446
447 virtual bool HasErrors(const std::string timings) OVERRIDE {
448 return HasDatabaseErrors(timings);
449 }
450
451 virtual int GetTestIterations() OVERRIDE {
452 return kDatabaseTestIterations;
453 }
454 };
455
456 class PageCyclerIndexedDatabaseTest : public PageCyclerTest {
457 public:
458 PageCyclerIndexedDatabaseTest() {
459 print_times_only_ = true;
460 }
461
462 virtual base::FilePath GetDataPath(const char* name) OVERRIDE {
463 return GetIndexedDatabaseDataPath(name);
464 }
465
466 virtual bool HasErrors(const std::string timings) OVERRIDE {
467 return HasDatabaseErrors(timings);
468 }
469
470 virtual int GetTestIterations() OVERRIDE {
471 return kIDBTestIterations;
472 }
473 };
474
475 class PageCyclerIndexedDatabaseReferenceTest : public PageCyclerReferenceTest {
476 public:
477 PageCyclerIndexedDatabaseReferenceTest() {
478 print_times_only_ = true;
479 }
480
481 virtual base::FilePath GetDataPath(const char* name) OVERRIDE {
482 return GetIndexedDatabaseDataPath(name);
483 }
484
485 virtual bool HasErrors(const std::string timings) OVERRIDE {
486 return HasDatabaseErrors(timings);
487 }
488
489 virtual int GetTestIterations() OVERRIDE {
490 return kIDBTestIterations;
491 }
492 };
493
494 // Web Page Replay is a proxy server to record and serve pages
495 // with realistic network delays and bandwidth throttling.
496 // runtest.py launches replay.py to support these tests.
497 class PageCyclerWebPageReplayTest : public PageCyclerTest {
498 public:
499 PageCyclerWebPageReplayTest() {
500 // These Chrome command-line arguments need to be kept in sync
501 // with src/tools/python/google/webpagereplay_utils.py.
502 base::FilePath extension_path = GetPageCyclerWprPath("extension");
503 launch_arguments_.AppendSwitchPath(
504 switches::kLoadExtension, extension_path);
505 // TODO(slamm): Instead of kHostResolverRules, add a new switch,
506 // kTestingFixedDnsPort, and configure Web Page Replay to run
507 // a DNS proxy on that port to test Chrome's DNS code.
508 launch_arguments_.AppendSwitchASCII(
509 switches::kHostResolverRules, "MAP * 127.0.0.1");
510 launch_arguments_.AppendSwitchASCII(
511 switches::kTestingFixedHttpPort, kWebPageReplayHttpPort);
512 launch_arguments_.AppendSwitchASCII(
513 switches::kTestingFixedHttpsPort, kWebPageReplayHttpsPort);
514 launch_arguments_.AppendSwitch(switches::kEnableExperimentalExtensionApis);
515 launch_arguments_.AppendSwitch(switches::kEnableStatsTable);
516 launch_arguments_.AppendSwitch(switches::kEnableBenchmarking);
517 launch_arguments_.AppendSwitch(switches::kIgnoreCertificateErrors);
518 launch_arguments_.AppendSwitch(switches::kNoProxyServer);
519 }
520
521 base::FilePath GetPageCyclerWprPath(const char* name) {
522 base::FilePath wpr_path;
523 PathService::Get(base::DIR_SOURCE_ROOT, &wpr_path);
524 wpr_path = wpr_path.AppendASCII("tools");
525 wpr_path = wpr_path.AppendASCII("page_cycler");
526 wpr_path = wpr_path.AppendASCII("webpagereplay");
527 wpr_path = wpr_path.AppendASCII(name);
528 return wpr_path;
529 }
530
531 virtual int GetTestIterations() OVERRIDE {
532 return kWebPageReplayIterations;
533 }
534
535 virtual void GetTestUrl(const char* name, bool use_http,
536 GURL *test_url) OVERRIDE {
537 base::FilePath start_path = GetPageCyclerWprPath("start.html");
538
539 // Add query parameters for iterations and test name.
540 const std::string query_string =
541 "iterations=" + base::IntToString(GetTestIterations()) +
542 "&test=" + name +
543 "&auto=1";
544 GURL::Replacements replacements;
545 replacements.SetQuery(
546 query_string.c_str(),
547 url_parse::Component(0, query_string.length()));
548
549 *test_url = net::FilePathToFileURL(start_path);
550 *test_url = test_url->ReplaceComponents(replacements);
551 }
552
553 void RunTest(const char* graph, const char* name) {
554 base::FilePath test_path = GetPageCyclerWprPath("tests");
555 test_path = test_path.AppendASCII(name);
556 test_path = test_path.ReplaceExtension(FILE_PATH_LITERAL(".js"));
557 ASSERT_TRUE(file_util::PathExists(test_path))
558 << "Missing test file " << test_path.value();
559
560 const bool use_http = false; // always use a file
561 PageCyclerTest::RunTestWithSuffix(graph, name, use_http, "");
562 }
563 };
564
565 // This macro simplifies setting up regular and reference build tests.
566 #define PAGE_CYCLER_TESTS(test, name, use_http) \
567 TEST_F(PageCyclerTest, name) { \
568 RunTest("times", test, use_http); \
569 } \
570 TEST_F(PageCyclerReferenceTest, name) { \
571 RunTest("times", test, use_http); \
572 }
573
574 // This macro simplifies setting up regular and reference build tests
575 // for HTML5 database tests.
576 #define PAGE_CYCLER_DATABASE_TESTS(test, name) \
577 TEST_F(PageCyclerDatabaseTest, Database##name##File) { \
578 RunTest(test, test, false); \
579 } \
580 TEST_F(PageCyclerDatabaseReferenceTest, Database##name##File) { \
581 RunTest(test, test, false); \
582 }
583
584 // This macro simplifies setting up regular and reference build tests
585 // for HTML5 Indexed DB tests.
586 #define PAGE_CYCLER_IDB_TESTS(test, name) \
587 TEST_F(PageCyclerIndexedDatabaseTest, IndexedDB##name##File) { \
588 RunTest(test, test, false); \
589 } \
590 TEST_F(PageCyclerIndexedDatabaseReferenceTest, IndexedDB##name##File) { \
591 RunTest(test, test, false); \
592 }
593
594 // These are shorthand for File vs. Http tests.
595 #define PAGE_CYCLER_FILE_TESTS(test, name) \
596 PAGE_CYCLER_TESTS(test, name, false)
597 #define PAGE_CYCLER_HTTP_TESTS(test, name) \
598 PAGE_CYCLER_TESTS(test, name, true)
599
600 // This macro lets us define tests with 1 and 10 extensions with 1 content
601 // script each. The name for the 10-extension case is changed so as not
602 // to run by default on the buildbots.
603 #define PAGE_CYCLER_EXTENSIONS_FILE_TESTS(test, name) \
604 TEST_F(PageCyclerExtensionTest, name) { \
605 RunTest("times", "content_scripts1", "_extcs1", test, false); \
606 } \
607 TEST_F(PageCyclerExtensionTest, name##10) { \
608 RunTest("times", "content_scripts10", "_extcs10", test, false); \
609 }
610
611 // This macro lets us define tests with an extension that listens to the
612 // webrequest.onBeforeRequest. It measures the effect that a blocking event
613 // for every request has on page cycle time.
614 #define PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS(test, name) \
615 TEST_F(PageCyclerExtensionWebRequestTest, name) { \
616 RunTest("times", "extension_webrequest", "_extwr", test, false); \
617 }
618
619 #define PAGE_CYCLER_WEBPAGEREPLAY_TESTS(test, name) \
620 TEST_F(PageCyclerWebPageReplayTest, name) { \
621 RunTest("times", test); \
622 }
623
624 // file-URL tests
625 PAGE_CYCLER_FILE_TESTS("moz", MozFile);
626 PAGE_CYCLER_EXTENSIONS_FILE_TESTS("moz", MozFile);
627 PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS("moz", MozFile)
628 PAGE_CYCLER_FILE_TESTS("intl1", Intl1File);
629 PAGE_CYCLER_FILE_TESTS("intl2", Intl2File);
630 PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS("intl2", Intl2File);
631 PAGE_CYCLER_FILE_TESTS("dom", DomFile);
632 PAGE_CYCLER_FILE_TESTS("dhtml", DhtmlFile);
633 PAGE_CYCLER_FILE_TESTS("morejs", MorejsFile);
634 PAGE_CYCLER_EXTENSIONS_FILE_TESTS("morejs", MorejsFile);
635 // added more tests here:
636 PAGE_CYCLER_FILE_TESTS("alexa_us", Alexa_usFile);
637 PAGE_CYCLER_FILE_TESTS("moz2", Moz2File);
638 PAGE_CYCLER_FILE_TESTS("morejsnp", MorejsnpFile);
639 PAGE_CYCLER_FILE_TESTS("bloat", BloatFile);
640
641 // http (localhost) tests
642 PAGE_CYCLER_HTTP_TESTS("moz", MozHttp);
643 PAGE_CYCLER_HTTP_TESTS("intl1", Intl1Http);
644 PAGE_CYCLER_HTTP_TESTS("intl2", Intl2Http);
645 PAGE_CYCLER_HTTP_TESTS("dom", DomHttp);
646 PAGE_CYCLER_HTTP_TESTS("bloat", BloatHttp);
647
648 // Web Page Replay (simulated network) tests.
649 // Windows is unsupported because of issues with loopback adapter and
650 // dummynet is unavailable on Vista and above.
651 #if !defined(OS_WIN)
652 PAGE_CYCLER_WEBPAGEREPLAY_TESTS("2012Q2", 2012Q2);
653 #endif
654
655 // HTML5 database tests
656 // These tests are _really_ slow on XP/Vista.
657 #if !defined(OS_WIN)
658 PAGE_CYCLER_DATABASE_TESTS("select-transactions",
659 SelectTransactions);
660 PAGE_CYCLER_DATABASE_TESTS("select-readtransactions",
661 SelectReadTransactions);
662 PAGE_CYCLER_DATABASE_TESTS("select-readtransactions-read-results",
663 SelectReadTransactionsReadResults);
664 PAGE_CYCLER_DATABASE_TESTS("insert-transactions",
665 InsertTransactions);
666 PAGE_CYCLER_DATABASE_TESTS("update-transactions",
667 UpdateTransactions);
668 PAGE_CYCLER_DATABASE_TESTS("delete-transactions",
669 DeleteTransactions);
670 PAGE_CYCLER_DATABASE_TESTS("pseudo-random-transactions",
671 PseudoRandomTransactions);
672 #endif
673
674 // Indexed DB tests.
675 PAGE_CYCLER_IDB_TESTS("basic_insert", BasicInsert);
676
677 // Tests with accessibility enabled.
678 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) {
679 num_test_iterations_ = 1;
680 RunTest("times", "moz", false);
681 }
682
683 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) {
684 RunTest("times", "morejs", false);
685 }
686
687 } // namespace
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698