OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <utility> | 6 #include <utility> |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 EXPECT_EQ( | 272 EXPECT_EQ( |
273 "dstOffset=0.000000, rawOffset=0.000000, timeZoneId='', timeZoneName='', " | 273 "dstOffset=0.000000, rawOffset=0.000000, timeZoneId='', timeZoneName='', " |
274 "error_message='TimeZone provider at 'https://localhost/' : JSONReader " | 274 "error_message='TimeZone provider at 'https://localhost/' : JSONReader " |
275 "failed: Line: 1, column: 1, Unexpected token..', status=6 " | 275 "failed: Line: 1, column: 1, Unexpected token..', status=6 " |
276 "(REQUEST_ERROR)", | 276 "(REQUEST_ERROR)", |
277 receiver.timezone()->ToStringForDebug()); | 277 receiver.timezone()->ToStringForDebug()); |
278 EXPECT_FALSE(receiver.server_error()); | 278 EXPECT_FALSE(receiver.server_error()); |
279 EXPECT_GE(url_factory.attempts(), 2U); | 279 EXPECT_GE(url_factory.attempts(), 2U); |
280 if (url_factory.attempts() > expected_retries + 1) { | 280 if (url_factory.attempts() > expected_retries + 1) { |
281 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too many attempts (" | 281 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too many attempts (" |
282 << url_factory.attempts() << "), no more then " | 282 << url_factory.attempts() << "), no more than " |
283 << expected_retries + 1 << " expected."; | 283 << expected_retries + 1 << " expected."; |
284 } | 284 } |
285 if (url_factory.attempts() < expected_retries - 1) { | 285 if (url_factory.attempts() < expected_retries - 1) { |
286 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too less attempts (" | 286 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too less attempts (" |
287 << url_factory.attempts() << "), greater then " | 287 << url_factory.attempts() << "), greater than " |
288 << expected_retries - 1 << " expected."; | 288 << expected_retries - 1 << " expected."; |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 TEST(TimeZoneResolverTest, CheckIntervals) { | 292 TEST(TimeZoneResolverTest, CheckIntervals) { |
293 for (int requests_count = 1; requests_count < 10; ++requests_count) { | 293 for (int requests_count = 1; requests_count < 10; ++requests_count) { |
294 EXPECT_EQ(requests_count, | 294 EXPECT_EQ(requests_count, |
295 TimeZoneResolver::MaxRequestsCountForIntervalForTesting( | 295 TimeZoneResolver::MaxRequestsCountForIntervalForTesting( |
296 TimeZoneResolver::IntervalForNextRequestForTesting( | 296 TimeZoneResolver::IntervalForNextRequestForTesting( |
297 requests_count))); | 297 requests_count))); |
298 } | 298 } |
299 } | 299 } |
300 | 300 |
301 } // namespace chromeos | 301 } // namespace chromeos |
OLD | NEW |