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

Unified Diff: content/child/geofencing/geofencing_dispatcher.cc

Issue 701953007: Expose mock geofencing service via testRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: content/child/geofencing/geofencing_dispatcher.cc
diff --git a/content/child/geofencing/geofencing_dispatcher.cc b/content/child/geofencing/geofencing_dispatcher.cc
index eec721faf979eaa18d6a140a076231195bb7f35d..a88fcdb7dfbc665e3cdefc6fea5ea892e2b97b05 100644
--- a/content/child/geofencing/geofencing_dispatcher.cc
+++ b/content/child/geofencing/geofencing_dispatcher.cc
@@ -121,6 +121,41 @@ void GeofencingDispatcher::GetRegisteredRegions(
CurrentWorkerId(), request_id, serviceworker_registration_id));
}
+void GeofencingDispatcher::SetMockProvider(
+ blink::WebServiceWorkerRegistration* service_worker_registration,
+ bool service_available) {
+ DCHECK(service_worker_registration);
+ int64 service_worker_registration_id =
+ static_cast<WebServiceWorkerRegistrationImpl*>(
+ service_worker_registration)->registration_id();
+ Send(new GeofencingHostMsg_SetMockProvider(
+ service_worker_registration_id,
+ service_available ? GeofencingMockState::SERVICE_AVAILABLE
+ : GeofencingMockState::SERVICE_UNAVAILABLE));
+}
+
+void GeofencingDispatcher::ClearMockProvider(
+ blink::WebServiceWorkerRegistration* service_worker_registration) {
+ DCHECK(service_worker_registration);
+ int64 service_worker_registration_id =
+ static_cast<WebServiceWorkerRegistrationImpl*>(
+ service_worker_registration)->registration_id();
+ Send(new GeofencingHostMsg_SetMockProvider(service_worker_registration_id,
+ GeofencingMockState::NONE));
+}
+
+void GeofencingDispatcher::SetMockPosition(
+ blink::WebServiceWorkerRegistration* service_worker_registration,
+ double latitude,
+ double longitude) {
+ DCHECK(service_worker_registration);
+ int64 service_worker_registration_id =
+ static_cast<WebServiceWorkerRegistrationImpl*>(
+ service_worker_registration)->registration_id();
+ Send(new GeofencingHostMsg_SetMockPosition(service_worker_registration_id,
+ latitude, longitude));
+}
+
GeofencingDispatcher* GeofencingDispatcher::GetOrCreateThreadSpecificInstance(
ThreadSafeSender* thread_safe_sender) {
if (g_dispatcher_tls.Pointer()->Get() == kHasBeenDeleted) {

Powered by Google App Engine
This is Rietveld 408576698