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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/LocationProviderTest.java

Issue 2847523002: Android: Remove GetApplicationContext part 4 (Closed)
Patch Set: fix cronet Created 3 years, 7 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
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.content.browser;
6
7 import android.app.Activity;
8 import android.support.test.annotation.UiThreadTest;
9 import android.support.test.filters.SmallTest;
10 import android.support.test.rule.UiThreadTestRule;
11
12 import org.junit.Assert;
13 import org.junit.Before;
14 import org.junit.Rule;
15 import org.junit.Test;
16 import org.junit.runner.RunWith;
17
18 import org.chromium.base.annotations.SuppressFBWarnings;
19 import org.chromium.base.test.util.Feature;
20 import org.chromium.content.browser.test.ContentJUnit4ClassRunner;
21 import org.chromium.device.geolocation.LocationProviderAdapter;
22
23 /**
24 * Test suite for LocationProvider.
25 */
26 @RunWith(ContentJUnit4ClassRunner.class)
27 public class LocationProviderTest {
28 private Activity mActivity;
29 private LocationProviderAdapter mLocationProvider;
30
31 @Rule
32 public UiThreadTestRule mRule = new UiThreadTestRule();
33
34 @Before
35 @SuppressFBWarnings("URF_UNREAD_FIELD")
36 public void setUp() {
37 mActivity = new Activity();
agrieve 2017/05/04 15:55:50 unused?
Peter Wen 2017/05/04 17:39:26 Opps, this was moved in a rebase.
38 mLocationProvider = LocationProviderAdapter.create();
39 }
40
41 /**
42 * Verify a normal start/stop call pair without any activity pauses.
43 */
44 @Test
45 @SmallTest
46 @UiThreadTest
47 @Feature({"Location"})
48 public void testStartStop() throws Exception {
49 mLocationProvider.start(false);
50 Assert.assertTrue("Should be running", mLocationProvider.isRunning());
51 mLocationProvider.stop();
52 Assert.assertFalse("Should have stopped", mLocationProvider.isRunning()) ;
53 }
54
55 /**
56 * Verify a start/upgrade/stop call sequence without any activity pauses.
57 */
58 @Test
59 @SmallTest
60 @UiThreadTest
61 @Feature({"Location"})
62 public void testStartUpgradeStop() throws Exception {
63 mLocationProvider.start(false);
64 Assert.assertTrue("Should be running", mLocationProvider.isRunning());
65 mLocationProvider.start(true);
66 Assert.assertTrue("Should be running", mLocationProvider.isRunning());
67 mLocationProvider.stop();
68 Assert.assertFalse("Should have stopped", mLocationProvider.isRunning()) ;
69 }
70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698