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 |