summaryrefslogtreecommitdiffstats
path: root/chrome/browser/device_orientation
diff options
context:
space:
mode:
authorhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 16:01:54 +0000
committerhans@chromium.org <hans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-02 16:01:54 +0000
commite94f2217120b0b71ea2bc7541ff98c8800a316f6 (patch)
tree5425583114aea5eeb3c59d1fd98ff643666a657a /chrome/browser/device_orientation
parent4d849c6b297552740bb6ec648af4778391cc8588 (diff)
downloadchromium_src-e94f2217120b0b71ea2bc7541ff98c8800a316f6.zip
chromium_src-e94f2217120b0b71ea2bc7541ff98c8800a316f6.tar.gz
chromium_src-e94f2217120b0b71ea2bc7541ff98c8800a316f6.tar.bz2
Fix DeviceOrientationProviderTest.ObserverNotRemoved.
The problem was that some extra reference to Provider was left after the ObserverNotRemoved test had finished. This reference was held by the RunnableMethod object that executes ProviderImpl::DoInitializePollingThread on a background thread. In the test, there were no guarantees that the body of this function would finish before the test ended, thus causing a problem. Fixing this by pushing another orientation through, forcing the Provider to execute at least one Poll task on the background thread, which can only happen after the initialization of the polling thread is done. BUG=53865 TEST=unit_tests --gtest_filter=DeviceOrientationProviderTest.ObserverNotRemoved Review URL: http://codereview.chromium.org/3232005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/device_orientation')
-rw-r--r--chrome/browser/device_orientation/provider_unittest.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/chrome/browser/device_orientation/provider_unittest.cc b/chrome/browser/device_orientation/provider_unittest.cc
index 60eedbc..a84de5bc 100644
--- a/chrome/browser/device_orientation/provider_unittest.cc
+++ b/chrome/browser/device_orientation/provider_unittest.cc
@@ -251,12 +251,16 @@ TEST_F(DeviceOrientationProviderTest, ObserverNotRemoved) {
new MockOrientationFactory());
Init(MockOrientationFactory::CreateDataFetcher);
const Orientation kTestOrientation(true, 1, true, 2, true, 3);
+ const Orientation kTestOrientation2(true, 4, true, 5, true, 6);
scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_));
checker->AddExpectation(kTestOrientation);
orientation_factory->SetOrientation(kTestOrientation);
provider_->AddObserver(checker.get());
+ MessageLoop::current()->Run();
+ checker->AddExpectation(kTestOrientation2);
+ orientation_factory->SetOrientation(kTestOrientation2);
MessageLoop::current()->Run();
// Note that checker is not removed. This should not be a problem.