| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/precache/content/precache_manager.h" | 5 #include "components/precache/content/precache_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 | 549 |
| 550 // The other precaches should not have expired, so the following fetches from | 550 // The other precaches should not have expired, so the following fetches from |
| 551 // the cache should count as saved bytes. | 551 // the cache should count as saved bytes. |
| 552 precache_manager_->RecordStatsForFetch(GURL("http://recent-fetch.com"), | 552 precache_manager_->RecordStatsForFetch(GURL("http://recent-fetch.com"), |
| 553 GURL(), base::TimeDelta(), | 553 GURL(), base::TimeDelta(), |
| 554 kCurrentTime, info_, 1000); | 554 kCurrentTime, info_, 1000); |
| 555 precache_manager_->RecordStatsForFetch(GURL("http://yesterday-fetch.com"), | 555 precache_manager_->RecordStatsForFetch(GURL("http://yesterday-fetch.com"), |
| 556 GURL(), base::TimeDelta(), | 556 GURL(), base::TimeDelta(), |
| 557 kCurrentTime, info_, 1000); | 557 kCurrentTime, info_, 1000); |
| 558 expected_histogram_count_map["Precache.CacheStatus.NonPrefetch"] += 2; | 558 expected_histogram_count_map["Precache.CacheStatus.NonPrefetch"] += 2; |
| 559 expected_histogram_count_map |
| 560 ["Precache.CacheStatus.NonPrefetch.FromPrecache"] += 2; |
| 559 expected_histogram_count_map["Precache.Latency.NonPrefetch"] += 2; | 561 expected_histogram_count_map["Precache.Latency.NonPrefetch"] += 2; |
| 560 expected_histogram_count_map["Precache.Latency.NonPrefetch.NonTopHosts"] += 2; | 562 expected_histogram_count_map["Precache.Latency.NonPrefetch.NonTopHosts"] += 2; |
| 561 expected_histogram_count_map["Precache.Saved"] += 2; | 563 expected_histogram_count_map["Precache.Saved"] += 2; |
| 562 expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2; | 564 expected_histogram_count_map["Precache.TimeSinceLastPrecache"] += 2; |
| 563 expected_histogram_count_map["Precache.Saved.Freshness"] = 2; | 565 expected_histogram_count_map["Precache.Saved.Freshness"] = 2; |
| 564 | 566 |
| 565 base::RunLoop().RunUntilIdle(); | 567 base::RunLoop().RunUntilIdle(); |
| 566 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), | 568 EXPECT_THAT(histograms_.GetTotalCountsForPrefix("Precache."), |
| 567 ContainerEq(expected_histogram_count_map)); | 569 ContainerEq(expected_histogram_count_map)); |
| 568 } | 570 } |
| 569 | 571 |
| 570 } // namespace precache | 572 } // namespace precache |
| OLD | NEW |