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 "base/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "chromeos/geolocation/geoposition.h" | 7 #include "chromeos/geolocation/geoposition.h" |
8 #include "chromeos/timezone/timezone_provider.h" | 8 #include "chromeos/timezone/timezone_provider.h" |
9 #include "chromeos/timezone/timezone_resolver.h" | |
9 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
10 #include "net/http/http_status_code.h" | 11 #include "net/http/http_status_code.h" |
11 #include "net/url_request/test_url_fetcher_factory.h" | 12 #include "net/url_request/test_url_fetcher_factory.h" |
12 #include "net/url_request/url_fetcher_impl.h" | 13 #include "net/url_request/url_fetcher_impl.h" |
13 #include "net/url_request/url_request_status.h" | 14 #include "net/url_request/url_request_status.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 const int kRequestRetryIntervalMilliSeconds = 200; | 19 const int kRequestRetryIntervalMilliSeconds = 200; |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
280 << url_factory.attempts() << "), no more then " | 281 << url_factory.attempts() << "), no more then " |
281 << expected_retries + 1 << " expected."; | 282 << expected_retries + 1 << " expected."; |
282 } | 283 } |
283 if (url_factory.attempts() < expected_retries - 1) { | 284 if (url_factory.attempts() < expected_retries - 1) { |
284 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too less attempts (" | 285 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too less attempts (" |
285 << url_factory.attempts() << "), greater then " | 286 << url_factory.attempts() << "), greater then " |
286 << expected_retries - 1 << " expected."; | 287 << expected_retries - 1 << " expected."; |
287 } | 288 } |
288 } | 289 } |
289 | 290 |
291 struct TimeZoneResolverTest : public testing::Test { | |
Bernhard Bauer
2015/01/16 09:25:05
You don't need a test fixture for very simple test
Alexander Alekseev
2015/01/16 20:42:45
Done.
| |
292 }; | |
293 | |
294 TEST_F(TimeZoneResolverTest, CheckIntervals) { | |
295 for (unsigned int requests_count = 1; requests_count < 10; ++requests_count) { | |
296 EXPECT_EQ(requests_count, | |
297 MaxRequestsCountForIntervalForTesting( | |
298 IntervalForNextRequestForTesting(requests_count))); | |
299 } | |
300 } | |
301 | |
290 } // namespace chromeos | 302 } // namespace chromeos |
OLD | NEW |