diff options
author | patrick@chromium.org <patrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 06:07:35 +0000 |
---|---|---|
committer | patrick@chromium.org <patrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-24 06:07:35 +0000 |
commit | a6e9dcf86f7154739415e7ed4abd14b81228a1d2 (patch) | |
tree | 3368be35b3aa27fdd65a495eca1c3f4b528a350d /chrome/test/reliability | |
parent | ce877ebc914bf9954793c817d57ff7f7457fdbcf (diff) | |
download | chromium_src-a6e9dcf86f7154739415e7ed4abd14b81228a1d2.zip chromium_src-a6e9dcf86f7154739415e7ed4abd14b81228a1d2.tar.gz chromium_src-a6e9dcf86f7154739415e7ed4abd14b81228a1d2.tar.bz2 |
Make PageLoadTest.Reliability faster and potentially less flaky in usage 1:
- Remove network requests for live websites, replace them with local resources.
- Lower timeout. Only about:crash hits the timeout, and it does not need such a
large timeout value.
- Remove page down, as the sleeps between page down calls were adding several
extra seconds to the test.
BUG=1078496
Review URL: http://codereview.chromium.org/42543
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12344 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/reliability')
-rw-r--r-- | chrome/test/reliability/page_load_test.cc | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc index b516d01..2a35813 100644 --- a/chrome/test/reliability/page_load_test.cc +++ b/chrome/test/reliability/page_load_test.cc @@ -6,8 +6,8 @@ // test is intended to run within QEMU environment. // // Usage 1: reliability_test -// Upon invocation, it visits a hard coded list of URLs. This is mainly used -// by buildbot, to verify reliability_test itself runs ok. +// Upon invocation, it visits a hard coded list of sample URLs. This is mainly +// used by buildbot, to verify reliability_test itself runs ok. // // Usage 2: reliability_test --site=url --startpage=start --endpage=end [...] // Upon invocation, it visits a list of URLs constructed as @@ -31,12 +31,13 @@ // --timeout=millisecond: time out as specified in millisecond during each // page load. // --nopagedown: won't simulate page down key presses after page load. -// --savedebuglog: save Chrome and v8 debug log for each page loaded. +// --savedebuglog: save Chrome, V8, and test debug log for each page loaded. #include <fstream> #include <iostream> #include "base/command_line.h" +#include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/string_util.h" @@ -78,9 +79,9 @@ const wchar_t kNoPageDownSwitch[] = L"nopagedown"; const wchar_t kSaveDebugLogSwitch[] = L"savedebuglog"; std::wstring server_url = L"http://urllist.com"; -const wchar_t test_url_1[] = L"http://www.google.com"; -const wchar_t test_url_2[] = L"about:crash"; -const wchar_t test_url_3[] = L"http://www.youtube.com"; +const wchar_t test_page_1[] = L"page1.html"; +const wchar_t test_page_2[] = L"page2.html"; +const wchar_t crash_url[] = L"about:crash"; // These are copied from v8 definitions as we cannot include them. const wchar_t kV8LogFileSwitch[] = L"logfile"; @@ -299,9 +300,23 @@ class PageLoadTest : public UITest { // For usage 1 NavigationMetrics metrics; if (timeout_ms == INFINITE) - timeout_ms = 30000; + timeout_ms = 2000; - NavigateToURLLogResult(GURL(test_url_1), log_file, &metrics); + // Though it would be nice to test the page down code path in usage 1, + // enabling page down adds several seconds to the test and does not seem + // worth the tradeoff. It is also potentially disruptive when running the + // test in the background as it will send the event to the window that + // has focus. + page_down = false; + + FilePath sample_data_dir = GetSampleDataDir(); + FilePath test_page_1 = sample_data_dir.AppendASCII("page1.html"); + FilePath test_page_2 = sample_data_dir.AppendASCII("page2.html"); + + GURL test_url_1 = net::FilePathToFileURL(test_page_1); + GURL test_url_2 = net::FilePathToFileURL(test_page_2); + + NavigateToURLLogResult(test_url_1, log_file, &metrics); // Verify everything is fine EXPECT_EQ(NAVIGATION_SUCCESS, metrics.result); EXPECT_EQ(0, metrics.crash_dump_count); @@ -314,10 +329,7 @@ class PageLoadTest : public UITest { EXPECT_EQ(0, metrics.plugin_crash_count); // Go to "about:crash" - uint32 crash_timeout_ms = timeout_ms / 2; - std::swap(timeout_ms, crash_timeout_ms); - NavigateToURLLogResult(GURL(test_url_2), log_file, &metrics); - std::swap(timeout_ms, crash_timeout_ms); + NavigateToURLLogResult(GURL(crash_url), log_file, &metrics); // Page load crashed and test automation timed out. EXPECT_EQ(NAVIGATION_TIME_OUT, metrics.result); // Found a crash dump @@ -332,10 +344,7 @@ class PageLoadTest : public UITest { EXPECT_EQ(1, metrics.renderer_crash_count); EXPECT_EQ(0, metrics.plugin_crash_count); - uint32 youtube_timeout_ms = timeout_ms * 2; - std::swap(timeout_ms, youtube_timeout_ms); - NavigateToURLLogResult(GURL(test_url_3), log_file, &metrics); - std::swap(timeout_ms, youtube_timeout_ms); + NavigateToURLLogResult(test_url_2, log_file, &metrics); // The data on previous crash should be cleared and we should get // metrics for a successful page load. EXPECT_EQ(NAVIGATION_SUCCESS, metrics.result); @@ -541,6 +550,14 @@ class PageLoadTest : public UITest { metrics->browser_crash_count++; } + FilePath GetSampleDataDir() { + FilePath test_dir; + PathService::Get(chrome::DIR_TEST_DATA, &test_dir); + test_dir = test_dir.AppendASCII("reliability"); + test_dir = test_dir.AppendASCII("sample_pages"); + return test_dir; + } + // The pathname of Chrome's crash dumps directory. std::wstring crash_dumps_dir_path_; |