From 783a337e036f3ea631819527370ef32fa9ab406c Mon Sep 17 00:00:00 2001 From: treib Date: Tue, 25 Aug 2015 09:24:39 -0700 Subject: [PATCH] Popular sites on the NTP: Extend UMA histograms that track clicks and impressions BUG=516618 Review URL: https://codereview.chromium.org/1302363002 Cr-Commit-Position: refs/heads/master@{#345346} --- chrome/browser/android/most_visited_sites.cc | 150 +++++++++++---------- chrome/browser/android/most_visited_sites.h | 34 +++-- .../browser/android/most_visited_sites_unittest.cc | 116 +++++++++------- tools/metrics/histograms/histograms.xml | 1 + 4 files changed, 166 insertions(+), 135 deletions(-) diff --git a/chrome/browser/android/most_visited_sites.cc b/chrome/browser/android/most_visited_sites.cc index f87c950c8fba..6c82bb37490e 100644 --- a/chrome/browser/android/most_visited_sites.cc +++ b/chrome/browser/android/most_visited_sites.cc @@ -59,22 +59,16 @@ const char kNumLocalThumbnailTilesHistogramName[] = "NewTabPage.NumberOfThumbnailTiles"; const char kNumEmptyTilesHistogramName[] = "NewTabPage.NumberOfGrayTiles"; const char kNumServerTilesHistogramName[] = "NewTabPage.NumberOfExternalTiles"; -// Client suggestion opened. -const char kOpenedItemClientHistogramName[] = "NewTabPage.MostVisited.client"; -// Server suggestion opened, no provider. -const char kOpenedItemServerHistogramName[] = "NewTabPage.MostVisited.server"; -// Server suggestion opened with provider. -const char kOpenedItemServerProviderHistogramFormat[] = - "NewTabPage.MostVisited.server%d"; -// Client impression. -const char kImpressionClientHistogramName[] = - "NewTabPage.SuggestionsImpression.client"; -// Server suggestion impression, no provider. -const char kImpressionServerHistogramName[] = - "NewTabPage.SuggestionsImpression.server"; -// Server suggestion impression with provider. -const char kImpressionServerHistogramFormat[] = - "NewTabPage.SuggestionsImpression.server%d"; + +// Format for tile clicks histogram. +const char kOpenedItemHistogramFormat[] = "NewTabPage.MostVisited.%s"; +// Format for tile impressions histogram. +const char kImpressionHistogramFormat[] = "NewTabPage.SuggestionsImpression.%s"; +// Identifiers for the various tile sources. +const char kHistogramClientName[] = "client"; +const char kHistogramServerName[] = "server"; +const char kHistogramServerFormat[] = "server%d"; +const char kHistogramPopularName[] = "popular"; const char kPopularSitesFieldTrialName[] = "NTPPopularSites"; @@ -92,7 +86,8 @@ scoped_ptr MaybeFetchLocalThumbnail( // Log an event for a given |histogram| at a given element |position|. This // routine exists because regular histogram macros are cached thus can't be used // if the name of the histogram will change at a given call site. -void LogHistogramEvent(const std::string& histogram, int position, +void LogHistogramEvent(const std::string& histogram, + int position, int num_sites) { base::HistogramBase* counter = base::LinearHistogram::FactoryGet( histogram, @@ -137,7 +132,8 @@ std::string GetPopularSitesFilename() { } // namespace MostVisitedSites::MostVisitedSites(Profile* profile) - : profile_(profile), num_sites_(0), initial_load_done_(false), + : profile_(profile), num_sites_(0), received_most_visited_sites_(false), + received_popular_sites_(false), recorded_uma_(false), num_local_thumbs_(0), num_server_thumbs_(0), num_empty_thumbs_(0), scoped_observer_(this), weak_ptr_factory_(this) { // Register the debugging page for the Suggestions Service and the thumbnails @@ -160,6 +156,8 @@ MostVisitedSites::MostVisitedSites(Profile* profile) profile_->GetRequestContext(), base::Bind(&MostVisitedSites::OnPopularSitesAvailable, base::Unretained(this)))); + } else { + received_popular_sites_ = true; } } @@ -175,7 +173,7 @@ void MostVisitedSites::Destroy(JNIEnv* env, jobject obj) { } void MostVisitedSites::OnLoadingComplete(JNIEnv* env, jobject obj) { - RecordUMAMetrics(); + RecordThumbnailUMAMetrics(); } void MostVisitedSites::SetMostVisitedURLsObserver(JNIEnv* env, @@ -292,25 +290,11 @@ void MostVisitedSites::BlacklistUrl(JNIEnv* env, void MostVisitedSites::RecordOpenedMostVisitedItem(JNIEnv* env, jobject obj, jint index) { - switch (mv_source_) { - case TOP_SITES: { - UMA_HISTOGRAM_SPARSE_SLOWLY(kOpenedItemClientHistogramName, index); - break; - } - case SUGGESTIONS_SERVICE: { - if (server_suggestions_.suggestions_size() > index) { - if (server_suggestions_.suggestions(index).providers_size()) { - std::string histogram = base::StringPrintf( - kOpenedItemServerProviderHistogramFormat, - server_suggestions_.suggestions(index).providers(0)); - LogHistogramEvent(histogram, index, num_sites_); - } else { - UMA_HISTOGRAM_SPARSE_SLOWLY(kOpenedItemServerHistogramName, index); - } - } - break; - } - } + DCHECK_GE(index, 0); + DCHECK_LT(index, static_cast(tile_sources_.size())); + std::string histogram = base::StringPrintf(kOpenedItemHistogramFormat, + tile_sources_[index].c_str()); + LogHistogramEvent(histogram, index, num_sites_); } void MostVisitedSites::OnStateChanged() { @@ -354,6 +338,7 @@ void MostVisitedSites::OnMostVisitedURLsAvailable( const history::MostVisitedURLList& visited_list) { std::vector titles; std::vector urls; + tile_sources_.clear(); int num_tiles = std::min(static_cast(visited_list.size()), num_sites_); for (int i = 0; i < num_tiles; ++i) { const history::MostVisitedURL& visited = visited_list[i]; @@ -363,14 +348,10 @@ void MostVisitedSites::OnMostVisitedURLsAvailable( } titles.push_back(visited.title); urls.push_back(visited.url.spec()); + tile_sources_.push_back(kHistogramClientName); } - // Only log impression metrics on the initial load of the NTP. - if (!initial_load_done_) { - for (int i = 0; i < num_tiles; ++i) { - UMA_HISTOGRAM_SPARSE_SLOWLY(kImpressionClientHistogramName, i); - } - } + received_most_visited_sites_ = true; mv_source_ = TOP_SITES; AddPopularSites(&titles, &urls); NotifyMostVisitedURLsObserver(titles, urls); @@ -389,84 +370,89 @@ void MostVisitedSites::OnSuggestionsProfileAvailable( std::vector titles; std::vector urls; + tile_sources_.clear(); for (int i = 0; i < num_tiles; ++i) { const ChromeSuggestion& suggestion = suggestions_profile.suggestions(i); titles.push_back(base::UTF8ToUTF16(suggestion.title())); urls.push_back(suggestion.url()); - // Only log impression metrics on the initial NTP load. - if (!initial_load_done_) { - if (suggestion.providers_size()) { - std::string histogram = base::StringPrintf( - kImpressionServerHistogramFormat, suggestion.providers(0)); - LogHistogramEvent(histogram, i, num_sites_); - } else { - UMA_HISTOGRAM_SPARSE_SLOWLY(kImpressionServerHistogramName, i); - } + std::string tile_source; + if (suggestion.providers_size() > 0) { + tile_source = + base::StringPrintf(kHistogramServerFormat, suggestion.providers(0)); + } else { + tile_source = kHistogramServerName; } + tile_sources_.push_back(tile_source); } + + received_most_visited_sites_ = true; mv_source_ = SUGGESTIONS_SERVICE; - // Keep a copy of the suggestions for eventual logging. - server_suggestions_ = suggestions_profile; AddPopularSites(&titles, &urls); NotifyMostVisitedURLsObserver(titles, urls); } void MostVisitedSites::AddPopularSites(std::vector* titles, - std::vector* urls) const { + std::vector* urls) { if (!popular_sites_) return; DCHECK_EQ(titles->size(), urls->size()); + DCHECK_EQ(titles->size(), tile_sources_.size()); DCHECK_LE(static_cast(titles->size()), num_sites_); // Collect all non-blacklisted popular suggestions. - std::vector new_titles; - std::vector new_urls; + std::vector popular_titles; + std::vector popular_urls; scoped_refptr top_sites(TopSitesFactory::GetForProfile(profile_)); for (const PopularSites::Site& popular_site : popular_sites_->sites()) { // Skip blacklisted sites. if (top_sites && top_sites->IsBlacklisted(popular_site.url)) continue; - new_titles.push_back(popular_site.title); - new_urls.push_back(popular_site.url.spec()); - if (static_cast(new_titles.size()) >= num_sites_) + popular_titles.push_back(popular_site.title); + popular_urls.push_back(popular_site.url.spec()); + if (static_cast(popular_titles.size()) >= num_sites_) break; } - AddPopularSitesImpl(num_sites_, titles, urls, new_titles, new_urls); + AddPopularSitesImpl( + num_sites_, popular_titles, popular_urls, titles, urls, &tile_sources_); } // static void MostVisitedSites::AddPopularSitesImpl( int num_sites, + const std::vector& popular_titles, + const std::vector& popular_urls, std::vector* titles, std::vector* urls, - const std::vector& popular_titles, - const std::vector& popular_urls) { + std::vector* tile_sources) { // Start off with the popular suggestions. std::vector new_titles(popular_titles); std::vector new_urls(popular_urls); + std::vector new_tile_sources(new_titles.size(), + kHistogramPopularName); // Now, go over the personalized suggestions and replace matching popular // suggestions. This is so that when some of the popular suggestions become // personal, they retain their absolute positions. - std::vector new_is_personalized(new_titles.size(), false); std::vector titles_to_insert; std::vector urls_to_insert; + std::vector tile_sources_to_insert; for (size_t site_index = 0; site_index < titles->size(); site_index++) { const base::string16& title = (*titles)[site_index]; const std::string& url = (*urls)[site_index]; + const std::string& tile_source = (*tile_sources)[site_index]; // See if we already have a matching popular site. bool found = false; for (size_t i = 0; i < new_urls.size(); i++) { - if (!new_is_personalized[i] && + if (new_tile_sources[i] == kHistogramPopularName && GURL(new_urls[i]).host() == GURL(url).host()) { // We have a matching popular sites suggestion. Replace it with the // actual URL and title. new_titles[i] = title; new_urls[i] = url; - new_is_personalized[i] = true; + new_tile_sources[i] = tile_source; found = true; break; } @@ -474,6 +460,7 @@ void MostVisitedSites::AddPopularSitesImpl( if (!found) { titles_to_insert.push_back(title); urls_to_insert.push_back(url); + tile_sources_to_insert.push_back(tile_source); } } @@ -487,7 +474,9 @@ void MostVisitedSites::AddPopularSitesImpl( new_urls.insert(new_urls.end(), urls_to_insert.end() - num_to_append, urls_to_insert.end()); - new_is_personalized.insert(new_is_personalized.end(), num_to_append, true); + new_tile_sources.insert(new_tile_sources.end(), + tile_sources_to_insert.end() - num_to_append, + tile_sources_to_insert.end()); // Finally, go over the remaining personalized suggestions and evict popular // suggestions to accommodate them. Do it in reverse order, so the least @@ -495,12 +484,13 @@ void MostVisitedSites::AddPopularSitesImpl( for (size_t i = titles_to_insert.size() - num_to_append; i > 0; --i) { const base::string16& title = titles_to_insert[i - 1]; const std::string& url = urls_to_insert[i - 1]; + const std::string& tile_source = tile_sources_to_insert[i - 1]; for (size_t insert_i = new_titles.size(); insert_i > 0; --insert_i) { size_t insert_index = insert_i - 1; - if (!new_is_personalized[insert_index]) { + if (new_tile_sources[insert_index] == kHistogramPopularName) { new_titles[insert_index] = title; new_urls[insert_index] = url; - new_is_personalized[insert_index] = true; + new_tile_sources[insert_index] = tile_source; break; } } @@ -508,15 +498,19 @@ void MostVisitedSites::AddPopularSitesImpl( titles->swap(new_titles); urls->swap(new_urls); + tile_sources->swap(new_tile_sources); } void MostVisitedSites::NotifyMostVisitedURLsObserver( const std::vector& titles, const std::vector& urls) { DCHECK_EQ(titles.size(), urls.size()); - if (!initial_load_done_) + if (received_most_visited_sites_ && received_popular_sites_ && + !recorded_uma_) { + RecordImpressionUMAMetrics(); UMA_HISTOGRAM_SPARSE_SLOWLY(kNumTilesHistogramName, titles.size()); - initial_load_done_ = true; + recorded_uma_ = true; + } JNIEnv* env = AttachCurrentThread(); Java_MostVisitedURLsObserver_onMostVisitedURLsAvailable( env, observer_.obj(), ToJavaArrayOfStrings(env, titles).obj(), @@ -524,6 +518,8 @@ void MostVisitedSites::NotifyMostVisitedURLsObserver( } void MostVisitedSites::OnPopularSitesAvailable(bool success) { + received_popular_sites_ = true; + if (!success) { LOG(WARNING) << "Download of popular sites failed"; return; @@ -546,7 +542,7 @@ void MostVisitedSites::OnPopularSitesAvailable(bool success) { QueryMostVisitedURLs(); } -void MostVisitedSites::RecordUMAMetrics() { +void MostVisitedSites::RecordThumbnailUMAMetrics() { UMA_HISTOGRAM_SPARSE_SLOWLY(kNumLocalThumbnailTilesHistogramName, num_local_thumbs_); num_local_thumbs_ = 0; @@ -556,6 +552,14 @@ void MostVisitedSites::RecordUMAMetrics() { num_server_thumbs_ = 0; } +void MostVisitedSites::RecordImpressionUMAMetrics() { + for (size_t i = 0; i < tile_sources_.size(); i++) { + std::string histogram = base::StringPrintf(kImpressionHistogramFormat, + tile_sources_[i].c_str()); + LogHistogramEvent(histogram, static_cast(i), num_sites_); + } +} + void MostVisitedSites::TopSitesLoaded(history::TopSites* top_sites) { } diff --git a/chrome/browser/android/most_visited_sites.h b/chrome/browser/android/most_visited_sites.h index e378e8501bb8..4ecc9676c53e 100644 --- a/chrome/browser/android/most_visited_sites.h +++ b/chrome/browser/android/most_visited_sites.h @@ -79,18 +79,19 @@ class MostVisitedSites : public sync_driver::SyncServiceObserver, // Adds the suggestions from |popular_sites_| into |titles| and |urls|. This // might reorder |titles| and |urls| to retain the absolute positions of the - // popular suggestions. + // popular suggestions. Also updates |tile_sources_| accordingly. void AddPopularSites(std::vector* titles, - std::vector* urls) const; + std::vector* urls); // Workhorse for AddPopularSites above. Implemented as a separate static // method for ease of testing. static void AddPopularSitesImpl( int num_sites, + const std::vector& popular_titles, + const std::vector& popular_urls, std::vector* titles, std::vector* urls, - const std::vector& popular_titles, - const std::vector& popular_urls); + std::vector* tile_sources); // Notify the Java side observer about the availability of Most Visited Urls. void NotifyMostVisitedURLsObserver(const std::vector& titles, @@ -112,8 +113,11 @@ class MostVisitedSites : public sync_driver::SyncServiceObserver, const GURL& url, const SkBitmap* bitmap); - // Records specific UMA histogram metrics. - void RecordUMAMetrics(); + // Records thumbnail-related UMA histogram metrics. + void RecordThumbnailUMAMetrics(); + + // Records UMA histogram metrics related to the number of impressions. + void RecordImpressionUMAMetrics(); // history::TopSitesObserver implementation. void TopSitesLoaded(history::TopSites* top_sites) override; @@ -129,8 +133,17 @@ class MostVisitedSites : public sync_driver::SyncServiceObserver, // The maximum number of most visited sites to return. int num_sites_; - // Keeps track of whether the initial NTP load has been done. - bool initial_load_done_; + // Whether we have received an initial set of most visited sites (from either + // TopSites or the SuggestionsService). + bool received_most_visited_sites_; + + // Whether we have received the set of popular sites. Immediately set to true + // if popular sites are disabled. + bool received_popular_sites_; + + // Whether we have recorded one-shot UMA metrics such as impressions. They are + // recorded once both the previous flags are true. + bool recorded_uma_; // Counters for UMA metrics. @@ -142,8 +155,9 @@ class MostVisitedSites : public sync_driver::SyncServiceObserver, // In this case a gray tile is used as the main tile. int num_empty_thumbs_; - // Copy of the server suggestions (if enabled). Used for logging. - suggestions::SuggestionsProfile server_suggestions_; + // Identifier for where each tile came from (client, server, popular). Used + // for logging. + std::vector tile_sources_; ScopedObserver scoped_observer_; diff --git a/chrome/browser/android/most_visited_sites_unittest.cc b/chrome/browser/android/most_visited_sites_unittest.cc index f95918a33084..f2dc351c6734 100644 --- a/chrome/browser/android/most_visited_sites_unittest.cc +++ b/chrome/browser/android/most_visited_sites_unittest.cc @@ -12,11 +12,14 @@ namespace { struct TitleURL { - TitleURL(const std::string& title, const std::string& url) - : title(base::UTF8ToUTF16(title)), url(url) {} + TitleURL(const std::string& title, + const std::string& url, + const std::string& source) + : title(base::UTF8ToUTF16(title)), url(url), source(source) {} base::string16 title; std::string url; + std::string source; }; std::vector GetTitles(const std::vector& data) { @@ -33,6 +36,13 @@ std::vector GetURLs(const std::vector& data) { return urls; } +std::vector GetSources(const std::vector& data) { + std::vector sources; + for (const TitleURL& item : data) + sources.push_back(item.source); + return sources; +} + static const int kNumSites = 4; } // namespace @@ -44,34 +54,36 @@ class MostVisitedSitesTest : public testing::Test { const std::vector& expected) { std::vector titles(GetTitles(personal)); std::vector urls(GetURLs(personal)); + std::vector sources(GetSources(personal)); std::vector popular_titles(GetTitles(popular)); std::vector popular_urls(GetURLs(popular)); MostVisitedSites::AddPopularSitesImpl( - kNumSites, &titles, &urls, popular_titles, popular_urls); + kNumSites, popular_titles, popular_urls, &titles, &urls, &sources); EXPECT_EQ(GetTitles(expected), titles); EXPECT_EQ(GetURLs(expected), urls); + EXPECT_EQ(GetSources(expected), sources); } }; TEST_F(MostVisitedSitesTest, PopularSitesAppend) { TitleURL popular[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), }; TitleURL personal[] = { - TitleURL("Site 3", "https://www.site3.com/"), - TitleURL("Site 4", "https://www.site4.com/"), + TitleURL("Site 3", "https://www.site3.com/", "server8"), + TitleURL("Site 4", "https://www.site4.com/", "server8"), }; // Popular suggestions should keep their positions, with personal suggestions // appended at the end. TitleURL expected[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 3", "https://www.site3.com/"), - TitleURL("Site 4", "https://www.site4.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), + TitleURL("Site 3", "https://www.site3.com/", "server8"), + TitleURL("Site 4", "https://www.site4.com/", "server8"), }; Check(std::vector(popular, popular + arraysize(popular)), @@ -81,22 +93,22 @@ TEST_F(MostVisitedSitesTest, PopularSitesAppend) { TEST_F(MostVisitedSitesTest, PopularSitesOverflow) { TitleURL popular[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 3", "https://www.site3.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), + TitleURL("Site 3", "https://www.site3.com/", "popular"), }; TitleURL personal[] = { - TitleURL("Site 4", "https://www.site4.com/"), - TitleURL("Site 5", "https://www.site5.com/"), + TitleURL("Site 4", "https://www.site4.com/", "server8"), + TitleURL("Site 5", "https://www.site5.com/", "server8"), }; // When there are more total suggestions than slots, the personal suggestions // should win, with the remaining popular suggestions still retaining their // positions. TitleURL expected[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 4", "https://www.site4.com/"), - TitleURL("Site 5", "https://www.site5.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), + TitleURL("Site 4", "https://www.site4.com/", "server8"), + TitleURL("Site 5", "https://www.site5.com/", "server8"), }; Check(std::vector(popular, popular + arraysize(popular)), @@ -106,19 +118,19 @@ TEST_F(MostVisitedSitesTest, PopularSitesOverflow) { TEST_F(MostVisitedSitesTest, PopularSitesOverwrite) { TitleURL popular[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 3", "https://www.site3.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), + TitleURL("Site 3", "https://www.site3.com/", "popular"), }; TitleURL personal[] = { - TitleURL("Site 2 subpage", "https://www.site2.com/path"), + TitleURL("Site 2 subpage", "https://www.site2.com/path", "server8"), }; // When a personal suggestions matches the host of a popular one, it should // overwrite that suggestion (in its original position). TitleURL expected[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2 subpage", "https://www.site2.com/path"), - TitleURL("Site 3", "https://www.site3.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2 subpage", "https://www.site2.com/path", "server8"), + TitleURL("Site 3", "https://www.site3.com/", "popular"), }; Check(std::vector(popular, popular + arraysize(popular)), @@ -128,24 +140,24 @@ TEST_F(MostVisitedSitesTest, PopularSitesOverwrite) { TEST_F(MostVisitedSitesTest, PopularSitesOrdering) { TitleURL popular[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 3", "https://www.site3.com/"), - TitleURL("Site 4", "https://www.site4.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), + TitleURL("Site 3", "https://www.site3.com/", "popular"), + TitleURL("Site 4", "https://www.site4.com/", "popular"), }; TitleURL personal[] = { - TitleURL("Site 3", "https://www.site3.com/"), - TitleURL("Site 4", "https://www.site4.com/"), - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), + TitleURL("Site 3", "https://www.site3.com/", "server8"), + TitleURL("Site 4", "https://www.site4.com/", "server8"), + TitleURL("Site 1", "https://www.site1.com/", "server8"), + TitleURL("Site 2", "https://www.site2.com/", "server8"), }; - // The order of the popular sites should win (since presumably they were - // there first). + // The personal sites should replace the popular ones, but the order of the + // popular sites should win (since presumably they were there first). TitleURL expected[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 3", "https://www.site3.com/"), - TitleURL("Site 4", "https://www.site4.com/"), + TitleURL("Site 1", "https://www.site1.com/", "server8"), + TitleURL("Site 2", "https://www.site2.com/", "server8"), + TitleURL("Site 3", "https://www.site3.com/", "server8"), + TitleURL("Site 4", "https://www.site4.com/", "server8"), }; Check(std::vector(popular, popular + arraysize(popular)), @@ -155,24 +167,24 @@ TEST_F(MostVisitedSitesTest, PopularSitesOrdering) { TEST_F(MostVisitedSitesTest, PopularSitesComplex) { TitleURL popular[] = { - TitleURL("Site 1", "https://www.site1.com/"), - TitleURL("Site 2", "https://www.site2.com/"), - TitleURL("Site 3", "https://www.site3.com/"), + TitleURL("Site 1", "https://www.site1.com/", "popular"), + TitleURL("Site 2", "https://www.site2.com/", "popular"), + TitleURL("Site 3", "https://www.site3.com/", "popular"), }; TitleURL personal[] = { - TitleURL("Site 3 subpage", "https://www.site3.com/path"), - TitleURL("Site 1 subpage", "https://www.site1.com/path"), - TitleURL("Site 5", "https://www.site5.com/"), - TitleURL("Site 6", "https://www.site6.com/"), + TitleURL("Site 3 subpage", "https://www.site3.com/path", "server8"), + TitleURL("Site 1 subpage", "https://www.site1.com/path", "server8"), + TitleURL("Site 5", "https://www.site5.com/", "server8"), + TitleURL("Site 6", "https://www.site6.com/", "server8"), }; // Combination of behaviors: Personal suggestions replace matching popular // ones while keeping the position of the popular suggestion. Remaining // personal suggestions evict popular ones and retain their relative order. TitleURL expected[] = { - TitleURL("Site 1 subpage", "https://www.site1.com/path"), - TitleURL("Site 5", "https://www.site5.com/"), - TitleURL("Site 3 subpage", "https://www.site3.com/path"), - TitleURL("Site 6", "https://www.site6.com/"), + TitleURL("Site 1 subpage", "https://www.site1.com/path", "server8"), + TitleURL("Site 5", "https://www.site5.com/", "server8"), + TitleURL("Site 3 subpage", "https://www.site3.com/path", "server8"), + TitleURL("Site 6", "https://www.site6.com/", "server8"), }; Check(std::vector(popular, popular + arraysize(popular)), diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 3fa82b1acb5b..baf2f219f17f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -76569,6 +76569,7 @@ To add a new entry, add it with any value and run test to compute valid value. + -- 2.11.4.GIT