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

Side by Side Diff: device/geolocation/android/javatests/src/org/chromium/device/geolocation/MockLocationProvider.java

Issue 2809813002: GeoLocation: add support for GmsCore location provider (Closed)
Patch Set: reillyg@ nit Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.device.geolocation; 5 package org.chromium.device.geolocation;
6 6
7 import android.location.Location;
7 import android.os.Handler; 8 import android.os.Handler;
8 import android.os.HandlerThread; 9 import android.os.HandlerThread;
9 import android.os.Message; 10 import android.os.Message;
10 11
11 /** 12 /**
12 * A mock location provider. When started, runs a background thread that periodi cally 13 * A mock location provider. When started, runs a background thread that periodi cally
13 * posts location updates. This does not involve any system Location APIs and th us 14 * posts location updates. This does not involve any system Location APIs and th us
14 * does not require any special permissions in the test app or on the device. 15 * does not require any special permissions in the test app or on the device.
15 */ 16 */
16 public class MockLocationProvider implements LocationProviderFactory.LocationPro vider { 17 public class MockLocationProvider implements LocationProviderFactory.LocationPro vider {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 if (msg.what == UPDATE_LOCATION_MSG) { 71 if (msg.what == UPDATE_LOCATION_MSG) {
71 newLocation(); 72 newLocation();
72 sendEmptyMessageDelayed(UPDATE_LOCATION_MSG, 250); 73 sendEmptyMessageDelayed(UPDATE_LOCATION_MSG, 250);
73 } 74 }
74 } 75 }
75 } 76 }
76 }; 77 };
77 } 78 }
78 79
79 private void newLocation() { 80 private void newLocation() {
80 LocationProviderAdapter.newLocationAvailable( 81 Location location = new Location("MockLocationProvider");
81 0, 0, System.currentTimeMillis() / 1000.0, false, 0, true, 0.5, false, 0, false, 0); 82 location.setTime(System.currentTimeMillis());
83 location.setAccuracy(0.5f);
84 LocationProviderAdapter.onNewLocationAvailable(location);
82 } 85 }
83 }; 86 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698