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

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

Issue 11098030: Revert 160959 - [android_webview] Use AwContents loadUrl method instead of ContentViewCore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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.graphics.Bitmap; 11 import android.graphics.Bitmap;
12 import android.graphics.Color; 12 import android.graphics.Color;
13 import android.net.Proxy; 13 import android.net.Proxy;
14 import android.test.mock.MockContext; 14 import android.test.mock.MockContext;
15 import android.test.suitebuilder.annotation.SmallTest; 15 import android.test.suitebuilder.annotation.SmallTest;
16 16
17 import org.chromium.android_webview.AwContents;
18 import org.chromium.base.test.util.DisabledTest; 17 import org.chromium.base.test.util.DisabledTest;
19 import org.chromium.base.test.util.Feature; 18 import org.chromium.base.test.util.Feature;
20 import org.chromium.base.ThreadUtils; 19 import org.chromium.base.ThreadUtils;
21 import org.chromium.content.browser.ContentViewCore; 20 import org.chromium.content.browser.ContentViewCore;
22 import org.chromium.content.browser.ContentViewStatics; 21 import org.chromium.content.browser.ContentViewStatics;
23 import org.chromium.net.ProxyChangeListener; 22 import org.chromium.net.ProxyChangeListener;
24 23
25 import java.util.concurrent.atomic.AtomicBoolean; 24 import java.util.concurrent.atomic.AtomicBoolean;
26 import java.util.concurrent.atomic.AtomicReference; 25 import java.util.concurrent.atomic.AtomicReference;
27 import java.util.concurrent.Callable; 26 import java.util.concurrent.Callable;
28 27
29 /** 28 /**
30 * Tests for ContentView methods that don't fall into any other category. 29 * Tests for ContentView methods that don't fall into any other category.
31 */ 30 */
32 public class ContentViewMiscTest extends AndroidWebViewTestBase { 31 public class ContentViewMiscTest extends AndroidWebViewTestBase {
33 32
34 private TestAwContentsClient mContentsClient; 33 private TestAwContentsClient mContentsClient;
35 private AwContents mAwContents;
36 private ContentViewCore mContentViewCore; 34 private ContentViewCore mContentViewCore;
37 35
38 @Override 36 @Override
39 public void setUp() throws Exception { 37 public void setUp() throws Exception {
40 super.setUp(); 38 super.setUp();
41 mContentsClient = new TestAwContentsClient(); 39 mContentsClient = new TestAwContentsClient();
42 final AwTestContainerView testContainerView = 40 mContentViewCore =
43 createAwTestContainerViewOnMainSync(mContentsClient); 41 createAwTestContainerViewOnMainSync(mContentsClient).getContentV iewCore();
44 mAwContents = testContainerView.getAwContents();
45 mContentViewCore = testContainerView.getContentViewCore();
46 } 42 }
47 43
48 /** 44 /**
49 * @SmallTest 45 * @SmallTest
50 * @Feature({"Android-WebView"}) 46 * @Feature({"Android-WebView"})
51 * crbug.com/147721 47 * crbug.com/147721
52 */ 48 */
53 @DisabledTest 49 @DisabledTest
54 public void testFlingScroll() throws Throwable { 50 public void testFlingScroll() throws Throwable {
55 StringBuffer testPage = new StringBuffer().append("data:text/html;utf-8, ") 51 StringBuffer testPage = new StringBuffer().append("data:text/html;utf-8, ")
56 .append("<html><head><style>body { width: 5000px; height: 5000px ; }</head><body>") 52 .append("<html><head><style>body { width: 5000px; height: 5000px ; }</head><body>")
57 .append("</body></html>"); 53 .append("</body></html>");
58 54
59 // Test flinging in the y axis 55 // Test flinging in the y axis
60 loadUrlSync(mAwContents , mContentsClient.getOnPageFinishedHelper(), 56 loadUrlSync(mContentViewCore, mContentsClient.getOnPageFinishedHelper(),
61 testPage.toString()); 57 testPage.toString());
62 assertEquals(0, mContentViewCore.getNativeScrollYForTest()); 58 assertEquals(0, mContentViewCore.getNativeScrollYForTest());
63 ThreadUtils.runOnUiThread(new Runnable() { 59 ThreadUtils.runOnUiThread(new Runnable() {
64 @Override 60 @Override
65 public void run() { 61 public void run() {
66 mContentViewCore.flingScroll(0, 2000); 62 mContentViewCore.flingScroll(0, 2000);
67 } 63 }
68 }); 64 });
69 Thread.sleep(1000); 65 Thread.sleep(1000);
70 assertNotSame(0, mContentViewCore.getNativeScrollYForTest()); 66 assertNotSame(0, mContentViewCore.getNativeScrollYForTest());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 assertEquals(true, proxyChanged.get()); 144 assertEquals(true, proxyChanged.get());
149 } 145 }
150 146
151 /** 147 /**
152 * @SmallTest 148 * @SmallTest
153 * @Feature({"Android-WebView"}) 149 * @Feature({"Android-WebView"})
154 * Bug 6931901 150 * Bug 6931901
155 */ 151 */
156 @DisabledTest 152 @DisabledTest
157 public void testSetGetBackgroundColor() throws Throwable { 153 public void testSetGetBackgroundColor() throws Throwable {
158 loadUrlSync(mAwContents , mContentsClient.getOnPageFinishedHelper(), "ab out:blank"); 154 loadUrlSync(mContentViewCore, mContentsClient.getOnPageFinishedHelper(), "about:blank");
159 ThreadUtils.runOnUiThreadBlocking(new Runnable() { 155 ThreadUtils.runOnUiThreadBlocking(new Runnable() {
160 @Override 156 @Override
161 public void run() { 157 public void run() {
162 mContentViewCore.setBackgroundColor(Color.MAGENTA); 158 mContentViewCore.setBackgroundColor(Color.MAGENTA);
163 } 159 }
164 }); 160 });
165 int backgroundColor = ThreadUtils.runOnUiThreadBlocking(new Callable<Int eger>() { 161 int backgroundColor = ThreadUtils.runOnUiThreadBlocking(new Callable<Int eger>() {
166 @Override 162 @Override
167 public Integer call() { 163 public Integer call() {
168 Bitmap map = mContentViewCore.getBitmap(1, 1); 164 Bitmap map = mContentViewCore.getBitmap(1, 1);
169 return map.getPixel(0,0); 165 return map.getPixel(0,0);
170 } 166 }
171 }); 167 });
172 assertEquals(Color.MAGENTA, backgroundColor); 168 assertEquals(Color.MAGENTA, backgroundColor);
173 } 169 }
174 } 170 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698