| OLD | NEW |
| 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.content.browser.test.util; | 5 package org.chromium.device.geolocation; |
| 6 | 6 |
| 7 import android.os.Handler; | 7 import android.os.Handler; |
| 8 import android.os.HandlerThread; | 8 import android.os.HandlerThread; |
| 9 import android.os.Message; | 9 import android.os.Message; |
| 10 | 10 |
| 11 import org.chromium.content.browser.LocationProviderAdapter; | |
| 12 import org.chromium.content.browser.LocationProviderFactory; | |
| 13 | |
| 14 /** | 11 /** |
| 15 * A mock location provider. When started, runs a background thread that periodi
cally | 12 * A mock location provider. When started, runs a background thread that periodi
cally |
| 16 * posts location updates. This does not involve any system Location APIs and th
us | 13 * posts location updates. This does not involve any system Location APIs and th
us |
| 17 * does not require any special permissions in the test app or on the device. | 14 * does not require any special permissions in the test app or on the device. |
| 18 */ | 15 */ |
| 19 public class MockLocationProvider implements LocationProviderFactory.LocationPro
vider { | 16 public class MockLocationProvider implements LocationProviderFactory.LocationPro
vider { |
| 20 private boolean mIsRunning; | 17 private boolean mIsRunning; |
| 21 private Handler mHandler; | 18 private Handler mHandler; |
| 22 private HandlerThread mHandlerThread; | 19 private HandlerThread mHandlerThread; |
| 23 private final Object mLock = new Object(); | 20 private final Object mLock = new Object(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 private void newLocation() { | 80 private void newLocation() { |
| 84 LocationProviderAdapter.newLocationAvailable( | 81 LocationProviderAdapter.newLocationAvailable( |
| 85 0, 0, System.currentTimeMillis() / 1000.0, | 82 0, 0, System.currentTimeMillis() / 1000.0, |
| 86 false, 0, | 83 false, 0, |
| 87 true, 0.5, | 84 true, 0.5, |
| 88 false, 0, | 85 false, 0, |
| 89 false, 0); | 86 false, 0); |
| 90 } | 87 } |
| 91 }; | 88 }; |
| 92 | 89 |
| OLD | NEW |