From 30fdb36651388788b318cde3e9e86c29fd2bd79b Mon Sep 17 00:00:00 2001 From: "dmazzoni@chromium.org" Date: Wed, 9 Jan 2013 02:33:27 +0000 Subject: 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 --- .../accessibility/browser_accessibility_state_impl.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'content/browser/accessibility/browser_accessibility_state_impl.cc') 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) -- cgit v1.1