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.graphics.Bitmap; | 7 import android.graphics.Bitmap; |
8 import android.graphics.Canvas; | 8 import android.graphics.Canvas; |
9 import android.graphics.Color; | 9 import android.graphics.Color; |
10 import android.test.suitebuilder.annotation.SmallTest; | 10 import android.test.suitebuilder.annotation.SmallTest; |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // display. | 244 // display. |
245 // http://crbug.com/364612 | 245 // http://crbug.com/364612 |
246 // | 246 // |
247 // The code here is waiting for the "link" (which is a full-screen blue
div) to appear on | 247 // The code here is waiting for the "link" (which is a full-screen blue
div) to appear on |
248 // screen. | 248 // screen. |
249 pollOnUiThread(new Callable<Boolean>() { | 249 pollOnUiThread(new Callable<Boolean>() { |
250 @Override | 250 @Override |
251 public Boolean call() throws Exception { | 251 public Boolean call() throws Exception { |
252 Bitmap bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_888
8); | 252 Bitmap bitmap = Bitmap.createBitmap(2, 2, Bitmap.Config.ARGB_888
8); |
253 Canvas canvas = new Canvas(bitmap); | 253 Canvas canvas = new Canvas(bitmap); |
254 canvas.translate(-(float)mTestContainerView.getWidth() / 2, | 254 canvas.translate(-(float) mTestContainerView.getWidth() / 2, |
255 -(float)mTestContainerView.getHeight() / 2); | 255 -(float) mTestContainerView.getHeight() / 2); |
256 mAwContents.onDraw(canvas); | 256 mAwContents.onDraw(canvas); |
257 return bitmap.getPixel(0, 0) == Color.BLUE; | 257 return bitmap.getPixel(0, 0) == Color.BLUE; |
258 } | 258 } |
259 }); | 259 }); |
260 callCount = mShouldInterceptRequestHelper.getCallCount(); | 260 callCount = mShouldInterceptRequestHelper.getCallCount(); |
261 AwTestTouchUtils.simulateTouchCenterOfView(mTestContainerView); | 261 AwTestTouchUtils.simulateTouchCenterOfView(mTestContainerView); |
262 mShouldInterceptRequestHelper.waitForCallback(callCount); | 262 mShouldInterceptRequestHelper.waitForCallback(callCount); |
263 assertEquals(true, | 263 assertEquals(true, |
264 mShouldInterceptRequestHelper.getParamsForUrl(aboutPageUrl).hasU
serGesture); | 264 mShouldInterceptRequestHelper.getParamsForUrl(aboutPageUrl).hasU
serGesture); |
265 } | 265 } |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 getInstrumentation().getTargetContext(), contentResourceName); | 800 getInstrumentation().getTargetContext(), contentResourceName); |
801 assertEquals(1, contentRequestCount); | 801 assertEquals(1, contentRequestCount); |
802 } | 802 } |
803 | 803 |
804 @SmallTest | 804 @SmallTest |
805 @Feature({"AndroidWebView"}) | 805 @Feature({"AndroidWebView"}) |
806 public void testCalledForNonexistentContentUrl() throws Throwable { | 806 public void testCalledForNonexistentContentUrl() throws Throwable { |
807 calledForUrlTemplate("content://org.chromium.webview.NoSuchProvider/foo"
); | 807 calledForUrlTemplate("content://org.chromium.webview.NoSuchProvider/foo"
); |
808 } | 808 } |
809 } | 809 } |
OLD | NEW |