OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 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 | 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.android_webview.test; | 5 package org.chromium.android_webview.test; |
6 | 6 |
7 import android.content.BroadcastReceiver; | 7 import android.content.BroadcastReceiver; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.Intent; | 9 import android.content.Intent; |
10 import android.content.IntentFilter; | 10 import android.content.IntentFilter; |
11 import android.net.Proxy; | 11 import android.net.Proxy; |
12 import android.os.Build; | 12 import android.os.Build; |
13 import android.test.mock.MockContext; | 13 import android.test.mock.MockContext; |
14 import android.test.suitebuilder.annotation.SmallTest; | 14 import android.test.suitebuilder.annotation.SmallTest; |
15 | 15 |
16 import org.chromium.android_webview.AwContents; | 16 import org.chromium.android_webview.AwContents; |
| 17 import org.chromium.base.annotations.SuppressFBWarnings; |
17 import org.chromium.base.test.util.Feature; | 18 import org.chromium.base.test.util.Feature; |
18 import org.chromium.base.test.util.MinAndroidSdkLevel; | 19 import org.chromium.base.test.util.MinAndroidSdkLevel; |
19 import org.chromium.content.browser.ContentViewCore; | 20 import org.chromium.content.browser.ContentViewCore; |
20 import org.chromium.content.browser.ContentViewStatics; | 21 import org.chromium.content.browser.ContentViewStatics; |
21 import org.chromium.net.ProxyChangeListener; | 22 import org.chromium.net.ProxyChangeListener; |
22 | 23 |
23 import java.util.concurrent.atomic.AtomicBoolean; | 24 import java.util.concurrent.atomic.AtomicBoolean; |
24 import java.util.concurrent.atomic.AtomicReference; | 25 import java.util.concurrent.atomic.AtomicReference; |
25 | 26 |
26 /** | 27 /** |
27 * Tests for ContentView methods that don't fall into any other category. | 28 * Tests for ContentView methods that don't fall into any other category. |
28 */ | 29 */ |
29 @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT) | 30 @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT) |
30 public class ContentViewMiscTest extends AwTestBase { | 31 public class ContentViewMiscTest extends AwTestBase { |
31 | 32 |
32 private TestAwContentsClient mContentsClient; | 33 private TestAwContentsClient mContentsClient; |
33 private AwContents mAwContents; | 34 private AwContents mAwContents; |
34 private ContentViewCore mContentViewCore; | 35 private ContentViewCore mContentViewCore; |
35 | 36 |
| 37 @SuppressFBWarnings("URF_UNREAD_FIELD") |
36 @Override | 38 @Override |
37 public void setUp() throws Exception { | 39 public void setUp() throws Exception { |
38 super.setUp(); | 40 super.setUp(); |
39 mContentsClient = new TestAwContentsClient(); | 41 mContentsClient = new TestAwContentsClient(); |
40 final AwTestContainerView testContainerView = | 42 final AwTestContainerView testContainerView = |
41 createAwTestContainerViewOnMainSync(mContentsClient); | 43 createAwTestContainerViewOnMainSync(mContentsClient); |
42 mAwContents = testContainerView.getAwContents(); | 44 mAwContents = testContainerView.getAwContents(); |
43 mContentViewCore = testContainerView.getContentViewCore(); | 45 mContentViewCore = testContainerView.getContentViewCore(); |
44 } | 46 } |
45 | 47 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 ContentViewStatics.disablePlatformNotifications(); | 106 ContentViewStatics.disablePlatformNotifications(); |
105 receiverRef.get().onReceive(context, intent); | 107 receiverRef.get().onReceive(context, intent); |
106 assertEquals(false, proxyChanged.get()); | 108 assertEquals(false, proxyChanged.get()); |
107 | 109 |
108 // Now re-enable notifications to make sure they work again. | 110 // Now re-enable notifications to make sure they work again. |
109 ContentViewStatics.enablePlatformNotifications(); | 111 ContentViewStatics.enablePlatformNotifications(); |
110 receiverRef.get().onReceive(context, intent); | 112 receiverRef.get().onReceive(context, intent); |
111 assertEquals(true, proxyChanged.get()); | 113 assertEquals(true, proxyChanged.get()); |
112 } | 114 } |
113 } | 115 } |
OLD | NEW |