summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-27 18:46:33 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-27 18:46:33 +0000
commitfb9846b4550d2bc633824fcceb0d8ef89674ffc5 (patch)
tree830e3730989cb60a292571464d324f9c903765ee /chrome/test
parent43ceffd67ecabba9c9368b16e840f5bf37afac6b (diff)
downloadchromium_src-fb9846b4550d2bc633824fcceb0d8ef89674ffc5.zip
chromium_src-fb9846b4550d2bc633824fcceb0d8ef89674ffc5.tar.gz
chromium_src-fb9846b4550d2bc633824fcceb0d8ef89674ffc5.tar.bz2
Make AutomationProxyTest.NavigateToURLWithTimeout* tests not-flaky.
I used a mock url request job which is guaranteed to finish after the timeout the test uses. TEST=none http://crbug.com/16462 Review URL: http://codereview.chromium.org/155941 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21668 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/automation/automation_proxy_uitest.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index 5739ca5..943d90c 100644
--- a/chrome/test/automation/automation_proxy_uitest.cc
+++ b/chrome/test/automation/automation_proxy_uitest.cc
@@ -12,6 +12,7 @@
#include "base/string_util.h"
#include "build/build_config.h"
#include "chrome/app/chrome_dll_resource.h"
+#include "chrome/browser/automation/url_request_slow_http_job.h"
#include "chrome/browser/view_ids.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -287,6 +288,14 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout1) {
std::wstring title;
ASSERT_TRUE(tab->GetTabTitle(&title));
ASSERT_STREQ(L"Title Of Awesomeness", title.c_str());
+
+ // Use timeout high enough to allow the browser to create a url request job.
+ const int kLowTimeoutMs = 250;
+ ASSERT_GE(URLRequestSlowHTTPJob::kDelayMs, kLowTimeoutMs);
+ tab->NavigateToURLWithTimeout(
+ URLRequestSlowHTTPJob::GetMockUrl(filename.ToWStringHack()),
+ kLowTimeoutMs, &is_timeout);
+ ASSERT_TRUE(is_timeout);
}
TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) {
@@ -299,8 +308,13 @@ TEST_F(AutomationProxyTest, NavigateToURLWithTimeout2) {
filename1 = filename1.AppendASCII("title1.html");
bool is_timeout;
- tab->NavigateToURLWithTimeout(net::FilePathToFileURL(filename1),
- 1, &is_timeout);
+
+ // Use timeout high enough to allow the browser to create a url request job.
+ const int kLowTimeoutMs = 250;
+ ASSERT_GE(URLRequestSlowHTTPJob::kDelayMs, kLowTimeoutMs);
+ tab->NavigateToURLWithTimeout(
+ URLRequestSlowHTTPJob::GetMockUrl(filename1.ToWStringHack()),
+ kLowTimeoutMs, &is_timeout);
ASSERT_TRUE(is_timeout);
FilePath filename2(test_data_directory_);