| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.os.Handler; | 7 import android.os.Handler; |
| 8 import android.os.Looper; | 8 import android.os.Looper; |
| 9 import android.test.suitebuilder.annotation.SmallTest; | 9 import android.test.suitebuilder.annotation.SmallTest; |
| 10 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 super.tearDown(); | 46 super.tearDown(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 @Feature({"AndroidWebView"}) | 49 @Feature({"AndroidWebView"}) |
| 50 @SmallTest | 50 @SmallTest |
| 51 public void testRequestMultiple() throws Throwable { | 51 public void testRequestMultiple() throws Throwable { |
| 52 mPage = mTestWebServer.setResponse("/permissions", REQUEST_DUPLICATE, | 52 mPage = mTestWebServer.setResponse("/permissions", REQUEST_DUPLICATE, |
| 53 CommonResources.getTextHtmlHeaders(true)); | 53 CommonResources.getTextHtmlHeaders(true)); |
| 54 | 54 |
| 55 TestAwContentsClient contentsClient = new TestAwContentsClient() { | 55 TestAwContentsClient contentsClient = new TestAwContentsClient() { |
| 56 private boolean mCalled = false; | 56 private boolean mCalled; |
| 57 | 57 |
| 58 @Override | 58 @Override |
| 59 public void onPermissionRequest(final AwPermissionRequest awPermissi
onRequest) { | 59 public void onPermissionRequest(final AwPermissionRequest awPermissi
onRequest) { |
| 60 if (mCalled) { | 60 if (mCalled) { |
| 61 fail("Only one request was expected"); | 61 fail("Only one request was expected"); |
| 62 return; | 62 return; |
| 63 } | 63 } |
| 64 mCalled = true; | 64 mCalled = true; |
| 65 | 65 |
| 66 // Emulate a delayed response to the request by running four sec
onds in the future. | 66 // Emulate a delayed response to the request by running four sec
onds in the future. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 86 throws Exception { | 86 throws Exception { |
| 87 pollInstrumentationThread(new Callable<Boolean>() { | 87 pollInstrumentationThread(new Callable<Boolean>() { |
| 88 @Override | 88 @Override |
| 89 public Boolean call() throws Exception { | 89 public Boolean call() throws Exception { |
| 90 return title.equals(getTitleOnUiThread(awContents)); | 90 return title.equals(getTitleOnUiThread(awContents)); |
| 91 } | 91 } |
| 92 }); | 92 }); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| OLD | NEW |