Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(980)

Unified Diff: content/browser/geolocation/location_arbitrator_impl_unittest.cc

Issue 15968009: Clear Reference Location State When Providers are Stopped (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/geolocation/location_arbitrator_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/geolocation/location_arbitrator_impl_unittest.cc
===================================================================
--- content/browser/geolocation/location_arbitrator_impl_unittest.cc (revision 203281)
+++ content/browser/geolocation/location_arbitrator_impl_unittest.cc (working copy)
@@ -296,4 +296,37 @@
CheckLastPositionInfo(3.5658700, 139.069979, 1000);
}
+TEST_F(GeolocationLocationArbitratorTest, TwoOneShotsIsNewPositionBetter) {
+ arbitrator_->StartProviders(false);
+ access_token_store_->NotifyDelegateTokensLoaded();
+ ASSERT_TRUE(cell());
+ ASSERT_TRUE(gps());
+
+ // Set the initial position.
+ SetPositionFix(cell(), 3, 139, 100);
+ CheckLastPositionInfo(3, 139, 100);
+
+ // Restart providers to simulate a one-shot request.
+ arbitrator_->StopProviders();
+
+ // To test 240956, perform a throwaway alloc.
+ // This convinces the allocator to put the providers in a new memory location.
+ MockLocationProvider* fakeMockProvider = NULL;
+ LocationProviderBase* fakeProvider =
+ new MockLocationProvider(&fakeMockProvider);
+
+ arbitrator_->StartProviders(false);
+ access_token_store_->NotifyDelegateTokensLoaded();
+
+ // Advance the time a short while to simulate successive calls.
+ AdvanceTimeNow(base::TimeDelta::FromMilliseconds(5));
+
+ // Update with a less accurate position to verify 240956.
+ SetPositionFix(cell(), 3, 139, 150);
+ CheckLastPositionInfo(3, 139, 150);
+
+ // No delete required for fakeMockProvider. It points to fakeProvider.
+ delete fakeProvider;
+}
+
} // namespace content
« no previous file with comments | « content/browser/geolocation/location_arbitrator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698