Commit 6aef680e authored by Kyle Milka's avatar Kyle Milka Committed by Commit Bot

[NTP] Update background customization availability logging

On the local NTP we allow background customization even if
a theme is installed. Remove the logging for unavailablity
due to having a theme installed as it's no longer true.

Bug: None
Change-Id: Ib181fd959f5e321343789f692f18c1491b53ebbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575637Reviewed-by: default avatarGayane Petrosyan <gayane@chromium.org>
Commit-Queue: Kyle Milka <kmilka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652901}
parent b6cee043
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "chrome/browser/search/instant_service_factory.h" #include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/search/ntp_features.h" #include "chrome/browser/search/ntp_features.h"
#include "chrome/browser/search/search.h" #include "chrome/browser/search/search.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/search/ntp_user_data_types.h" #include "chrome/browser/ui/search/ntp_user_data_types.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h" #include "chrome/common/url_constants.h"
...@@ -487,11 +485,6 @@ bool NTPUserDataLogger::DefaultSearchProviderIsGoogle() const { ...@@ -487,11 +485,6 @@ bool NTPUserDataLogger::DefaultSearchProviderIsGoogle() const {
return search::DefaultSearchProviderIsGoogle(profile_); return search::DefaultSearchProviderIsGoogle(profile_);
} }
bool NTPUserDataLogger::ThemeIsConfigured() const {
ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile_);
return !theme_service->GetThemeID().empty();
}
bool NTPUserDataLogger::CustomBackgroundIsConfigured() const { bool NTPUserDataLogger::CustomBackgroundIsConfigured() const {
InstantService* instant_service = InstantService* instant_service =
InstantServiceFactory::GetForProfile(profile_); InstantServiceFactory::GetForProfile(profile_);
...@@ -543,7 +536,6 @@ void NTPUserDataLogger::EmitNtpStatistics(base::TimeDelta load_time) { ...@@ -543,7 +536,6 @@ void NTPUserDataLogger::EmitNtpStatistics(base::TimeDelta load_time) {
// since the page load started. That's unlikely enough to not warrant special // since the page load started. That's unlikely enough to not warrant special
// handling. // handling.
bool is_google = DefaultSearchProviderIsGoogle(); bool is_google = DefaultSearchProviderIsGoogle();
bool is_theme_configured = ThemeIsConfigured();
// Split between Web and Local. // Split between Web and Local.
if (ntp_url_.SchemeIsHTTPOrHTTPS()) { if (ntp_url_.SchemeIsHTTPOrHTTPS()) {
...@@ -584,9 +576,6 @@ void NTPUserDataLogger::EmitNtpStatistics(base::TimeDelta load_time) { ...@@ -584,9 +576,6 @@ void NTPUserDataLogger::EmitNtpStatistics(base::TimeDelta load_time) {
LogBackgroundCustomizationAvailability( LogBackgroundCustomizationAvailability(
BackgroundCustomization:: BackgroundCustomization::
BACKGROUND_CUSTOMIZATION_UNAVAILABLE_SEARCH_PROVIDER); BACKGROUND_CUSTOMIZATION_UNAVAILABLE_SEARCH_PROVIDER);
} else if (is_theme_configured) {
LogBackgroundCustomizationAvailability(
BackgroundCustomization::BACKGROUND_CUSTOMIZATION_UNAVAILABLE_THEME);
} else { } else {
LogBackgroundCustomizationAvailability( LogBackgroundCustomizationAvailability(
BackgroundCustomization::BACKGROUND_CUSTOMIZATION_AVAILABLE); BackgroundCustomization::BACKGROUND_CUSTOMIZATION_AVAILABLE);
......
...@@ -80,9 +80,6 @@ class NTPUserDataLogger ...@@ -80,9 +80,6 @@ class NTPUserDataLogger
// for testing. // for testing.
virtual bool DefaultSearchProviderIsGoogle() const; virtual bool DefaultSearchProviderIsGoogle() const;
// Returns whether a theme is configured. Virtual for testing.
virtual bool ThemeIsConfigured() const;
// Returns whether a custom background is configured. Virtual for testing. // Returns whether a custom background is configured. Virtual for testing.
virtual bool CustomBackgroundIsConfigured() const; virtual bool CustomBackgroundIsConfigured() const;
......
...@@ -65,14 +65,11 @@ class TestNTPUserDataLogger : public NTPUserDataLogger { ...@@ -65,14 +65,11 @@ class TestNTPUserDataLogger : public NTPUserDataLogger {
bool DefaultSearchProviderIsGoogle() const override { return is_google_; } bool DefaultSearchProviderIsGoogle() const override { return is_google_; }
bool ThemeIsConfigured() const override { return is_theme_configured_; }
bool CustomBackgroundIsConfigured() const override { bool CustomBackgroundIsConfigured() const override {
return is_custom_background_configured_; return is_custom_background_configured_;
} }
bool is_google_ = true; bool is_google_ = true;
bool is_theme_configured_ = false;
bool is_custom_background_configured_ = false; bool is_custom_background_configured_ = false;
}; };
...@@ -885,50 +882,6 @@ TEST_F(NTPUserDataLoggerTest, ShouldRecordImpressionsAge) { ...@@ -885,50 +882,6 @@ TEST_F(NTPUserDataLoggerTest, ShouldRecordImpressionsAge) {
/*count=*/1))); /*count=*/1)));
} }
TEST_F(NTPUserDataLoggerTest,
ShouldRecordCustomizationUnavailabilityWithTheme) {
base::HistogramTester histogram_tester;
TestNTPUserDataLogger logger((GURL(chrome::kChromeSearchLocalNtpUrl)));
logger.is_theme_configured_ = true;
base::TimeDelta delta_tiles_received = base::TimeDelta::FromMilliseconds(10);
base::TimeDelta delta_tiles_loaded = base::TimeDelta::FromMilliseconds(100);
// Send the ALL_TILES_RECEIVED event.
logger.LogEvent(NTP_ALL_TILES_RECEIVED, delta_tiles_received);
// Send the ALL_TILES_LOADED event, this should trigger emitting histograms.
logger.LogEvent(NTP_ALL_TILES_LOADED, delta_tiles_loaded);
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.LoadTime"), SizeIs(1));
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.LoadTime.LocalNTP"),
SizeIs(1));
EXPECT_THAT(
histogram_tester.GetAllSamples("NewTabPage.LoadTime.LocalNTP.Google"),
SizeIs(1));
EXPECT_THAT(
histogram_tester.GetAllSamples("NewTabPage.LoadTime.LocalNTP.Other"),
IsEmpty());
EXPECT_THAT(histogram_tester.GetAllSamples("NewTabPage.LoadTime.Web"),
IsEmpty());
histogram_tester.ExpectTimeBucketCount("NewTabPage.LoadTime",
delta_tiles_loaded, 1);
histogram_tester.ExpectTimeBucketCount("NewTabPage.LoadTime.LocalNTP",
delta_tiles_loaded, 1);
histogram_tester.ExpectTimeBucketCount("NewTabPage.LoadTime.LocalNTP.Google",
delta_tiles_loaded, 1);
EXPECT_THAT(
histogram_tester.GetAllSamples(
"NewTabPage.CustomizationAvailability.Backgrounds"),
ElementsAre(Bucket(
static_cast<int>(BackgroundCustomization::
BACKGROUND_CUSTOMIZATION_UNAVAILABLE_THEME),
1)));
}
TEST_F(NTPUserDataLoggerTest, ShouldRecordBackgroundCustomization) { TEST_F(NTPUserDataLoggerTest, ShouldRecordBackgroundCustomization) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment