summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorisherman <isherman@chromium.org>2015-09-15 10:41:11 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-15 17:41:49 +0000
commitfb441084a631df8c3681b74154f159e0303f409f (patch)
tree0792a247d110a2b7168c6472b06641129016200d
parenta5085cda2c9f25c34eec39759f67d79e3bfe7d2e (diff)
downloadchromium_src-fb441084a631df8c3681b74154f159e0303f409f.zip
chromium_src-fb441084a631df8c3681b74154f159e0303f409f.tar.gz
chromium_src-fb441084a631df8c3681b74154f159e0303f409f.tar.bz2
[Cleanup] Remove the no longer used GoogleSearch.AccessPoint metric.
This metric has a bug in its implementation. Since there don't seem to be any clients relying on this metric, it's time to just remove it and the supporting code. BUG=421631 TEST=none R=kmadhusu@chromium.org Review URL: https://codereview.chromium.org/1320553002 Cr-Commit-Position: refs/heads/master@{#348924}
-rw-r--r--chrome/browser/chrome_browser_main.cc2
-rw-r--r--chrome/browser/chrome_browser_main_android.cc9
-rw-r--r--chrome/browser/chrome_browser_main_android.h3
-rw-r--r--chrome/browser/google/google_search_counter.cc100
-rw-r--r--chrome/browser/google/google_search_counter.h72
-rw-r--r--chrome/browser/google/google_search_counter_android.cc54
-rw-r--r--chrome/browser/google/google_search_counter_android.h39
-rw-r--r--chrome/browser/google/google_search_counter_android_unittest.cc179
-rw-r--r--chrome/browser/google/google_search_counter_unittest.cc149
-rw-r--r--chrome/chrome_browser.gypi4
-rw-r--r--chrome/chrome_tests_unit.gypi2
-rw-r--r--components/google.gypi2
-rw-r--r--components/google/core/browser/BUILD.gn2
-rw-r--r--components/google/core/browser/google_search_metrics.cc34
-rw-r--r--components/google/core/browser/google_search_metrics.h45
-rw-r--r--tools/metrics/histograms/histograms.xml3
16 files changed, 5 insertions, 694 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index d07d0d1..bc66fe7 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -57,7 +57,6 @@
#include "chrome/browser/defaults.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/first_run/upgrade_util.h"
-#include "chrome/browser/google/google_search_counter.h"
#include "chrome/browser/gpu/gl_string_manager.h"
#include "chrome/browser/gpu/three_d_api_observer.h"
#include "chrome/browser/media/media_capture_devices_dispatcher.h"
@@ -1540,7 +1539,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// This can't be created in the BrowserProcessImpl constructor because it
// needs to read prefs that get set after that runs.
browser_process_->intranet_redirect_detector();
- GoogleSearchCounter::RegisterForNotifications();
#if defined(ENABLE_PRINT_PREVIEW) && !defined(OFFICIAL_BUILD)
if (parsed_command_line().HasSwitch(switches::kDebugPrint)) {
diff --git a/chrome/browser/chrome_browser_main_android.cc b/chrome/browser/chrome_browser_main_android.cc
index c25fabc..659ea40 100644
--- a/chrome/browser/chrome_browser_main_android.cc
+++ b/chrome/browser/chrome_browser_main_android.cc
@@ -12,7 +12,6 @@
#include "base/trace_event/trace_event.h"
#include "chrome/browser/android/chrome_media_client_android.h"
#include "chrome/browser/android/seccomp_support_detector.h"
-#include "chrome/browser/google/google_search_counter_android.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -82,20 +81,16 @@ int ChromeBrowserMainPartsAndroid::PreCreateThreads() {
}
void ChromeBrowserMainPartsAndroid::PostProfileInit() {
- Profile* main_profile = profile();
- search_counter_.reset(new GoogleSearchCounterAndroid(main_profile));
-
ChromeBrowserMainParts::PostProfileInit();
// Previously we stored information related to salient images for bookmarks
// in a local file. We replaced the salient images with favicons. As part
// of the clean up, the local file needs to be deleted. See crbug.com/499415.
- base::FilePath bookmark_image_file_path = main_profile->GetPath().Append(
+ base::FilePath bookmark_image_file_path = profile()->GetPath().Append(
PersistentImageStore::kBookmarkImageStoreDb);
content::BrowserThread::PostDelayedTask(
content::BrowserThread::FILE, FROM_HERE,
- base::Bind(&DeleteFileTask,
- bookmark_image_file_path),
+ base::Bind(&DeleteFileTask, bookmark_image_file_path),
base::TimeDelta::FromMinutes(1));
}
diff --git a/chrome/browser/chrome_browser_main_android.h b/chrome/browser/chrome_browser_main_android.h
index a20f090..6facf02 100644
--- a/chrome/browser/chrome_browser_main_android.h
+++ b/chrome/browser/chrome_browser_main_android.h
@@ -7,8 +7,6 @@
#include "chrome/browser/chrome_browser_main.h"
-class GoogleSearchCounterAndroid;
-
namespace breakpad {
class CrashDumpManager;
}
@@ -32,7 +30,6 @@ class ChromeBrowserMainPartsAndroid : public ChromeBrowserMainParts {
private:
scoped_ptr<base::MessageLoop> main_message_loop_;
scoped_ptr<breakpad::CrashDumpManager> crash_dump_manager_;
- scoped_ptr<GoogleSearchCounterAndroid> search_counter_;
DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainPartsAndroid);
};
diff --git a/chrome/browser/google/google_search_counter.cc b/chrome/browser/google/google_search_counter.cc
deleted file mode 100644
index 46392fd..0000000
--- a/chrome/browser/google/google_search_counter.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/google/google_search_counter.h"
-
-#include "base/logging.h"
-#include "components/google/core/browser/google_util.h"
-#include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/navigation_details.h"
-#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
-
-// static
-void GoogleSearchCounter::RegisterForNotifications() {
- GoogleSearchCounter::GetInstance()->RegisterForNotificationsInternal();
-}
-
-// static
-GoogleSearchCounter* GoogleSearchCounter::GetInstance() {
- return base::Singleton<GoogleSearchCounter>::get();
-}
-
-GoogleSearchMetrics::AccessPoint
-GoogleSearchCounter::GetGoogleSearchAccessPointForSearchNavEntry(
- const content::NavigationEntry& entry) const {
- DCHECK(google_util::IsGoogleSearchUrl(entry.GetURL()));
-
- // If the |entry| is FROM_ADDRESS_BAR, it comes from the omnibox; if it's
- // GENERATED, the user was doing a search, rather than doing a navigation to a
- // search URL (e.g. from hisotry, or pasted in).
- if (entry.GetTransitionType() == (ui::PAGE_TRANSITION_GENERATED |
- ui::PAGE_TRANSITION_FROM_ADDRESS_BAR)) {
- return GoogleSearchMetrics::AP_OMNIBOX;
- }
-
- // The string "source=search_app" in the |entry| URL represents a Google
- // search from the Google Search App.
- if (entry.GetURL().query().find("source=search_app") != std::string::npos)
- return GoogleSearchMetrics::AP_SEARCH_APP;
-
- // For all other cases that we have not yet implemented or care to measure, we
- // log a generic "catch-all" metric.
- return GoogleSearchMetrics::AP_OTHER;
-}
-
-bool GoogleSearchCounter::ShouldRecordCommittedDetails(
- const content::NotificationDetails& details) const {
- const content::LoadCommittedDetails* commit =
- content::Details<content::LoadCommittedDetails>(details).ptr();
- return google_util::IsGoogleSearchUrl(commit->entry->GetURL());
-}
-
-GoogleSearchCounter::GoogleSearchCounter()
- : search_metrics_(new GoogleSearchMetrics) {
-}
-
-GoogleSearchCounter::~GoogleSearchCounter() {
-}
-
-void GoogleSearchCounter::ProcessCommittedEntry(
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- // Note that GoogleSearchMetrics logs metrics through UMA, which will only
- // transmit these counts to the server if the user has opted into sending
- // usage stats.
- const content::LoadCommittedDetails* commit =
- content::Details<content::LoadCommittedDetails>(details).ptr();
- const content::NavigationEntry& entry = *commit->entry;
- if (ShouldRecordCommittedDetails(details)) {
- search_metrics_->RecordGoogleSearch(
- GetGoogleSearchAccessPointForSearchNavEntry(entry));
- }
-}
-
-void GoogleSearchCounter::SetSearchMetricsForTesting(
- GoogleSearchMetrics* search_metrics) {
- DCHECK(search_metrics);
- search_metrics_.reset(search_metrics);
-}
-
-void GoogleSearchCounter::RegisterForNotificationsInternal() {
- // We always listen for all COMMITTED navigations from all sources, as any
- // one of them could be a navigation of interest.
- registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::NotificationService::AllSources());
-}
-
-void GoogleSearchCounter::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case content::NOTIFICATION_NAV_ENTRY_COMMITTED:
- ProcessCommittedEntry(source, details);
- break;
- default:
- NOTREACHED();
- }
-}
diff --git a/chrome/browser/google/google_search_counter.h b/chrome/browser/google/google_search_counter.h
deleted file mode 100644
index ed6f244..0000000
--- a/chrome/browser/google/google_search_counter.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_GOOGLE_GOOGLE_SEARCH_COUNTER_H_
-#define CHROME_BROWSER_GOOGLE_GOOGLE_SEARCH_COUNTER_H_
-
-#include "base/memory/singleton.h"
-#include "components/google/core/browser/google_search_metrics.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-
-namespace content {
-class NavigationEntry;
-}
-
-// A listener for counting Google searches from various search access points. No
-// actual search query content is observed. See GoogleSearchMetrics for more
-// details about these access points.
-class GoogleSearchCounter : content::NotificationObserver {
- public:
- // Initialize the global instance.
- static void RegisterForNotifications();
-
- // Return the singleton instance of GoogleSearchCounter.
- static GoogleSearchCounter* GetInstance();
-
- // Returns the Google search access point for the given |entry|. This method
- // assumes that we have already verified that |entry|'s URL is a Google search
- // URL.
- GoogleSearchMetrics::AccessPoint GetGoogleSearchAccessPointForSearchNavEntry(
- const content::NavigationEntry& entry) const;
-
- // Returns true if |details| is valid and corresponds to a search results
- // page.
- bool ShouldRecordCommittedDetails(
- const content::NotificationDetails& details) const;
-
- const GoogleSearchMetrics* search_metrics() const {
- return search_metrics_.get();
- }
-
- private:
- friend struct base::DefaultSingletonTraits<GoogleSearchCounter>;
- friend class GoogleSearchCounterTest;
- friend class GoogleSearchCounterAndroidTest;
-
- GoogleSearchCounter();
- ~GoogleSearchCounter() override;
-
- void ProcessCommittedEntry(const content::NotificationSource& source,
- const content::NotificationDetails& details);
-
- // Replace the internal metrics object with a dummy or a mock. This instance
- // takes ownership of |search_metrics|.
- void SetSearchMetricsForTesting(GoogleSearchMetrics* search_metrics);
-
- // Register this counter for all notifications we care about.
- void RegisterForNotificationsInternal();
-
- // content::NotificationObserver
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
- content::NotificationRegistrar registrar_;
- scoped_ptr<GoogleSearchMetrics> search_metrics_;
-
- DISALLOW_COPY_AND_ASSIGN(GoogleSearchCounter);
-};
-
-#endif // CHROME_BROWSER_GOOGLE_GOOGLE_SEARCH_COUNTER_H_
diff --git a/chrome/browser/google/google_search_counter_android.cc b/chrome/browser/google/google_search_counter_android.cc
deleted file mode 100644
index 17699be..0000000
--- a/chrome/browser/google/google_search_counter_android.cc
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/google/google_search_counter_android.h"
-
-#include "base/logging.h"
-#include "chrome/browser/google/google_search_counter.h"
-#include "chrome/browser/prerender/prerender_manager.h"
-#include "chrome/browser/prerender/prerender_manager_factory.h"
-#include "components/google/core/browser/google_search_metrics.h"
-#include "content/public/browser/navigation_details.h"
-#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
-
-GoogleSearchCounterAndroid::GoogleSearchCounterAndroid(Profile* profile)
- : profile_(profile) {
- // We always listen for all COMMITTED navigations from all sources, as any
- // one of them could be a navigation of interest.
- registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::NotificationService::AllSources());
-}
-
-GoogleSearchCounterAndroid::~GoogleSearchCounterAndroid() {
-}
-
-void GoogleSearchCounterAndroid::ProcessCommittedEntry(
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- GoogleSearchCounter* counter = GoogleSearchCounter::GetInstance();
- DCHECK(counter);
- if (!counter->ShouldRecordCommittedDetails(details))
- return;
-
- const content::NavigationEntry& entry =
- *content::Details<content::LoadCommittedDetails>(details)->entry;
- prerender::PrerenderManager* prerender_manager =
- prerender::PrerenderManagerFactory::GetForProfile(profile_);
- // |prerender_manager| is NULL when prerendering is disabled.
- bool prerender_enabled =
- prerender_manager ? prerender_manager->IsEnabled() : false;
- counter->search_metrics()->RecordAndroidGoogleSearch(
- counter->GetGoogleSearchAccessPointForSearchNavEntry(entry),
- prerender_enabled);
-}
-
-void GoogleSearchCounterAndroid::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(content::NOTIFICATION_NAV_ENTRY_COMMITTED, type);
- ProcessCommittedEntry(source, details);
-}
diff --git a/chrome/browser/google/google_search_counter_android.h b/chrome/browser/google/google_search_counter_android.h
deleted file mode 100644
index 89830c3..0000000
--- a/chrome/browser/google/google_search_counter_android.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (c) 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_GOOGLE_GOOGLE_SEARCH_COUNTER_ANDROID_H_
-#define CHROME_BROWSER_GOOGLE_GOOGLE_SEARCH_COUNTER_ANDROID_H_
-
-#include "base/macros.h"
-#include "content/public/browser/notification_observer.h"
-#include "content/public/browser/notification_registrar.h"
-
-class Profile;
-
-// A listener for counting Google searches in Android Chrome from various search
-// access points. No actual search query content is observed. See
-// GoogleSearchMetrics for more details about these access points.
-class GoogleSearchCounterAndroid : content::NotificationObserver {
- public:
- explicit GoogleSearchCounterAndroid(Profile* profile);
- ~GoogleSearchCounterAndroid() override;
-
- private:
- friend class GoogleSearchCounterAndroidTest;
-
- void ProcessCommittedEntry(const content::NotificationSource& source,
- const content::NotificationDetails& details);
-
- // content::NotificationObserver:
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) override;
-
- Profile* profile_;
- content::NotificationRegistrar registrar_;
-
- DISALLOW_COPY_AND_ASSIGN(GoogleSearchCounterAndroid);
-};
-
-#endif // CHROME_BROWSER_GOOGLE_GOOGLE_SEARCH_COUNTER_ANDROID_H_
diff --git a/chrome/browser/google/google_search_counter_android_unittest.cc b/chrome/browser/google/google_search_counter_android_unittest.cc
deleted file mode 100644
index 0bd7d12..0000000
--- a/chrome/browser/google/google_search_counter_android_unittest.cc
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "chrome/browser/google/google_search_counter.h"
-#include "chrome/browser/google/google_search_counter_android.h"
-#include "chrome/browser/prerender/prerender_manager.h"
-#include "chrome/test/base/testing_profile.h"
-#include "components/google/core/browser/google_search_metrics.h"
-#include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/navigation_details.h"
-#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
-#include "content/public/test/test_browser_thread.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-class MockSearchMetrics : public GoogleSearchMetrics {
- public:
- MOCK_CONST_METHOD2(RecordAndroidGoogleSearch,
- void(AccessPoint ap, bool prerender_enabled));
-};
-
-} // namespace
-
-class GoogleSearchCounterAndroidTest : public testing::Test {
- protected:
- GoogleSearchCounterAndroidTest();
- ~GoogleSearchCounterAndroidTest() override;
-
- // testing::Test
- void SetUp() override;
- void TearDown() override;
-
- // Test if |url| is a Google search for specific types. When |is_omnibox| is
- // true, this method will append Omnibox identifiers to the simulated URL
- // navigation. If |expected_metric| is set and not AP_BOUNDARY, we'll also use
- // the Search Metrics mock class to ensure that the type of metric recorded is
- // correct. Note that when |expected_metric| is AP_BOUNDARY, we strictly
- // forbid any metrics from being logged at all. See implementation below for
- // details.
- void TestGoogleSearch(const std::string& url,
- bool is_omnibox,
- GoogleSearchMetrics::AccessPoint expected_metric,
- bool expected_prerender_enabled);
-
- private:
- void ExpectMetricsLogged(GoogleSearchMetrics::AccessPoint ap,
- bool prerender_enabled);
-
- // Needed to pass PrerenderManager's DCHECKs.
- base::MessageLoop message_loop_;
- content::TestBrowserThread ui_thread_;
- scoped_ptr<TestingProfile> profile_;
- scoped_ptr<GoogleSearchCounterAndroid> search_counter_;
- // Weak ptr. Actual instance owned by GoogleSearchCounter.
- ::testing::StrictMock<MockSearchMetrics>* mock_search_metrics_;
- prerender::PrerenderManager::PrerenderManagerMode original_prerender_mode_;
-};
-
-GoogleSearchCounterAndroidTest::GoogleSearchCounterAndroidTest()
- : ui_thread_(content::BrowserThread::UI, &message_loop_),
- profile_(new TestingProfile()),
- search_counter_(new GoogleSearchCounterAndroid(profile_.get())),
- mock_search_metrics_(NULL),
- original_prerender_mode_(
- prerender::PrerenderManager::PRERENDER_MODE_DISABLED) {
-}
-
-GoogleSearchCounterAndroidTest::~GoogleSearchCounterAndroidTest() {
-}
-
-void GoogleSearchCounterAndroidTest::SetUp() {
- // Keep a weak ptr to MockSearchMetrics so we can run expectations. The
- // GoogleSearchCounter singleton will own and clean up MockSearchMetrics.
- mock_search_metrics_ = new ::testing::StrictMock<MockSearchMetrics>;
- GoogleSearchCounter::GetInstance()->SetSearchMetricsForTesting(
- mock_search_metrics_);
- original_prerender_mode_ = prerender::PrerenderManager::GetMode();
- prerender::PrerenderManager::SetMode(
- prerender::PrerenderManager::PRERENDER_MODE_ENABLED);
-}
-
-void GoogleSearchCounterAndroidTest::TearDown() {
- mock_search_metrics_ = NULL;
- prerender::PrerenderManager::SetMode(original_prerender_mode_);
-}
-
-void GoogleSearchCounterAndroidTest::TestGoogleSearch(
- const std::string& url,
- bool is_omnibox,
- GoogleSearchMetrics::AccessPoint expected_metric,
- bool expected_prerender_enabled) {
- content::LoadCommittedDetails details;
- scoped_ptr<content::NavigationEntry> entry(
- content::NavigationEntry::Create());
- if (is_omnibox) {
- entry->SetTransitionType(ui::PageTransitionFromInt(
- ui::PAGE_TRANSITION_GENERATED |
- ui::PAGE_TRANSITION_FROM_ADDRESS_BAR));
- }
- entry->SetURL(GURL(url));
- details.entry = entry.get();
-
- // Since the internal mocked metrics object is strict, if |expect_metrics| is
- // false, the absence of this call to ExpectMetricsLogged will be noticed and
- // cause the test to complain, as expected. We use this behaviour to test
- // negative test cases (such as bad searches).
- if (expected_metric != GoogleSearchMetrics::AP_BOUNDARY)
- ExpectMetricsLogged(expected_metric, expected_prerender_enabled);
-
- // For now we don't care about the notification source, but when we start
- // listening for additional access points, we will have to pass in a valid
- // controller.
- search_counter_->Observe(
- content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::Source<content::NavigationController>(NULL),
- content::Details<content::LoadCommittedDetails>(&details));
-}
-
-void GoogleSearchCounterAndroidTest::ExpectMetricsLogged(
- GoogleSearchMetrics::AccessPoint ap, bool prerender_enabled) {
- EXPECT_CALL(*mock_search_metrics_,
- RecordAndroidGoogleSearch(ap, prerender_enabled)).Times(1);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, EmptySearch) {
- TestGoogleSearch(std::string(), false, GoogleSearchMetrics::AP_BOUNDARY,
- true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, GoodOmniboxSearch) {
- TestGoogleSearch("http://www.google.com/search?q=something", true,
- GoogleSearchMetrics::AP_OMNIBOX, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, BadOmniboxSearch) {
- TestGoogleSearch("http://www.google.com/search?other=something", true,
- GoogleSearchMetrics::AP_BOUNDARY, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, EmptyOmniboxSearch) {
- TestGoogleSearch(std::string(), true, GoogleSearchMetrics::AP_BOUNDARY, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, GoodOtherSearch) {
- TestGoogleSearch("http://www.google.com/search?q=something", false,
- GoogleSearchMetrics::AP_OTHER, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, BadOtherSearch) {
- TestGoogleSearch("http://www.google.com/search?other=something", false,
- GoogleSearchMetrics::AP_BOUNDARY, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, SearchAppSearch) {
- TestGoogleSearch("http://www.google.com/webhp?source=search_app#q=something",
- false, GoogleSearchMetrics::AP_SEARCH_APP, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, SearchAppStart) {
- // Starting the search app takes you to this URL, but it should not be
- // considered an actual search event. Note that this URL is not considered an
- // actual search because it has no query string parameter ("q").
- TestGoogleSearch("http://www.google.com/webhp?source=search_app",
- false, GoogleSearchMetrics::AP_BOUNDARY, true);
-}
-
-TEST_F(GoogleSearchCounterAndroidTest, GoodOmniboxSearch_PrerenderDisabled) {
- prerender::PrerenderManager::SetMode(
- prerender::PrerenderManager::PRERENDER_MODE_DISABLED);
- TestGoogleSearch("http://www.google.com/search?q=something", true,
- GoogleSearchMetrics::AP_OMNIBOX, false);
-}
diff --git a/chrome/browser/google/google_search_counter_unittest.cc b/chrome/browser/google/google_search_counter_unittest.cc
deleted file mode 100644
index a2a0625..0000000
--- a/chrome/browser/google/google_search_counter_unittest.cc
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/google/google_search_counter.h"
-#include "components/google/core/browser/google_search_metrics.h"
-#include "content/public/browser/navigation_controller.h"
-#include "content/public/browser/navigation_details.h"
-#include "content/public/browser/navigation_entry.h"
-#include "content/public/browser/notification_service.h"
-#include "content/public/browser/notification_types.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-class MockSearchMetrics : public GoogleSearchMetrics {
- public:
- MOCK_CONST_METHOD1(RecordGoogleSearch,
- void(GoogleSearchMetrics::AccessPoint ap));
-};
-
-} // namespace
-
-class GoogleSearchCounterTest : public testing::Test {
- protected:
- GoogleSearchCounterTest();
- ~GoogleSearchCounterTest() override;
-
- // testing::Test
- void SetUp() override;
- void TearDown() override;
-
- // Test if |url| is a Google search for specific types. When |is_omnibox| is
- // true, this method will append Omnibox identifiers to the simulated URL
- // navigation. If |expected_metric| is set and not AP_BOUNDARY, we'll also use
- // the Search Metrics mock class to ensure that the type of metric recorded is
- // correct. Note that when |expected_metric| is AP_BOUNDARY, we strictly
- // forbid any metrics from being logged at all. See implementation below for
- // details.
- void TestGoogleSearch(const std::string& url,
- bool is_omnibox,
- GoogleSearchMetrics::AccessPoint expected_metric);
-
- private:
- void ExpectMetricsLogged(GoogleSearchMetrics::AccessPoint ap);
-
- // Weak ptr. Actual instance owned by GoogleSearchCounter.
- ::testing::StrictMock<MockSearchMetrics>* mock_search_metrics_;
-};
-
-GoogleSearchCounterTest::GoogleSearchCounterTest()
- : mock_search_metrics_(NULL) {
-}
-
-GoogleSearchCounterTest::~GoogleSearchCounterTest() {
-}
-
-void GoogleSearchCounterTest::SetUp() {
- // Keep a weak ptr to MockSearchMetrics so we can run expectations. The
- // GoogleSearchCounter singleton will own and clean up MockSearchMetrics.
- mock_search_metrics_ = new ::testing::StrictMock<MockSearchMetrics>;
- GoogleSearchCounter::GetInstance()->SetSearchMetricsForTesting(
- mock_search_metrics_);
-}
-
-void GoogleSearchCounterTest::TearDown() {
- mock_search_metrics_ = NULL;
-}
-
-void GoogleSearchCounterTest::TestGoogleSearch(
- const std::string& url,
- bool is_omnibox,
- GoogleSearchMetrics::AccessPoint expected_metric) {
- content::LoadCommittedDetails details;
- scoped_ptr<content::NavigationEntry> entry(
- content::NavigationEntry::Create());
- if (is_omnibox) {
- entry->SetTransitionType(ui::PageTransitionFromInt(
- ui::PAGE_TRANSITION_GENERATED |
- ui::PAGE_TRANSITION_FROM_ADDRESS_BAR));
- }
- entry->SetURL(GURL(url));
- details.entry = entry.get();
-
- // Since the internal mocked metrics object is strict, if |expect_metrics| is
- // false, the absence of this call to ExpectMetricsLogged will be noticed and
- // cause the test to complain, as expected. We use this behaviour to test
- // negative test cases (such as bad searches).
- if (expected_metric != GoogleSearchMetrics::AP_BOUNDARY)
- ExpectMetricsLogged(expected_metric);
-
- // For now we don't care about the notification source, but when we start
- // listening for additional access points, we will have to pass in a valid
- // controller.
- GoogleSearchCounter::GetInstance()->Observe(
- content::NOTIFICATION_NAV_ENTRY_COMMITTED,
- content::Source<content::NavigationController>(NULL),
- content::Details<content::LoadCommittedDetails>(&details));
-}
-
-void GoogleSearchCounterTest::ExpectMetricsLogged(
- GoogleSearchMetrics::AccessPoint ap) {
- EXPECT_CALL(*mock_search_metrics_, RecordGoogleSearch(ap)).Times(1);
-}
-
-TEST_F(GoogleSearchCounterTest, EmptySearch) {
- TestGoogleSearch(std::string(), false, GoogleSearchMetrics::AP_BOUNDARY);
-}
-
-TEST_F(GoogleSearchCounterTest, GoodOmniboxSearch) {
- TestGoogleSearch("http://www.google.com/search?q=something", true,
- GoogleSearchMetrics::AP_OMNIBOX);
-}
-
-TEST_F(GoogleSearchCounterTest, BadOmniboxSearch) {
- TestGoogleSearch("http://www.google.com/search?other=something", true,
- GoogleSearchMetrics::AP_BOUNDARY);
-}
-
-TEST_F(GoogleSearchCounterTest, EmptyOmniboxSearch) {
- TestGoogleSearch(std::string(), true, GoogleSearchMetrics::AP_BOUNDARY);
-}
-
-TEST_F(GoogleSearchCounterTest, GoodOtherSearch) {
- TestGoogleSearch("http://www.google.com/search?q=something", false,
- GoogleSearchMetrics::AP_OTHER);
-}
-
-TEST_F(GoogleSearchCounterTest, BadOtherSearch) {
- TestGoogleSearch("http://www.google.com/search?other=something", false,
- GoogleSearchMetrics::AP_BOUNDARY);
-}
-
-TEST_F(GoogleSearchCounterTest, SearchAppSearch) {
- TestGoogleSearch("http://www.google.com/webhp?source=search_app#q=something",
- false, GoogleSearchMetrics::AP_SEARCH_APP);
-}
-
-TEST_F(GoogleSearchCounterTest, SearchAppStart) {
- // Starting the search app takes you to this URL, but it should not be
- // considered an actual search event. Note that this URL is not considered an
- // actual search because it has no query string parameter ("q").
- TestGoogleSearch("http://www.google.com/webhp?source=search_app",
- false, GoogleSearchMetrics::AP_BOUNDARY);
-}
-
-// TODO(stevet): Add a regression test to protect against the particular
-// bad-flags handling case that asvitkine pointed out.
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index e7a5dde..c71d727 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1674,10 +1674,6 @@
'browser/google/google_brand.h',
'browser/google/google_brand_chromeos.cc',
'browser/google/google_brand_chromeos.h',
- 'browser/google/google_search_counter.cc',
- 'browser/google/google_search_counter.h',
- 'browser/google/google_search_counter_android.cc',
- 'browser/google/google_search_counter_android.h',
'browser/google/google_update_settings_posix.cc',
'browser/google/google_update_win.cc',
'browser/google/google_update_win.h',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index f5e1799..cec85a9 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -100,8 +100,6 @@
'browser/file_select_helper_unittest.cc',
'browser/geolocation/geolocation_permission_context_unittest.cc',
'browser/global_keyboard_shortcuts_mac_unittest.mm',
- 'browser/google/google_search_counter_android_unittest.cc',
- 'browser/google/google_search_counter_unittest.cc',
'browser/google/google_update_settings_unittest.cc',
'browser/google/google_update_win_unittest.cc',
'browser/history/android/android_cache_database_unittest.cc',
diff --git a/components/google.gypi b/components/google.gypi
index 1b5c2f6..5bc0a74 100644
--- a/components/google.gypi
+++ b/components/google.gypi
@@ -25,8 +25,6 @@
# Note: sources duplicated in GN build.
'google/core/browser/google_pref_names.cc',
'google/core/browser/google_pref_names.h',
- 'google/core/browser/google_search_metrics.cc',
- 'google/core/browser/google_search_metrics.h',
'google/core/browser/google_switches.cc',
'google/core/browser/google_switches.h',
'google/core/browser/google_url_tracker.cc',
diff --git a/components/google/core/browser/BUILD.gn b/components/google/core/browser/BUILD.gn
index 6e4c581..d98d61b 100644
--- a/components/google/core/browser/BUILD.gn
+++ b/components/google/core/browser/BUILD.gn
@@ -6,8 +6,6 @@ static_library("browser") {
sources = [
"google_pref_names.cc",
"google_pref_names.h",
- "google_search_metrics.cc",
- "google_search_metrics.h",
"google_switches.cc",
"google_switches.h",
"google_url_tracker.cc",
diff --git a/components/google/core/browser/google_search_metrics.cc b/components/google/core/browser/google_search_metrics.cc
deleted file mode 100644
index d284a7c..0000000
--- a/components/google/core/browser/google_search_metrics.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/google/core/browser/google_search_metrics.h"
-
-#include "base/logging.h"
-#include "base/metrics/histogram_macros.h"
-
-GoogleSearchMetrics::GoogleSearchMetrics() {
-}
-
-GoogleSearchMetrics::~GoogleSearchMetrics() {
-}
-
-void GoogleSearchMetrics::RecordGoogleSearch(AccessPoint ap) const {
- DCHECK_NE(AP_BOUNDARY, ap);
- UMA_HISTOGRAM_ENUMERATION("GoogleSearch.AccessPoint", ap, AP_BOUNDARY);
-}
-
-#if defined(OS_ANDROID)
-void GoogleSearchMetrics::RecordAndroidGoogleSearch(
- AccessPoint ap,
- bool prerender_enabled) const {
- DCHECK_NE(AP_BOUNDARY, ap);
- if (prerender_enabled) {
- UMA_HISTOGRAM_ENUMERATION("GoogleSearch.AccessPoint_PrerenderEnabled",
- ap, AP_BOUNDARY);
- } else {
- UMA_HISTOGRAM_ENUMERATION("GoogleSearch.AccessPoint_PrerenderDisabled",
- ap, AP_BOUNDARY);
- }
-}
-#endif
diff --git a/components/google/core/browser/google_search_metrics.h b/components/google/core/browser/google_search_metrics.h
deleted file mode 100644
index d6d1211..0000000
--- a/components/google/core/browser/google_search_metrics.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_SEARCH_METRICS_H_
-#define COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_SEARCH_METRICS_H_
-
-#include "build/build_config.h"
-
-// A thin helper class used by parties interested in reporting Google search
-// metrics (mostly counts of searches from different access points). This class
-// partly exists to make testing easier.
-class GoogleSearchMetrics {
- public:
- // Various Google Search access points, to be used with UMA enumeration
- // histograms.
- enum AccessPoint {
- AP_OMNIBOX,
- AP_OMNIBOX_INSTANT,
- AP_DIRECT_NAV,
- AP_DIRECT_NAV_INSTANT,
- AP_HOME_PAGE,
- AP_HOME_PAGE_INSTANT,
- AP_SEARCH_APP,
- AP_SEARCH_APP_INSTANT,
- AP_OTHER,
- AP_OTHER_INSTANT,
- AP_BOUNDARY,
- };
-
- GoogleSearchMetrics();
- virtual ~GoogleSearchMetrics();
-
- // Record a single Google search from source |ap|.
- virtual void RecordGoogleSearch(AccessPoint ap) const;
-
-#if defined(OS_ANDROID)
- // Record a single Android Google search from source |ap|. |prerender_enabled|
- // is set to true when prerendering is enabled via settings.
- virtual void RecordAndroidGoogleSearch(AccessPoint ap,
- bool prerender_enabled) const;
-#endif
-};
-
-#endif // COMPONENTS_GOOGLE_CORE_BROWSER_GOOGLE_SEARCH_METRICS_H_
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 61da74a..b8f1f80 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -13829,6 +13829,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</histogram>
<histogram name="GoogleSearch.AccessPoint" enum="SearchAccessPoint">
+ <obsolete>
+ Deprecated 2015/08.
+ </obsolete>
<owner>kmadhusu@chromium.org</owner>
<summary>
Counts number of Google searches from various access points in the browser.