| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, | 360 true, 0.0, |
| 361 network_time::FieldTrialTest::FETCHES_IN_BACKGROUND_AND_ON_DEMAND); | 361 network_time::NetworkTimeTracker::FETCHES_IN_BACKGROUND_AND_ON_DEMAND); |
| 362 | 362 |
| 363 // No sync attempt. | 363 // No sync attempt. |
| 364 EXPECT_EQ( | 364 EXPECT_EQ( |
| 365 ssl_errors::ClockState::CLOCK_STATE_UNKNOWN, | 365 ssl_errors::ClockState::CLOCK_STATE_UNKNOWN, |
| 366 ssl_errors::GetClockState(base::Time::Now(), &network_time_tracker)); | 366 ssl_errors::GetClockState(base::Time::Now(), &network_time_tracker)); |
| 367 histograms.ExpectTotalCount(kNetworkTimeHistogram, 1); | 367 histograms.ExpectTotalCount(kNetworkTimeHistogram, 1); |
| 368 histograms.ExpectBucketCount( | 368 histograms.ExpectBucketCount( |
| 369 kNetworkTimeHistogram, | 369 kNetworkTimeHistogram, |
| 370 ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT, 1); | 370 ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_NO_SYNC_ATTEMPT, 1); |
| 371 | 371 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 clock->Advance(base::TimeDelta::FromDays(1)); | 444 clock->Advance(base::TimeDelta::FromDays(1)); |
| 445 // GetClockState() will fall back to the build time heuristic. | 445 // GetClockState() will fall back to the build time heuristic. |
| 446 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); | 446 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); |
| 447 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); | 447 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); |
| 448 histograms.ExpectBucketCount( | 448 histograms.ExpectBucketCount( |
| 449 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, | 449 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, |
| 450 1); | 450 1); |
| 451 | 451 |
| 452 io_thread.Stop(); | 452 io_thread.Stop(); |
| 453 } | 453 } |
| OLD | NEW |