Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: components/precache/content/precache_manager_unittest.cc

Issue 2364873004: Add Precache.CacheStatus.NonPrefetch.FromPrecache. (Closed)
Patch Set: Add const. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/precache/core/precache_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | components/precache/core/precache_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698