1e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke/*
2f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch * Copyright (c) 2010, Google Inc. All rights reserved.
3e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
4e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * Redistribution and use in source and binary forms, with or without
5e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * modification, are permitted provided that the following conditions are
6e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * met:
7e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
8e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *     * Redistributions of source code must retain the above copyright
9e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * notice, this list of conditions and the following disclaimer.
10e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *     * Redistributions in binary form must reproduce the above
11e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * copyright notice, this list of conditions and the following disclaimer
12e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * in the documentation and/or other materials provided with the
13e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * distribution.
14e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *     * Neither the name of Google Inc. nor the names of its
15e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * contributors may be used to endorse or promote products derived from
16e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * this software without specific prior written permission.
17e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
18e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke */
30e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
31f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#ifndef WebGeolocationClientMock_h
32f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#define WebGeolocationClientMock_h
33e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
34f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "WebCommon.h"
35f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "WebGeolocationClient.h"
36f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#include "WebPrivateOwnPtr.h"
37e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
38f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochnamespace WebCore {
39f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochclass GeolocationClientMock;
40f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch}
41f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
42f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochnamespace WebKit {
43f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochclass WebGeolocationPosition;
44f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochclass WebString;
45f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
46f05b935882198ccf7d81675736e3aeb089c5113aBen Murdochclass WebGeolocationClientMock : public WebGeolocationClient {
47e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkepublic:
48f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WEBKIT_API static WebGeolocationClientMock* create();
49f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    ~WebGeolocationClientMock() { reset(); }
50e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
51f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WEBKIT_API void setPosition(double latitude, double longitude, double accuracy);
52f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WEBKIT_API void setError(int errorCode, const WebString& message);
53f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WEBKIT_API void setPermission(bool);
542bde8e466a4451c7319e3a072d118917957d6554Steve Block    WEBKIT_API int numberOfPendingPermissionRequests() const;
55f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WEBKIT_API void resetMock();
56e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
57f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void startUpdating();
58f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void stopUpdating();
59f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void setEnableHighAccuracy(bool);
60e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
61f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void geolocationDestroyed();
62f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void setController(WebGeolocationController*);
63e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
64f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void requestPermission(const WebGeolocationPermissionRequest&);
65f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual void cancelPermissionRequest(const WebGeolocationPermissionRequest&);
66f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
67f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    virtual bool lastPosition(WebGeolocationPosition& webPosition);
68e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
69e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkeprivate:
70f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WebGeolocationClientMock();
71f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WEBKIT_API void reset();
72f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch
73f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch    WebPrivateOwnPtr<WebCore::GeolocationClientMock> m_clientMock;
74e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke};
75f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch}
76e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
77f05b935882198ccf7d81675736e3aeb089c5113aBen Murdoch#endif // WebGeolocationClientMock_h
78