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

Unified Diff: chrome/browser/chromeos/geolocation/simple_geolocation_unittest.cc

Issue 296853009: Reduce potential flakiness of SimpleGeolocationTest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/geolocation/simple_geolocation_unittest.cc
diff --git a/chrome/browser/chromeos/geolocation/simple_geolocation_unittest.cc b/chrome/browser/chromeos/geolocation/simple_geolocation_unittest.cc
index 0137c4b45eb2891fb5e1550aa65b1cf130660512..01b4900ec4e2c61acd5bcd095607dc63d17c5d5d 100644
--- a/chrome/browser/chromeos/geolocation/simple_geolocation_unittest.cc
+++ b/chrome/browser/chromeos/geolocation/simple_geolocation_unittest.cc
@@ -216,7 +216,12 @@ TEST_F(SimpleGeolocationTest, InvalidResponse) {
&provider);
GeolocationReceiver receiver;
+
const int timeout_seconds = 1;
+ size_t expected_retries = static_cast<size_t>(
+ timeout_seconds * 1000 / kRequestRetryIntervalMilliSeconds);
+ ASSERT_GE(expected_retries, 2U);
+
provider.RequestGeolocation(base::TimeDelta::FromSeconds(timeout_seconds),
base::Bind(&GeolocationReceiver::OnRequestDone,
base::Unretained(&receiver)));
@@ -229,10 +234,19 @@ TEST_F(SimpleGeolocationTest, InvalidResponse) {
"Unexpected token..', status=4 (TIMEOUT)",
receiver.position().ToString());
EXPECT_TRUE(receiver.server_error());
- size_t expected_retries = static_cast<size_t>(
- timeout_seconds * 1000 / kRequestRetryIntervalMilliSeconds);
- EXPECT_LE(url_factory.attempts(), expected_retries + 1);
- EXPECT_GE(url_factory.attempts(), expected_retries - 1);
+ EXPECT_GE(url_factory.attempts(), 2U);
+ if (url_factory.attempts() > expected_retries + 1) {
+ LOG(WARNING)
+ << "SimpleGeolocationTest::InvalidResponse: Too many attempts ("
+ << url_factory.attempts() << "), no more then " << expected_retries + 1
+ << " expected.";
+ }
+ if (url_factory.attempts() < expected_retries - 1) {
+ LOG(WARNING)
+ << "SimpleGeolocationTest::InvalidResponse: Too little attempts ("
+ << url_factory.attempts() << "), greater then " << expected_retries - 1
+ << " expected.";
+ }
}
} // namespace chromeos
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698