OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // within the given range | 57 // within the given range |
58 void FillTable(VisitedLinkMaster& master, const char* prefix, | 58 void FillTable(VisitedLinkMaster& master, const char* prefix, |
59 int begin, int end) { | 59 int begin, int end) { |
60 for (int i = begin; i < end; i++) | 60 for (int i = begin; i < end; i++) |
61 master.AddURL(TestURL(prefix, i)); | 61 master.AddURL(TestURL(prefix, i)); |
62 } | 62 } |
63 | 63 |
64 class VisitedLink : public testing::Test { | 64 class VisitedLink : public testing::Test { |
65 protected: | 65 protected: |
66 base::FilePath db_path_; | 66 base::FilePath db_path_; |
67 virtual void SetUp() { | 67 void SetUp() override { ASSERT_TRUE(base::CreateTemporaryFile(&db_path_)); } |
68 ASSERT_TRUE(base::CreateTemporaryFile(&db_path_)); | 68 void TearDown() override { base::DeleteFile(db_path_, false); } |
69 } | |
70 virtual void TearDown() { | |
71 base::DeleteFile(db_path_, false); | |
72 } | |
73 }; | 69 }; |
74 | 70 |
75 } // namespace | 71 } // namespace |
76 | 72 |
77 // This test tests adding many things to a database, and how long it takes | 73 // This test tests adding many things to a database, and how long it takes |
78 // to query the database with different numbers of things in it. The time | 74 // to query the database with different numbers of things in it. The time |
79 // is the total time to do all the operations, and as such, it is only | 75 // is the total time to do all the operations, and as such, it is only |
80 // useful for a regression test. If there is a regression, it might be | 76 // useful for a regression test. If there is a regression, it might be |
81 // useful to make another set of tests to test these things in isolation. | 77 // useful to make another set of tests to test these things in isolation. |
82 TEST_F(VisitedLink, TestAddAndQuery) { | 78 TEST_F(VisitedLink, TestAddAndQuery) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 cold_sum += cold_load_times[i]; | 188 cold_sum += cold_load_times[i]; |
193 hot_sum += hot_load_times[i]; | 189 hot_sum += hot_load_times[i]; |
194 } | 190 } |
195 base::LogPerfResult( | 191 base::LogPerfResult( |
196 "Visited_link_cold_load_time", cold_sum / cold_load_times.size(), "ms"); | 192 "Visited_link_cold_load_time", cold_sum / cold_load_times.size(), "ms"); |
197 base::LogPerfResult( | 193 base::LogPerfResult( |
198 "Visited_link_hot_load_time", hot_sum / hot_load_times.size(), "ms"); | 194 "Visited_link_hot_load_time", hot_sum / hot_load_times.size(), "ms"); |
199 } | 195 } |
200 | 196 |
201 } // namespace visitedlink | 197 } // namespace visitedlink |
OLD | NEW |