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

Unified Diff: chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
diff --git a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
index d39e892a0cd5579cc660dcb993127fea547119bd..fa5be14e635bd58c29f14f8a98a93bb15dc07f5f 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor_tables_unittest.cc
@@ -167,34 +167,45 @@ void ResourcePrefetchPredictorTablesTest::TestDeleteSingleDataPoint() {
void ResourcePrefetchPredictorTablesTest::TestUpdateData() {
PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com");
google.last_visit = base::Time::FromInternalValue(10);
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/style.css",
- ResourceType::STYLESHEET,
- 6, 2, 0, 1.0));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/image.png",
- ResourceType::IMAGE,
- 6, 4, 1, 4.2));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/a.xml",
- ResourceType::LAST_TYPE,
- 1, 0, 0, 6.1));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.resources.google.com/script.js",
- ResourceType::SCRIPT,
- 12, 0, 0, 8.5));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/style.css",
+ ResourceType::STYLESHEET,
+ 6,
+ 2,
+ 0,
+ 1.0));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/image.png",
+ ResourceType::IMAGE,
+ 6,
+ 4,
+ 1,
+ 4.2));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/a.xml",
+ ResourceType::LAST_TYPE,
+ 1,
+ 0,
+ 0,
+ 6.1));
+ google.resources
+ .push_back(ResourceRow(std::string(),
+ "http://www.resources.google.com/script.js",
+ ResourceType::SCRIPT,
+ 12,
+ 0,
+ 0,
+ 8.5));
PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com");
yahoo.last_visit = base::Time::FromInternalValue(7);
- yahoo.resources.push_back(ResourceRow(
- "",
- "http://www.yahoo.com/image.png",
- ResourceType::IMAGE,
- 120, 1, 1, 10.0));
+ yahoo.resources.push_back(ResourceRow(std::string(),
+ "http://www.yahoo.com/image.png",
+ ResourceType::IMAGE,
+ 120,
+ 1,
+ 1,
+ 10.0));
tables_->UpdateData(google, yahoo);
@@ -276,59 +287,78 @@ void ResourcePrefetchPredictorTablesTest::InitializeSampleData() {
{ // Url data.
PrefetchData google(PREFETCH_KEY_TYPE_URL, "http://www.google.com");
google.last_visit = base::Time::FromInternalValue(1);
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/style.css",
- ResourceType::STYLESHEET,
- 5, 2, 1, 1.1));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/script.js",
- ResourceType::SCRIPT,
- 4, 0, 1, 2.1));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/image.png",
- ResourceType::IMAGE,
- 6, 3, 0, 2.2));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/a.font",
- ResourceType::LAST_TYPE,
- 2, 0, 0, 5.1));
- google.resources.push_back(ResourceRow(
- "",
- "http://www.resources.google.com/script.js",
- ResourceType::SCRIPT,
- 11, 0, 0, 8.5));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/style.css",
+ ResourceType::STYLESHEET,
+ 5,
+ 2,
+ 1,
+ 1.1));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/script.js",
+ ResourceType::SCRIPT,
+ 4,
+ 0,
+ 1,
+ 2.1));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/image.png",
+ ResourceType::IMAGE,
+ 6,
+ 3,
+ 0,
+ 2.2));
+ google.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/a.font",
+ ResourceType::LAST_TYPE,
+ 2,
+ 0,
+ 0,
+ 5.1));
+ google.resources
+ .push_back(ResourceRow(std::string(),
+ "http://www.resources.google.com/script.js",
+ ResourceType::SCRIPT,
+ 11,
+ 0,
+ 0,
+ 8.5));
PrefetchData reddit(PREFETCH_KEY_TYPE_URL, "http://www.reddit.com");
reddit.last_visit = base::Time::FromInternalValue(2);
- reddit.resources.push_back(ResourceRow(
- "",
- "http://reddit-resource.com/script1.js",
- ResourceType::SCRIPT,
- 4, 0, 1, 1.0));
- reddit.resources.push_back(ResourceRow(
- "",
- "http://reddit-resource.com/script2.js",
- ResourceType::SCRIPT,
- 2, 0, 0, 2.1));
+ reddit.resources
+ .push_back(ResourceRow(std::string(),
+ "http://reddit-resource.com/script1.js",
+ ResourceType::SCRIPT,
+ 4,
+ 0,
+ 1,
+ 1.0));
+ reddit.resources
+ .push_back(ResourceRow(std::string(),
+ "http://reddit-resource.com/script2.js",
+ ResourceType::SCRIPT,
+ 2,
+ 0,
+ 0,
+ 2.1));
PrefetchData yahoo(PREFETCH_KEY_TYPE_URL, "http://www.yahoo.com");
yahoo.last_visit = base::Time::FromInternalValue(3);
- yahoo.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/image.png",
- ResourceType::IMAGE,
- 20, 1, 0, 10.0));
+ yahoo.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/image.png",
+ ResourceType::IMAGE,
+ 20,
+ 1,
+ 0,
+ 10.0));
test_url_data_.clear();
test_url_data_.insert(std::make_pair("http://www.google.com", google));
test_url_data_.insert(std::make_pair("http://www.reddit.com", reddit));
test_url_data_.insert(std::make_pair("http://www.yahoo.com", yahoo));
- PrefetchData empty_host_data(PREFETCH_KEY_TYPE_HOST, "");
+ PrefetchData empty_host_data(PREFETCH_KEY_TYPE_HOST, std::string());
tables_->UpdateData(google, empty_host_data);
tables_->UpdateData(reddit, empty_host_data);
tables_->UpdateData(yahoo, empty_host_data);
@@ -337,45 +367,61 @@ void ResourcePrefetchPredictorTablesTest::InitializeSampleData() {
{ // Host data.
PrefetchData facebook(PREFETCH_KEY_TYPE_HOST, "www.facebook.com");
facebook.last_visit = base::Time::FromInternalValue(4);
- facebook.resources.push_back(ResourceRow(
- "",
- "http://www.facebook.com/style.css",
- ResourceType::STYLESHEET,
- 5, 2, 1, 1.1));
- facebook.resources.push_back(ResourceRow(
- "",
- "http://www.facebook.com/script.js",
- ResourceType::SCRIPT,
- 4, 0, 1, 2.1));
- facebook.resources.push_back(ResourceRow(
- "",
- "http://www.facebook.com/image.png",
- ResourceType::IMAGE,
- 6, 3, 0, 2.2));
- facebook.resources.push_back(ResourceRow(
- "",
- "http://www.facebook.com/a.font",
- ResourceType::LAST_TYPE,
- 2, 0, 0, 5.1));
- facebook.resources.push_back(ResourceRow(
- "",
- "http://www.resources.facebook.com/script.js",
- ResourceType::SCRIPT,
- 11, 0, 0, 8.5));
+ facebook.resources
+ .push_back(ResourceRow(std::string(),
+ "http://www.facebook.com/style.css",
+ ResourceType::STYLESHEET,
+ 5,
+ 2,
+ 1,
+ 1.1));
+ facebook.resources
+ .push_back(ResourceRow(std::string(),
+ "http://www.facebook.com/script.js",
+ ResourceType::SCRIPT,
+ 4,
+ 0,
+ 1,
+ 2.1));
+ facebook.resources
+ .push_back(ResourceRow(std::string(),
+ "http://www.facebook.com/image.png",
+ ResourceType::IMAGE,
+ 6,
+ 3,
+ 0,
+ 2.2));
+ facebook.resources.push_back(ResourceRow(std::string(),
+ "http://www.facebook.com/a.font",
+ ResourceType::LAST_TYPE,
+ 2,
+ 0,
+ 0,
+ 5.1));
+ facebook.resources
+ .push_back(ResourceRow(std::string(),
+ "http://www.resources.facebook.com/script.js",
+ ResourceType::SCRIPT,
+ 11,
+ 0,
+ 0,
+ 8.5));
PrefetchData yahoo(PREFETCH_KEY_TYPE_HOST, "www.yahoo.com");
yahoo.last_visit = base::Time::FromInternalValue(5);
- yahoo.resources.push_back(ResourceRow(
- "",
- "http://www.google.com/image.png",
- ResourceType::IMAGE,
- 20, 1, 0, 10.0));
+ yahoo.resources.push_back(ResourceRow(std::string(),
+ "http://www.google.com/image.png",
+ ResourceType::IMAGE,
+ 20,
+ 1,
+ 0,
+ 10.0));
test_host_data_.clear();
test_host_data_.insert(std::make_pair("www.facebook.com", facebook));
test_host_data_.insert(std::make_pair("www.yahoo.com", yahoo));
- PrefetchData empty_url_data(PREFETCH_KEY_TYPE_URL, "");
+ PrefetchData empty_url_data(PREFETCH_KEY_TYPE_URL, std::string());
tables_->UpdateData(empty_url_data, facebook);
tables_->UpdateData(empty_url_data, yahoo);
}

Powered by Google App Engine
This is Rietveld 408576698