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

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

Issue 9956045: Add Web Page Replay test to page cycler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review. Created 8 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/test/base/chrome_process_util.h" 22 #include "chrome/test/base/chrome_process_util.h"
23 #include "chrome/test/base/test_switches.h" 23 #include "chrome/test/base/test_switches.h"
24 #include "chrome/test/perf/perf_test.h" 24 #include "chrome/test/perf/perf_test.h"
25 #include "chrome/test/ui/ui_perf_test.h" 25 #include "chrome/test/ui/ui_perf_test.h"
26 #include "googleurl/src/gurl.h" 26 #include "googleurl/src/gurl.h"
27 #include "net/base/net_util.h" 27 #include "net/base/net_util.h"
28 28
29 #ifndef NDEBUG 29 #ifndef NDEBUG
30 static const int kTestIterations = 2; 30 static const int kTestIterations = 2;
31 static const int kDatabaseTestIterations = 2; 31 static const int kDatabaseTestIterations = 2;
32 static const int kWebPageReplayIterations = 2;
32 #else 33 #else
33 static const int kTestIterations = 10; 34 static const int kTestIterations = 10;
34 // For some unknown reason, the DB perf tests are much much slower on the 35 // For some unknown reason, the DB perf tests are much much slower on the
35 // Vista perf bot, so we have to cut down the number of iterations to 5 36 // Vista perf bot, so we have to cut down the number of iterations to 5
36 // to make sure each test finishes in less than 10 minutes. 37 // to make sure each test finishes in less than 10 minutes.
37 static const int kDatabaseTestIterations = 5; 38 static const int kDatabaseTestIterations = 5;
39 static const int kWebPageReplayIterations = 5;
38 #endif 40 #endif
39 static const int kIDBTestIterations = 5; 41 static const int kIDBTestIterations = 5;
40 42
41 // URL at which data files may be found for HTTP tests. The document root of 43 // URL at which data files may be found for HTTP tests. The document root of
42 // this URL's server should point to data/page_cycler/. 44 // this URL's server should point to data/page_cycler/.
43 static const char kBaseUrl[] = "http://localhost:8000/"; 45 static const char kBaseUrl[] = "http://localhost:8000/";
44 46
45 namespace { 47 namespace {
46 48
47 void PopulateBufferCache(const FilePath& test_dir) { 49 void PopulateBufferCache(const FilePath& test_dir) {
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 438
437 virtual bool HasErrors(const std::string timings) { 439 virtual bool HasErrors(const std::string timings) {
438 return HasDatabaseErrors(timings); 440 return HasDatabaseErrors(timings);
439 } 441 }
440 442
441 virtual int GetTestIterations() { 443 virtual int GetTestIterations() {
442 return kIDBTestIterations; 444 return kIDBTestIterations;
443 } 445 }
444 }; 446 };
445 447
448 // Web Page Replay is a proxy server to record and serve pages with
449 // realistic network delays and bandwidth throttling. runtest.py
450 // launches replay.py to support these tests.
James Simonsen 2012/04/05 00:07:22 nit: This can be reflowed.
451 class PageCyclerWebPageReplayTest : public PageCyclerTest {
452 public:
453 PageCyclerWebPageReplayTest() {
454 FilePath extension_path;
455 PathService::Get(base::DIR_SOURCE_ROOT, &extension_path);
456 extension_path = extension_path.Append(FILE_PATH_LITERAL("tools"));
457 extension_path = extension_path.Append(FILE_PATH_LITERAL("page_cycler"));
458 extension_path = extension_path.Append(FILE_PATH_LITERAL("webpagereplay"));
459 extension_path = extension_path.Append(FILE_PATH_LITERAL("extension"));
460 launch_arguments_.AppendSwitchPath(
461 switches::kLoadExtension, extension_path);
462 launch_arguments_.AppendSwitchASCII(
463 switches::kHostResolverRules, "MAP * 127.0.0.1");
464 launch_arguments_.AppendSwitchASCII(
465 switches::kTestingFixedHttpPort, "8080");
466 launch_arguments_.AppendSwitchASCII(
467 switches::kTestingFixedHttpsPort, "8413");
468 launch_arguments_.AppendSwitch(switches::kEnableExperimentalExtensionApis);
469 launch_arguments_.AppendSwitch(switches::kEnableStatsTable);
470 launch_arguments_.AppendSwitch(switches::kEnableBenchmarking);
471 launch_arguments_.AppendSwitch(switches::kIgnoreCertificateErrors);
472 launch_arguments_.AppendSwitch(switches::kDisableTranslate);
473 launch_arguments_.AppendSwitch(switches::kNoProxyServer);
474 }
475
476 virtual FilePath GetDataPath(const char* name) {
477 // Make sure the test data is checked out
478 FilePath test_path;
479 PathService::Get(base::DIR_SOURCE_ROOT, &test_path);
480 test_path = test_path.Append(FILE_PATH_LITERAL("data"));
481 test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler"));
482 test_path = test_path.Append(FILE_PATH_LITERAL("webpagereplay"));
483 test_path = test_path.AppendASCII(name);
484 return test_path;
485 }
486
487 void RunTest(const char* graph, const char* name) {
488 // The WPR extension expects a file URL for the start page.
489 const bool use_http = false;
490 PageCyclerTest::RunTestWithSuffix(graph, name, use_http, "");
491 }
492
493 virtual int GetTestIterations() {
494 return kWebPageReplayIterations;
495 }
496 };
497
446 // This macro simplifies setting up regular and reference build tests. 498 // This macro simplifies setting up regular and reference build tests.
447 #define PAGE_CYCLER_TESTS(test, name, use_http) \ 499 #define PAGE_CYCLER_TESTS(test, name, use_http) \
448 TEST_F(PageCyclerTest, name) { \ 500 TEST_F(PageCyclerTest, name) { \
449 RunTest("times", test, use_http); \ 501 RunTest("times", test, use_http); \
450 } \ 502 } \
451 TEST_F(PageCyclerReferenceTest, name) { \ 503 TEST_F(PageCyclerReferenceTest, name) { \
452 RunTest("times", test, use_http); \ 504 RunTest("times", test, use_http); \
453 } 505 }
454 506
455 // This macro simplifies setting up regular and reference build tests 507 // This macro simplifies setting up regular and reference build tests
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 } 542 }
491 543
492 // This macro lets us define tests with an extension that listens to the 544 // This macro lets us define tests with an extension that listens to the
493 // webrequest.onBeforeRequest. It measures the effect that a blocking event 545 // webrequest.onBeforeRequest. It measures the effect that a blocking event
494 // for every request has on page cycle time. 546 // for every request has on page cycle time.
495 #define PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS(test, name) \ 547 #define PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS(test, name) \
496 TEST_F(PageCyclerExtensionWebRequestTest, name) { \ 548 TEST_F(PageCyclerExtensionWebRequestTest, name) { \
497 RunTest("times", "extension_webrequest", "_extwr", test, false); \ 549 RunTest("times", "extension_webrequest", "_extwr", test, false); \
498 } 550 }
499 551
552 #define PAGE_CYCLER_WEBPAGEREPLAY_TESTS(test, name) \
553 TEST_F(PageCyclerWebPageReplayTest, name) { \
554 RunTest("times", test); \
555 }
556
500 // file-URL tests 557 // file-URL tests
501 PAGE_CYCLER_FILE_TESTS("moz", MozFile); 558 PAGE_CYCLER_FILE_TESTS("moz", MozFile);
502 PAGE_CYCLER_EXTENSIONS_FILE_TESTS("moz", MozFile); 559 PAGE_CYCLER_EXTENSIONS_FILE_TESTS("moz", MozFile);
503 PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS("moz", MozFile) 560 PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS("moz", MozFile)
504 PAGE_CYCLER_FILE_TESTS("intl1", Intl1File); 561 PAGE_CYCLER_FILE_TESTS("intl1", Intl1File);
505 PAGE_CYCLER_FILE_TESTS("intl2", Intl2File); 562 PAGE_CYCLER_FILE_TESTS("intl2", Intl2File);
506 PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS("intl2", Intl2File); 563 PAGE_CYCLER_EXTENSIONS_WEBREQUEST_FILE_TESTS("intl2", Intl2File);
507 PAGE_CYCLER_FILE_TESTS("dom", DomFile); 564 PAGE_CYCLER_FILE_TESTS("dom", DomFile);
508 PAGE_CYCLER_FILE_TESTS("dhtml", DhtmlFile); 565 PAGE_CYCLER_FILE_TESTS("dhtml", DhtmlFile);
509 PAGE_CYCLER_FILE_TESTS("morejs", MorejsFile); 566 PAGE_CYCLER_FILE_TESTS("morejs", MorejsFile);
510 PAGE_CYCLER_EXTENSIONS_FILE_TESTS("morejs", MorejsFile); 567 PAGE_CYCLER_EXTENSIONS_FILE_TESTS("morejs", MorejsFile);
511 // added more tests here: 568 // added more tests here:
512 PAGE_CYCLER_FILE_TESTS("alexa_us", Alexa_usFile); 569 PAGE_CYCLER_FILE_TESTS("alexa_us", Alexa_usFile);
513 PAGE_CYCLER_FILE_TESTS("moz2", Moz2File); 570 PAGE_CYCLER_FILE_TESTS("moz2", Moz2File);
514 PAGE_CYCLER_FILE_TESTS("morejsnp", MorejsnpFile); 571 PAGE_CYCLER_FILE_TESTS("morejsnp", MorejsnpFile);
515 PAGE_CYCLER_FILE_TESTS("bloat", BloatFile); 572 PAGE_CYCLER_FILE_TESTS("bloat", BloatFile);
516 573
517 // http (localhost) tests 574 // http (localhost) tests
518 PAGE_CYCLER_HTTP_TESTS("moz", MozHttp); 575 PAGE_CYCLER_HTTP_TESTS("moz", MozHttp);
519 PAGE_CYCLER_HTTP_TESTS("intl1", Intl1Http); 576 PAGE_CYCLER_HTTP_TESTS("intl1", Intl1Http);
520 PAGE_CYCLER_HTTP_TESTS("intl2", Intl2Http); 577 PAGE_CYCLER_HTTP_TESTS("intl2", Intl2Http);
521 PAGE_CYCLER_HTTP_TESTS("dom", DomHttp); 578 PAGE_CYCLER_HTTP_TESTS("dom", DomHttp);
522 PAGE_CYCLER_HTTP_TESTS("bloat", BloatHttp); 579 PAGE_CYCLER_HTTP_TESTS("bloat", BloatHttp);
523 580
581 // Web Page Replay (simulated network) tests (Windows unsupported).
James Simonsen 2012/04/05 00:07:22 Why? (I know, but you should explain it to others
582 #if !defined(OS_WIN)
583 PAGE_CYCLER_WEBPAGEREPLAY_TESTS("2012Q2", 2012Q2);
584 #endif
585
524 // HTML5 database tests 586 // HTML5 database tests
525 // These tests are _really_ slow on XP/Vista. 587 // These tests are _really_ slow on XP/Vista.
526 #if !defined(OS_WIN) 588 #if !defined(OS_WIN)
527 PAGE_CYCLER_DATABASE_TESTS("select-transactions", 589 PAGE_CYCLER_DATABASE_TESTS("select-transactions",
528 SelectTransactions); 590 SelectTransactions);
529 PAGE_CYCLER_DATABASE_TESTS("select-readtransactions", 591 PAGE_CYCLER_DATABASE_TESTS("select-readtransactions",
530 SelectReadTransactions); 592 SelectReadTransactions);
531 PAGE_CYCLER_DATABASE_TESTS("select-readtransactions-read-results", 593 PAGE_CYCLER_DATABASE_TESTS("select-readtransactions-read-results",
532 SelectReadTransactionsReadResults); 594 SelectReadTransactionsReadResults);
533 PAGE_CYCLER_DATABASE_TESTS("insert-transactions", 595 PAGE_CYCLER_DATABASE_TESTS("insert-transactions",
534 InsertTransactions); 596 InsertTransactions);
535 PAGE_CYCLER_DATABASE_TESTS("update-transactions", 597 PAGE_CYCLER_DATABASE_TESTS("update-transactions",
536 UpdateTransactions); 598 UpdateTransactions);
537 PAGE_CYCLER_DATABASE_TESTS("delete-transactions", 599 PAGE_CYCLER_DATABASE_TESTS("delete-transactions",
538 DeleteTransactions); 600 DeleteTransactions);
539 PAGE_CYCLER_DATABASE_TESTS("pseudo-random-transactions", 601 PAGE_CYCLER_DATABASE_TESTS("pseudo-random-transactions",
540 PseudoRandomTransactions); 602 PseudoRandomTransactions);
541 #endif 603 #endif
542 604
543 // Indexed DB tests. 605 // Indexed DB tests.
544 PAGE_CYCLER_IDB_TESTS("basic_insert", BasicInsert); 606 PAGE_CYCLER_IDB_TESTS("basic_insert", BasicInsert);
545 607
546 } // namespace 608 } // namespace
OLDNEW
« no previous file with comments | « no previous file | tools/page_cycler/webpagereplay/README » ('j') | tools/page_cycler/webpagereplay/extension/background.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698