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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("", "abcd")); | 206 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("", "abcd")); |
207 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("abcd", "")); | 207 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("abcd", "")); |
208 | 208 |
209 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("xxx", "xxxxxxx")); | 209 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("xxx", "xxxxxxx")); |
210 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("xxxxxxx", "xxx")); | 210 EXPECT_EQ(4u, ssl_errors::GetLevenshteinDistance("xxxxxxx", "xxx")); |
211 | 211 |
212 EXPECT_EQ(7u, ssl_errors::GetLevenshteinDistance("yyy", "xxxxxxx")); | 212 EXPECT_EQ(7u, ssl_errors::GetLevenshteinDistance("yyy", "xxxxxxx")); |
213 EXPECT_EQ(7u, ssl_errors::GetLevenshteinDistance("xxxxxxx", "yyy")); | 213 EXPECT_EQ(7u, ssl_errors::GetLevenshteinDistance("xxxxxxx", "yyy")); |
214 } | 214 } |
215 | 215 |
216 TEST_F(SSLErrorClassificationTest, GetClockState) { | 216 // Flaky, see https://bugs.chromium.org/p/chromium/issues/detail?id=668539. |
| 217 TEST_F(SSLErrorClassificationTest, DISABLED_GetClockState) { |
217 // This test aims to obtain all possible return values of | 218 // This test aims to obtain all possible return values of |
218 // |GetClockState|. | 219 // |GetClockState|. |
219 const char kBuildTimeHistogram[] = "interstitial.ssl.clockstate.build_time"; | 220 const char kBuildTimeHistogram[] = "interstitial.ssl.clockstate.build_time"; |
220 base::HistogramTester histograms; | 221 base::HistogramTester histograms; |
221 histograms.ExpectTotalCount(kBuildTimeHistogram, 0); | 222 histograms.ExpectTotalCount(kBuildTimeHistogram, 0); |
222 histograms.ExpectTotalCount(kNetworkTimeHistogram, 0); | 223 histograms.ExpectTotalCount(kNetworkTimeHistogram, 0); |
223 TestingPrefServiceSimple pref_service; | 224 TestingPrefServiceSimple pref_service; |
224 network_time::NetworkTimeTracker::RegisterPrefs(pref_service.registry()); | 225 network_time::NetworkTimeTracker::RegisterPrefs(pref_service.registry()); |
225 base::MessageLoop loop; | 226 base::MessageLoop loop; |
226 network_time::NetworkTimeTracker network_time_tracker( | 227 network_time::NetworkTimeTracker network_time_tracker( |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 clock->Advance(base::TimeDelta::FromDays(1)); | 445 clock->Advance(base::TimeDelta::FromDays(1)); |
445 // GetClockState() will fall back to the build time heuristic. | 446 // GetClockState() will fall back to the build time heuristic. |
446 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); | 447 ssl_errors::GetClockState(clock->Now(), &network_time_tracker); |
447 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); | 448 histograms.ExpectTotalCount(kNetworkTimeHistogram, 8); |
448 histograms.ExpectBucketCount( | 449 histograms.ExpectBucketCount( |
449 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, | 450 kNetworkTimeHistogram, ssl_errors::NETWORK_CLOCK_STATE_UNKNOWN_SYNC_LOST, |
450 1); | 451 1); |
451 | 452 |
452 io_thread.Stop(); | 453 io_thread.Stop(); |
453 } | 454 } |
OLD | NEW |