summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authordmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 02:33:27 +0000
committerdmazzoni@chromium.org <dmazzoni@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-09 02:33:27 +0000
commit30fdb36651388788b318cde3e9e86c29fd2bd79b (patch)
treec6f8d5411b084f8832fadc3192e52bd7744abf13 /content
parent2380c6bdf6dc0f4f6929f1b9702ec3ffce747e23 (diff)
downloadchromium_src-30fdb36651388788b318cde3e9e86c29fd2bd79b.zip
chromium_src-30fdb36651388788b318cde3e9e86c29fd2bd79b.tar.gz
chromium_src-30fdb36651388788b318cde3e9e86c29fd2bd79b.tar.bz2
Add test for accessibility histograms.
The goal is just to make sure this code has test coverage, not to test correctness. There was an issue in the past where the code that computed the histograms crashed in debug mode, this will help prevent something like that from landing in the future. BUG=99504 Review URL: https://chromiumcodereview.appspot.com/11778045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175677 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/accessibility/browser_accessibility_state_impl.cc12
-rw-r--r--content/browser/accessibility/browser_accessibility_state_impl.h8
-rw-r--r--content/public/browser/browser_accessibility_state.h2
3 files changed, 15 insertions, 7 deletions
diff --git a/content/browser/accessibility/browser_accessibility_state_impl.cc b/content/browser/accessibility/browser_accessibility_state_impl.cc
index 2f6e0c3..3cb73fe 100644
--- a/content/browser/accessibility/browser_accessibility_state_impl.cc
+++ b/content/browser/accessibility/browser_accessibility_state_impl.cc
@@ -50,12 +50,12 @@ BrowserAccessibilityStateImpl::BrowserAccessibilityStateImpl()
}
#if defined(OS_WIN)
- // On Windows, UpdateHistogram calls some system functions with unknown
+ // On Windows, UpdateHistograms calls some system functions with unknown
// runtime, so call it on the file thread to ensure there's no jank.
// Everything in that method must be safe to call on another thread.
BrowserThread::ID update_histogram_thread = BrowserThread::FILE;
#else
- // On all other platforms, UpdateHistogram should be called on the main
+ // On all other platforms, UpdateHistograms should be called on the main
// thread.
BrowserThread::ID update_histogram_thread = BrowserThread::UI;
#endif
@@ -65,7 +65,7 @@ BrowserAccessibilityStateImpl::BrowserAccessibilityStateImpl()
AddRef();
BrowserThread::PostDelayedTask(
update_histogram_thread, FROM_HERE,
- base::Bind(&BrowserAccessibilityStateImpl::UpdateHistogram, this),
+ base::Bind(&BrowserAccessibilityStateImpl::UpdateHistograms, this),
base::TimeDelta::FromSeconds(kAccessibilityHistogramDelaySecs));
}
@@ -94,7 +94,11 @@ void BrowserAccessibilityStateImpl::AddHistogramCallback(
histogram_callbacks_.push_back(callback);
}
-void BrowserAccessibilityStateImpl::UpdateHistogram() {
+void BrowserAccessibilityStateImpl::UpdateHistogramsForTesting() {
+ UpdateHistograms();
+}
+
+void BrowserAccessibilityStateImpl::UpdateHistograms() {
UpdatePlatformSpecificHistograms();
for (size_t i = 0; i < histogram_callbacks_.size(); ++i)
diff --git a/content/browser/accessibility/browser_accessibility_state_impl.h b/content/browser/accessibility/browser_accessibility_state_impl.h
index 40d99fd..46621ea 100644
--- a/content/browser/accessibility/browser_accessibility_state_impl.h
+++ b/content/browser/accessibility/browser_accessibility_state_impl.h
@@ -45,9 +45,7 @@ class CONTENT_EXPORT BrowserAccessibilityStateImpl
virtual bool IsAccessibleBrowser() OVERRIDE;
virtual void AddHistogramCallback(base::Closure callback) OVERRIDE;
- // Called a short while after startup to allow time for the accessibility
- // state to be determined. Updates a histogram with the current state.
- void UpdateHistogram();
+ virtual void UpdateHistogramsForTesting() OVERRIDE;
AccessibilityMode GetAccessibilityMode();
void SetAccessibilityMode(AccessibilityMode mode);
@@ -56,6 +54,10 @@ class CONTENT_EXPORT BrowserAccessibilityStateImpl
friend class base::RefCountedThreadSafe<BrowserAccessibilityStateImpl>;
friend struct DefaultSingletonTraits<BrowserAccessibilityStateImpl>;
+ // Called a short while after startup to allow time for the accessibility
+ // state to be determined. Updates histograms with the current state.
+ void UpdateHistograms();
+
// Leaky singleton, destructor generally won't be called.
virtual ~BrowserAccessibilityStateImpl();
diff --git a/content/public/browser/browser_accessibility_state.h b/content/public/browser/browser_accessibility_state.h
index 4c89f5a..16cf706 100644
--- a/content/public/browser/browser_accessibility_state.h
+++ b/content/public/browser/browser_accessibility_state.h
@@ -34,6 +34,8 @@ class CONTENT_EXPORT BrowserAccessibilityState {
// Use this to register a method to update additional accessibility
// histograms.
virtual void AddHistogramCallback(base::Closure callback) = 0;
+
+ virtual void UpdateHistogramsForTesting() = 0;
};
} // namespace content