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

Side by Side Diff: chromeos/timezone/timezone_unittest.cc

Issue 834073002: ChromeOS: Implement periodic timezone refresh on geolocation data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase. Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « chromeos/timezone/timezone_resolver.cc ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 << url_factory.attempts() << "), no more then " 278 << url_factory.attempts() << "), no more then "
278 << expected_retries + 1 << " expected."; 279 << expected_retries + 1 << " expected.";
279 } 280 }
280 if (url_factory.attempts() < expected_retries - 1) { 281 if (url_factory.attempts() < expected_retries - 1) {
281 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too less attempts (" 282 LOG(WARNING) << "TimeZoneTest::InvalidResponse: Too less attempts ("
282 << url_factory.attempts() << "), greater then " 283 << url_factory.attempts() << "), greater then "
283 << expected_retries - 1 << " expected."; 284 << expected_retries - 1 << " expected.";
284 } 285 }
285 } 286 }
286 287
288 TEST(TimeZoneResolverTest, CheckIntervals) {
289 for (int requests_count = 1; requests_count < 10; ++requests_count) {
290 EXPECT_EQ(requests_count,
291 TimeZoneResolver::MaxRequestsCountForIntervalForTesting(
292 TimeZoneResolver::IntervalForNextRequestForTesting(
293 requests_count)));
294 }
295 }
296
287 } // namespace chromeos 297 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/timezone/timezone_resolver.cc ('k') | tools/metrics/actions/actions.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698