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

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/ContentViewMiscTest.java

Issue 2803163002: Move address parser and prefixes to android_webview/. (Closed)
Patch Set: Bring back ContentViewStatics import 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 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.support.test.filters.SmallTest; 12 import android.support.test.filters.SmallTest;
13 import android.test.mock.MockContext; 13 import android.test.mock.MockContext;
14 14
15 import org.chromium.android_webview.AwContents; 15 import org.chromium.android_webview.AwContents;
16 import org.chromium.android_webview.AwContentsStatics;
16 import org.chromium.base.annotations.SuppressFBWarnings; 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.content.browser.ContentViewCore; 19 import org.chromium.content.browser.ContentViewCore;
19 import org.chromium.content.browser.ContentViewStatics; 20 import org.chromium.content.browser.ContentViewStatics;
20 import org.chromium.net.ProxyChangeListener; 21 import org.chromium.net.ProxyChangeListener;
21 22
22 import java.util.concurrent.atomic.AtomicBoolean; 23 import java.util.concurrent.atomic.AtomicBoolean;
23 import java.util.concurrent.atomic.AtomicReference; 24 import java.util.concurrent.atomic.AtomicReference;
24 25
25 /** 26 /**
(...skipping 12 matching lines...) Expand all
38 mContentsClient = new TestAwContentsClient(); 39 mContentsClient = new TestAwContentsClient();
39 final AwTestContainerView testContainerView = 40 final AwTestContainerView testContainerView =
40 createAwTestContainerViewOnMainSync(mContentsClient); 41 createAwTestContainerViewOnMainSync(mContentsClient);
41 mAwContents = testContainerView.getAwContents(); 42 mAwContents = testContainerView.getAwContents();
42 mContentViewCore = testContainerView.getContentViewCore(); 43 mContentViewCore = testContainerView.getContentViewCore();
43 } 44 }
44 45
45 @SmallTest 46 @SmallTest
46 @Feature({"AndroidWebView"}) 47 @Feature({"AndroidWebView"})
47 public void testFindAddress() { 48 public void testFindAddress() {
48 assertNull(ContentViewStatics.findAddress("This is some random text")); 49 assertNull(AwContentsStatics.findAddress("This is some random text"));
49 50
50 String googleAddr = "1600 Amphitheatre Pkwy, Mountain View, CA 94043"; 51 String googleAddr = "1600 Amphitheatre Pkwy, Mountain View, CA 94043";
51 String testString = "Address: " + googleAddr + " in a string"; 52 String testString = "Address: " + googleAddr + " in a string";
52 assertEquals(googleAddr, ContentViewStatics.findAddress(testString)); 53 assertEquals(googleAddr, AwContentsStatics.findAddress(testString));
53 } 54 }
54 55
55 @SmallTest 56 @SmallTest
56 @Feature({"AndroidWebView"}) 57 @Feature({"AndroidWebView"})
57 public void testEnableDisablePlatformNotifications() { 58 public void testEnableDisablePlatformNotifications() {
58 59
59 // Set up mock contexts to use with the listener 60 // Set up mock contexts to use with the listener
60 final AtomicReference<BroadcastReceiver> receiverRef = 61 final AtomicReference<BroadcastReceiver> receiverRef =
61 new AtomicReference<BroadcastReceiver>(); 62 new AtomicReference<BroadcastReceiver>();
62 final MockContext appContext = new MockContext() { 63 final MockContext appContext = new MockContext() {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 ContentViewStatics.disablePlatformNotifications(); 104 ContentViewStatics.disablePlatformNotifications();
104 receiverRef.get().onReceive(context, intent); 105 receiverRef.get().onReceive(context, intent);
105 assertEquals(false, proxyChanged.get()); 106 assertEquals(false, proxyChanged.get());
106 107
107 // Now re-enable notifications to make sure they work again. 108 // Now re-enable notifications to make sure they work again.
108 ContentViewStatics.enablePlatformNotifications(); 109 ContentViewStatics.enablePlatformNotifications();
109 receiverRef.get().onReceive(context, intent); 110 receiverRef.get().onReceive(context, intent);
110 assertEquals(true, proxyChanged.get()); 111 assertEquals(true, proxyChanged.get());
111 } 112 }
112 } 113 }
OLDNEW
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContentsStatics.java ('k') | android_webview/native/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698