diff options
author | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-30 13:00:40 +0000 |
---|---|---|
committer | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-30 13:00:40 +0000 |
commit | 90984b00d84729a170cdb6a2b863e47b15ff7aea (patch) | |
tree | 0969d0390030262306593d5905e40e95c44ce831 /content/browser/geolocation/mock_location_arbitrator.h | |
parent | bade57cab535b5459975b44ea4e85362c576deea (diff) | |
download | chromium_src-90984b00d84729a170cdb6a2b863e47b15ff7aea.zip chromium_src-90984b00d84729a170cdb6a2b863e47b15ff7aea.tar.gz chromium_src-90984b00d84729a170cdb6a2b863e47b15ff7aea.tar.bz2 |
Cleanup: use MockGeolocationArbitrator to test GeolocationProvider
This patch introduces a MockGeolocationArbitrator class for use
with the GeolocationProvider unittests. This avoids having to
instantiate dependencies of the GeolocationArbitrator to test the
GeolocationProvider.
This will make it easier to add a unit test for
https://codereview.chromium.org/11312210/
TEST=Existing
BUG=
Review URL: https://chromiumcodereview.appspot.com/11412194
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation/mock_location_arbitrator.h')
-rw-r--r-- | content/browser/geolocation/mock_location_arbitrator.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/content/browser/geolocation/mock_location_arbitrator.h b/content/browser/geolocation/mock_location_arbitrator.h new file mode 100644 index 0000000..dde6878 --- /dev/null +++ b/content/browser/geolocation/mock_location_arbitrator.h @@ -0,0 +1,38 @@ +// Copyright (c) 2012 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 CONTENT_BROWSER_GEOLOCATION_MOCK_LOCATION_ARBITRATOR_H_ +#define CONTENT_BROWSER_GEOLOCATION_MOCK_LOCATION_ARBITRATOR_H_ + +#include "base/basictypes.h" +#include "base/compiler_specific.h" +#include "content/browser/geolocation/location_arbitrator.h" + +namespace content { + +struct Geoposition; + +class MockGeolocationArbitrator : public GeolocationArbitrator { + public: + MockGeolocationArbitrator(); + + bool providers_started() const { return providers_started_; } + + // GeolocationArbitrator: + virtual void StartProviders(const GeolocationObserverOptions& options) + OVERRIDE; + virtual void StopProviders() OVERRIDE; + virtual void OnPermissionGranted() OVERRIDE; + virtual bool HasPermissionBeenGranted() const OVERRIDE; + + private: + bool permission_granted_; + bool providers_started_; + + DISALLOW_COPY_AND_ASSIGN(MockGeolocationArbitrator); +}; + +} // namespace content + +#endif // CONTENT_BROWSER_GEOLOCATION_MOCK_LOCATION_ARBITRATOR_H_ |