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 25 matching lines...) Expand all Loading... |
36 NetworkErrorResponseHandler(const net::test_server::HttpRequest& request) { | 36 NetworkErrorResponseHandler(const net::test_server::HttpRequest& request) { |
37 return std::unique_ptr<net::test_server::HttpResponse>( | 37 return std::unique_ptr<net::test_server::HttpResponse>( |
38 new net::test_server::RawHttpResponse("", "")); | 38 new net::test_server::RawHttpResponse("", "")); |
39 } | 39 } |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 class SSLErrorClassificationTest : public ::testing::Test { | 43 class SSLErrorClassificationTest : public ::testing::Test { |
44 public: | 44 public: |
45 SSLErrorClassificationTest() | 45 SSLErrorClassificationTest() |
46 : field_trial_test_(network_time::FieldTrialTest::CreateForUnitTest()) {} | 46 : field_trial_test_(new network_time::FieldTrialTest()) {} |
47 network_time::FieldTrialTest* field_trial_test() { | 47 network_time::FieldTrialTest* field_trial_test() { |
48 return field_trial_test_.get(); | 48 return field_trial_test_.get(); |
49 } | 49 } |
50 | 50 |
51 private: | 51 private: |
52 std::unique_ptr<network_time::FieldTrialTest> field_trial_test_; | 52 std::unique_ptr<network_time::FieldTrialTest> field_trial_test_; |
53 }; | 53 }; |
54 | 54 |
55 TEST_F(SSLErrorClassificationTest, TestNameMismatch) { | 55 TEST_F(SSLErrorClassificationTest, TestNameMismatch) { |
56 scoped_refptr<net::X509Certificate> google_cert( | 56 scoped_refptr<net::X509Certificate> google_cert( |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 clock->Advance(base::TimeDelta::FromDays(1)); | 446 clock->Advance(base::TimeDelta::FromDays(1)); |
447 // GetClockState() will fall back to the build time heuristic. | 447 // GetClockState() will fall back to the build time heuristic. |
448 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); | 448 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); |
449 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); | 449 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); |
450 histograms.ExpectBucketCount( | 450 histograms.ExpectBucketCount( |
451 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, | 451 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, |
452 1); | 452 1); |
453 | 453 |
454 io_thread.Stop(); | 454 io_thread.Stop(); |
455 } | 455 } |
OLD | NEW |