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

Side by Side Diff: components/precache/core/precache_database_unittest.cc

Issue 1431953003: Fix several uses of ScopedTempDir in components_unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « components/precache/content/precache_manager_unittest.cc ('k') | no next file » | 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/core/precache_database.h" 5 #include "components/precache/core/precache_database.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 int host_rank); 88 int host_rank);
89 void RecordFetchFromNetworkCellular(const GURL& url, 89 void RecordFetchFromNetworkCellular(const GURL& url,
90 base::TimeDelta latency, 90 base::TimeDelta latency,
91 const base::Time& fetch_time, 91 const base::Time& fetch_time,
92 int64 size); 92 int64 size);
93 void RecordFetchFromCache(const GURL& url, const base::Time& fetch_time, 93 void RecordFetchFromCache(const GURL& url, const base::Time& fetch_time,
94 int64 size); 94 int64 size);
95 void RecordFetchFromCacheCellular(const GURL& url, 95 void RecordFetchFromCacheCellular(const GURL& url,
96 const base::Time& fetch_time, int64 size); 96 const base::Time& fetch_time, int64 size);
97 97
98 // Must be declared first so that it is destroyed last.
99 base::ScopedTempDir scoped_temp_dir_;
100
98 // Having this MessageLoop member variable causes base::MessageLoop::current() 101 // Having this MessageLoop member variable causes base::MessageLoop::current()
99 // to be set properly. 102 // to be set properly.
100 base::MessageLoopForUI loop_; 103 base::MessageLoopForUI loop_;
101 104
102 scoped_refptr<PrecacheDatabase> precache_database_; 105 scoped_refptr<PrecacheDatabase> precache_database_;
103 base::ScopedTempDir scoped_temp_dir_;
104 base::HistogramTester histograms_; 106 base::HistogramTester histograms_;
105 base::HistogramTester::CountsMap expected_histogram_counts_; 107 base::HistogramTester::CountsMap expected_histogram_counts_;
106 108
107 void ExpectNewSample(const std::string& histogram_name, 109 void ExpectNewSample(const std::string& histogram_name,
108 base::HistogramBase::Sample sample) { 110 base::HistogramBase::Sample sample) {
109 histograms_.ExpectUniqueSample(histogram_name, sample, 1); 111 histograms_.ExpectUniqueSample(histogram_name, sample, 1);
110 expected_histogram_counts_[histogram_name]++; 112 expected_histogram_counts_[histogram_name]++;
111 } 113 }
112 114
113 void ExpectNoOtherSamples() { 115 void ExpectNoOtherSamples() {
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 EXPECT_THAT(histograms_.GetAllSamples("Precache.Saved"), 369 EXPECT_THAT(histograms_.GetAllSamples("Precache.Saved"),
368 ElementsAre(Bucket(kSize1, 1), Bucket(kSize3, 1))); 370 ElementsAre(Bucket(kSize1, 1), Bucket(kSize3, 1)));
369 371
370 EXPECT_THAT(histograms_.GetAllSamples("Precache.Saved.Cellular"), 372 EXPECT_THAT(histograms_.GetAllSamples("Precache.Saved.Cellular"),
371 ElementsAre(Bucket(kSize1, 1))); 373 ElementsAre(Bucket(kSize1, 1)));
372 } 374 }
373 375
374 } // namespace 376 } // namespace
375 377
376 } // namespace precache 378 } // namespace precache
OLDNEW
« no previous file with comments | « components/precache/content/precache_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698