diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 11:12:43 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 11:12:43 +0000 |
commit | 10e59f313e152793f810ac60288e9a3516aba8a3 (patch) | |
tree | 092a11226e8d577aa77721efe57926e729d58fdc /chrome/browser/geolocation/mock_location_provider.h | |
parent | c65769622ed9c97688cf0662f2cd2da77a7f5bc2 (diff) | |
download | chromium_src-10e59f313e152793f810ac60288e9a3516aba8a3.zip chromium_src-10e59f313e152793f810ac60288e9a3516aba8a3.tar.gz chromium_src-10e59f313e152793f810ac60288e9a3516aba8a3.tar.bz2 |
Fix crash when permission request received from extension.
BUG=http://crbug.com/37196
TEST=TODO
Review URL: http://codereview.chromium.org/667006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40621 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation/mock_location_provider.h')
-rw-r--r-- | chrome/browser/geolocation/mock_location_provider.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/chrome/browser/geolocation/mock_location_provider.h b/chrome/browser/geolocation/mock_location_provider.h new file mode 100644 index 0000000..b690416 --- /dev/null +++ b/chrome/browser/geolocation/mock_location_provider.h @@ -0,0 +1,46 @@ +// Copyright (c) 2010 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_GEOLOCATION_MOCK_LOCATION_PROVIDER_H_ +#define CHROME_BROWSER_GEOLOCATION_MOCK_LOCATION_PROVIDER_H_ + +#include "chrome/browser/geolocation/location_provider.h" + +// Mock implementation of a location provider for testing. +class MockLocationProvider : public LocationProviderBase { + public: + MockLocationProvider(); + virtual ~MockLocationProvider(); + + using LocationProviderBase::UpdateListeners; + using LocationProviderBase::InformListenersOfMovement; + + // LocationProviderBase implementation. + virtual bool StartProvider(); + virtual void GetPosition(Geoposition *position); + + Geoposition position_; + int started_count_; + + // Set when an instance of the mock is created via a factory function. + static MockLocationProvider* instance_; + + DISALLOW_COPY_AND_ASSIGN(MockLocationProvider); +}; + +// Factory functions for the various sorts of mock location providers, +// for use with GeolocationArbitrator::SetProviderFactoryForTest (i.e. +// not intended for test code to use to get access to the mock, you can use +// MockLocationProvider::instance_ for this, or make a custom facotry method). + +// Creates a mock location provider with no default behavior. +LocationProviderBase* NewMockLocationProvider(); +// Creates a mock location provider that automatically notifies its +// listeners with a valid location when StartProvider is called. +LocationProviderBase* NewAutoSuccessMockLocationProvider(); +// Creates a mock location provider that automatically notifies its +// listeners with an error when StartProvider is called. +LocationProviderBase* NewAutoFailMockLocationProvider(); + +#endif // CHROME_BROWSER_GEOLOCATION_MOCK_LOCATION_PROVIDER_H_ |