| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <set> | 5 #include <set> |
| 6 #include <utility> | 6 #include <utility> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 | 231 |
| 232 void ResourcePrefetchPredictorTablesTest::TestResourceRowsAreEqual( | 232 void ResourcePrefetchPredictorTablesTest::TestResourceRowsAreEqual( |
| 233 const ResourceRows& lhs, | 233 const ResourceRows& lhs, |
| 234 const ResourceRows& rhs) const { | 234 const ResourceRows& rhs) const { |
| 235 EXPECT_EQ(lhs.size(), rhs.size()); | 235 EXPECT_EQ(lhs.size(), rhs.size()); |
| 236 | 236 |
| 237 std::set<GURL> resources_seen; | 237 std::set<GURL> resources_seen; |
| 238 for (ResourceRows::const_iterator rhs_it = rhs.begin(); | 238 for (ResourceRows::const_iterator rhs_it = rhs.begin(); |
| 239 rhs_it != rhs.end(); ++rhs_it) { | 239 rhs_it != rhs.end(); ++rhs_it) { |
| 240 const GURL& resource = rhs_it->resource_url; | 240 const GURL& resource = rhs_it->resource_url; |
| 241 EXPECT_FALSE(ContainsKey(resources_seen, resource)); | 241 EXPECT_FALSE(base::ContainsKey(resources_seen, resource)); |
| 242 | 242 |
| 243 for (ResourceRows::const_iterator lhs_it = lhs.begin(); | 243 for (ResourceRows::const_iterator lhs_it = lhs.begin(); |
| 244 lhs_it != lhs.end(); ++lhs_it) { | 244 lhs_it != lhs.end(); ++lhs_it) { |
| 245 if (*rhs_it == *lhs_it) { | 245 if (*rhs_it == *lhs_it) { |
| 246 resources_seen.insert(resource); | 246 resources_seen.insert(resource); |
| 247 break; | 247 break; |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 EXPECT_TRUE(ContainsKey(resources_seen, resource)); | 250 EXPECT_TRUE(base::ContainsKey(resources_seen, resource)); |
| 251 } | 251 } |
| 252 EXPECT_EQ(lhs.size(), resources_seen.size()); | 252 EXPECT_EQ(lhs.size(), resources_seen.size()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 void ResourcePrefetchPredictorTablesTest::AddKey(PrefetchDataMap* m, | 255 void ResourcePrefetchPredictorTablesTest::AddKey(PrefetchDataMap* m, |
| 256 const std::string& key) const { | 256 const std::string& key) const { |
| 257 PrefetchDataMap::const_iterator it = test_url_data_.find(key); | 257 PrefetchDataMap::const_iterator it = test_url_data_.find(key); |
| 258 if (it != test_url_data_.end()) { | 258 if (it != test_url_data_.end()) { |
| 259 m->insert(std::make_pair(it->first, it->second)); | 259 m->insert(std::make_pair(it->first, it->second)); |
| 260 return; | 260 return; |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 401 |
| 402 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteSingleDataPoint) { | 402 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteSingleDataPoint) { |
| 403 TestDeleteSingleDataPoint(); | 403 TestDeleteSingleDataPoint(); |
| 404 } | 404 } |
| 405 | 405 |
| 406 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteAllData) { | 406 TEST_F(ResourcePrefetchPredictorTablesReopenTest, DeleteAllData) { |
| 407 TestDeleteAllData(); | 407 TestDeleteAllData(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 } // namespace predictors | 410 } // namespace predictors |
| OLD | NEW |