OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/ssl_errors/error_classification.h" | 5 #include "components/ssl_errors/error_classification.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 clock->Advance(base::TimeDelta::FromDays(111)); | 350 clock->Advance(base::TimeDelta::FromDays(111)); |
351 tick_clock->Advance(base::TimeDelta::FromDays(222)); | 351 tick_clock->Advance(base::TimeDelta::FromDays(222)); |
352 | 352 |
353 base::MessageLoop loop; | 353 base::MessageLoop loop; |
354 network_time::NetworkTimeTracker network_time_tracker( | 354 network_time::NetworkTimeTracker network_time_tracker( |
355 std::unique_ptr<base::Clock>(clock), | 355 std::unique_ptr<base::Clock>(clock), |
356 std::unique_ptr<base::TickClock>(tick_clock), &pref_service, | 356 std::unique_ptr<base::TickClock>(tick_clock), &pref_service, |
357 new net::TestURLRequestContextGetter(io_thread.task_runner())); | 357 new net::TestURLRequestContextGetter(io_thread.task_runner())); |
358 network_time_tracker.SetTimeServerURLForTesting(test_server.GetURL("/")); | 358 network_time_tracker.SetTimeServerURLForTesting(test_server.GetURL("/")); |
359 field_trial_test()->SetNetworkQueriesWithVariationsService( | 359 field_trial_test()->SetNetworkQueriesWithVariationsService( |
360 true, 0.0, network_time::FieldTrialTest::ENABLE_FETCHES_ON_DEMAND); | 360 true, 0.0, |
| 361 network_time::FieldTrialTest::FETCHES_IN_BACKGROUND_AND_ON_DEMAND); |
361 | 362 |
362 // No sync attempt. | 363 // No sync attempt. |
363 EXPECT_EQ( | 364 EXPECT_EQ( |
364 ssl_errors::ClockState::CLOCK_STATE_UNKNOWN, | 365 ssl_errors::ClockState::CLOCK_STATE_UNKNOWN, |
365 ssl_errors::GetClockState(base::Time::Now(), &network_time_tracker)); | 366 ssl_errors::GetClockState(base::Time::Now(), &network_time_tracker)); |
366 histograms.ExpectTotalCount(kNetworkTimeHistogram, 1); | 367 histograms.ExpectTotalCount(kNetworkTimeHistogram, 1); |
367 histograms.ExpectBucketCount( | 368 histograms.ExpectBucketCount( |
368 kNetworkTimeHistogram, | 369 kNetworkTimeHistogram, |
369 ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT, 1); | 370 ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT, 1); |
370 | 371 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 clock->Advance(base::TimeDelta::FromDays(1)); | 443 clock->Advance(base::TimeDelta::FromDays(1)); |
443 // GetClockState() will fall back to the build time heuristic. | 444 // GetClockState() will fall back to the build time heuristic. |
444 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); | 445 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); |
445 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); | 446 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); |
446 histograms.ExpectBucketCount( | 447 histograms.ExpectBucketCount( |
447 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, | 448 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, |
448 1); | 449 1); |
449 | 450 |
450 io_thread.Stop(); | 451 io_thread.Stop(); |
451 } | 452 } |
OLD | NEW |