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

Side by Side Diff: Source/modules/geolocation/testing/GeolocationClientMock.h

Issue 319863003: Enable Oilpan for modules/geolocation by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Apple Inc. All Rights Reserved. 3 * Copyright (C) 2012 Apple Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 18 matching lines...) Expand all
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 #ifndef GeolocationClientMock_h 32 #ifndef GeolocationClientMock_h
33 #define GeolocationClientMock_h 33 #define GeolocationClientMock_h
34 34
35 #include "modules/geolocation/GeolocationClient.h" 35 #include "modules/geolocation/GeolocationClient.h"
36 #include "platform/Timer.h" 36 #include "platform/Timer.h"
37 #include "platform/heap/Handle.h" 37 #include "platform/heap/Handle.h"
38 #include "wtf/HashSet.h" 38 #include "wtf/HashSet.h"
39 #include "wtf/RefPtr.h"
40 #include "wtf/text/WTFString.h" 39 #include "wtf/text/WTFString.h"
41 40
42 namespace WebCore { 41 namespace WebCore {
43 42
44 class GeolocationController; 43 class GeolocationController;
45 class GeolocationPosition; 44 class GeolocationPosition;
46 45
47 // Provides a mock object for the geolocation client. 46 // Provides a mock object for the geolocation client.
48 class GeolocationClientMock : public GeolocationClient { 47 class GeolocationClientMock : public GeolocationClient {
49 public: 48 public:
50 GeolocationClientMock(); 49 GeolocationClientMock();
51 virtual ~GeolocationClientMock(); 50 virtual ~GeolocationClientMock();
52 51
53 void setPosition(PassRefPtrWillBeRawPtr<GeolocationPosition>); 52 void setPosition(GeolocationPosition*);
54 void setPositionUnavailableError(const String& errorMessage); 53 void setPositionUnavailableError(const String& errorMessage);
55 void setPermission(bool allowed); 54 void setPermission(bool allowed);
56 int numberOfPendingPermissionRequests() const; 55 int numberOfPendingPermissionRequests() const;
57 56
58 // GeolocationClient 57 // GeolocationClient
59 virtual void geolocationDestroyed() OVERRIDE; 58 virtual void geolocationDestroyed() OVERRIDE;
60 virtual void startUpdating() OVERRIDE; 59 virtual void startUpdating() OVERRIDE;
61 virtual void stopUpdating() OVERRIDE; 60 virtual void stopUpdating() OVERRIDE;
62 virtual void setEnableHighAccuracy(bool) OVERRIDE; 61 virtual void setEnableHighAccuracy(bool) OVERRIDE;
63 virtual GeolocationPosition* lastPosition() OVERRIDE; 62 virtual GeolocationPosition* lastPosition() OVERRIDE;
64 virtual void requestPermission(Geolocation*) OVERRIDE; 63 virtual void requestPermission(Geolocation*) OVERRIDE;
65 virtual void cancelPermissionRequest(Geolocation*) OVERRIDE; 64 virtual void cancelPermissionRequest(Geolocation*) OVERRIDE;
66 void controllerForTestAdded(GeolocationController*) OVERRIDE; 65 void controllerForTestAdded(GeolocationController*) OVERRIDE;
67 void controllerForTestRemoved(GeolocationController*) OVERRIDE; 66 void controllerForTestRemoved(GeolocationController*) OVERRIDE;
68 67
69 private: 68 private:
70 void asyncUpdateController(); 69 void asyncUpdateController();
71 void controllerTimerFired(Timer<GeolocationClientMock>*); 70 void controllerTimerFired(Timer<GeolocationClientMock>*);
72 71
73 void asyncUpdatePermission(); 72 void asyncUpdatePermission();
74 void permissionTimerFired(Timer<GeolocationClientMock>*); 73 void permissionTimerFired(Timer<GeolocationClientMock>*);
75 74
76 void clearError(); 75 void clearError();
77 76
78 HashSet<GeolocationController*> m_controllers; 77 HashSet<GeolocationController*> m_controllers;
79 RefPtrWillBePersistent<GeolocationPosition> m_lastPosition; 78 Persistent<GeolocationPosition> m_lastPosition;
80 bool m_hasError; 79 bool m_hasError;
81 String m_errorMessage; 80 String m_errorMessage;
82 Timer<GeolocationClientMock> m_controllerTimer; 81 Timer<GeolocationClientMock> m_controllerTimer;
83 Timer<GeolocationClientMock> m_permissionTimer; 82 Timer<GeolocationClientMock> m_permissionTimer;
84 bool m_isActive; 83 bool m_isActive;
85 84
86 enum PermissionState { 85 enum PermissionState {
87 PermissionStateUnset, 86 PermissionStateUnset,
88 PermissionStateAllowed, 87 PermissionStateAllowed,
89 PermissionStateDenied 88 PermissionStateDenied
90 }; 89 };
91 90
92 PermissionState m_permissionState; 91 PermissionState m_permissionState;
93 typedef WillBePersistentHeapHashSet<RefPtrWillBeMember<Geolocation> > Geoloc ationSet; 92 typedef PersistentHeapHashSet<Member<Geolocation> > GeolocationSet;
94 GeolocationSet m_pendingPermissions; 93 GeolocationSet m_pendingPermissions;
95 }; 94 };
96 95
97 } 96 }
98 97
99 #endif 98 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698