Chromium Code Reviews| Index: chrome/test/perf/page_cycler_test.cc |
| diff --git a/chrome/test/perf/page_cycler_test.cc b/chrome/test/perf/page_cycler_test.cc |
| index 272a4f928076bbf44c398c3e01982745a910b2b7..b633f610096e308f2d7edcaad43bd87c51afb274 100644 |
| --- a/chrome/test/perf/page_cycler_test.cc |
| +++ b/chrome/test/perf/page_cycler_test.cc |
| @@ -29,12 +29,14 @@ |
| #ifndef NDEBUG |
| static const int kTestIterations = 2; |
| static const int kDatabaseTestIterations = 2; |
| +static const int kWebPageReplayIterations = 2; |
| #else |
| static const int kTestIterations = 10; |
| // For some unknown reason, the DB perf tests are much much slower on the |
| // Vista perf bot, so we have to cut down the number of iterations to 5 |
| // to make sure each test finishes in less than 10 minutes. |
| static const int kDatabaseTestIterations = 5; |
| +static const int kWebPageReplayIterations = 5; |
| #endif |
| static const int kIDBTestIterations = 5; |
| @@ -443,6 +445,56 @@ class PageCyclerIndexedDatabaseReferenceTest : public PageCyclerReferenceTest { |
| } |
| }; |
| +// Web Page Replay is a proxy server to record and serve pages with |
| +// realistic network delays and bandwidth throttling. runtest.py |
| +// launches replay.py to support these tests. |
|
James Simonsen
2012/04/05 00:07:22
nit: This can be reflowed.
|
| +class PageCyclerWebPageReplayTest : public PageCyclerTest { |
| + public: |
| + PageCyclerWebPageReplayTest() { |
| + FilePath extension_path; |
| + PathService::Get(base::DIR_SOURCE_ROOT, &extension_path); |
| + extension_path = extension_path.Append(FILE_PATH_LITERAL("tools")); |
| + extension_path = extension_path.Append(FILE_PATH_LITERAL("page_cycler")); |
| + extension_path = extension_path.Append(FILE_PATH_LITERAL("webpagereplay")); |
| + extension_path = extension_path.Append(FILE_PATH_LITERAL("extension")); |
| + launch_arguments_.AppendSwitchPath( |
| + switches::kLoadExtension, extension_path); |
| + launch_arguments_.AppendSwitchASCII( |
| + switches::kHostResolverRules, "MAP * 127.0.0.1"); |
| + launch_arguments_.AppendSwitchASCII( |
| + switches::kTestingFixedHttpPort, "8080"); |
| + launch_arguments_.AppendSwitchASCII( |
| + switches::kTestingFixedHttpsPort, "8413"); |
| + launch_arguments_.AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| + launch_arguments_.AppendSwitch(switches::kEnableStatsTable); |
| + launch_arguments_.AppendSwitch(switches::kEnableBenchmarking); |
| + launch_arguments_.AppendSwitch(switches::kIgnoreCertificateErrors); |
| + launch_arguments_.AppendSwitch(switches::kDisableTranslate); |
| + launch_arguments_.AppendSwitch(switches::kNoProxyServer); |
| + } |
| + |
| + virtual FilePath GetDataPath(const char* name) { |
| + // Make sure the test data is checked out |
| + FilePath test_path; |
| + PathService::Get(base::DIR_SOURCE_ROOT, &test_path); |
| + test_path = test_path.Append(FILE_PATH_LITERAL("data")); |
| + test_path = test_path.Append(FILE_PATH_LITERAL("page_cycler")); |
| + test_path = test_path.Append(FILE_PATH_LITERAL("webpagereplay")); |
| + test_path = test_path.AppendASCII(name); |
| + return test_path; |
| + } |
| + |
| + void RunTest(const char* graph, const char* name) { |
| + // The WPR extension expects a file URL for the start page. |
| + const bool use_http = false; |
| + PageCyclerTest::RunTestWithSuffix(graph, name, use_http, ""); |
| + } |
| + |
| + virtual int GetTestIterations() { |
| + return kWebPageReplayIterations; |
| + } |
| +}; |
| + |
| // This macro simplifies setting up regular and reference build tests. |
| #define PAGE_CYCLER_TESTS(test, name, use_http) \ |
| TEST_F(PageCyclerTest, name) { \ |
| @@ -497,6 +549,11 @@ TEST_F(PageCyclerExtensionWebRequestTest, name) { \ |
| RunTest("times", "extension_webrequest", "_extwr", test, false); \ |
| } |
| +#define PAGE_CYCLER_WEBPAGEREPLAY_TESTS(test, name) \ |
| +TEST_F(PageCyclerWebPageReplayTest, name) { \ |
| + RunTest("times", test); \ |
| +} |
| + |
| // file-URL tests |
| PAGE_CYCLER_FILE_TESTS("moz", MozFile); |
| PAGE_CYCLER_EXTENSIONS_FILE_TESTS("moz", MozFile); |
| @@ -521,6 +578,11 @@ PAGE_CYCLER_HTTP_TESTS("intl2", Intl2Http); |
| PAGE_CYCLER_HTTP_TESTS("dom", DomHttp); |
| PAGE_CYCLER_HTTP_TESTS("bloat", BloatHttp); |
| +// 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
|
| +#if !defined(OS_WIN) |
| +PAGE_CYCLER_WEBPAGEREPLAY_TESTS("2012Q2", 2012Q2); |
| +#endif |
| + |
| // HTML5 database tests |
| // These tests are _really_ slow on XP/Vista. |
| #if !defined(OS_WIN) |