OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.Build; | 7 import android.os.Build; |
8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
9 import android.webkit.JavascriptInterface; | 9 import android.webkit.JavascriptInterface; |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 } | 63 } |
64 }); | 64 }); |
65 | 65 |
66 loadDataSync(awContents, mContentsClient.getOnPageFinishedHelper(), html
, | 66 loadDataSync(awContents, mContentsClient.getOnPageFinishedHelper(), html
, |
67 "text/html", false); | 67 "text/html", false); |
68 | 68 |
69 // Ensure the JS interface object is there, and invoke the test method. | 69 // Ensure the JS interface object is there, and invoke the test method. |
70 assertEquals("\"function\"", executeJavaScriptAndWaitForResult( | 70 assertEquals("\"function\"", executeJavaScriptAndWaitForResult( |
71 awContents, mContentsClient, "typeof test.destroy")); | 71 awContents, mContentsClient, "typeof test.destroy")); |
72 int currentCallCount = client2.getOnPageFinishedHelper().getCallCount(); | 72 int currentCallCount = client2.getOnPageFinishedHelper().getCallCount(); |
73 awContents.evaluateJavaScriptForTests("test.destroy()", null); | 73 awContents.evaluateJavaScript("test.destroy()", null); |
74 | 74 |
75 client2.getOnPageFinishedHelper().waitForCallback(currentCallCount); | 75 client2.getOnPageFinishedHelper().waitForCallback(currentCallCount); |
76 } | 76 } |
77 | 77 |
78 @SmallTest | 78 @SmallTest |
79 @Feature({"AndroidWebView", "Android-JavaBridge"}) | 79 @Feature({"AndroidWebView", "Android-JavaBridge"}) |
80 public void testTwoWebViewsCreatedSimultaneously() throws Throwable { | 80 public void testTwoWebViewsCreatedSimultaneously() throws Throwable { |
81 final AwContents awContents1 = mTestContainerView.getAwContents(); | 81 final AwContents awContents1 = mTestContainerView.getAwContents(); |
82 final TestAwContentsClient client2 = new TestAwContentsClient(); | 82 final TestAwContentsClient client2 = new TestAwContentsClient(); |
83 final AwTestContainerView view2 = createAwTestContainerViewOnMainSync(cl
ient2); | 83 final AwTestContainerView view2 = createAwTestContainerViewOnMainSync(cl
ient2); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 }); | 158 }); |
159 loadDataSync(awContents2, client2.getOnPageFinishedHelper(), html, | 159 loadDataSync(awContents2, client2.getOnPageFinishedHelper(), html, |
160 "text/html", false); | 160 "text/html", false); |
161 | 161 |
162 assertEquals("1", | 162 assertEquals("1", |
163 executeJavaScriptAndWaitForResult(awContents1, mContentsClient,
"test.getValue()")); | 163 executeJavaScriptAndWaitForResult(awContents1, mContentsClient,
"test.getValue()")); |
164 assertEquals("2", | 164 assertEquals("2", |
165 executeJavaScriptAndWaitForResult(awContents2, client2, "test.ge
tValue()")); | 165 executeJavaScriptAndWaitForResult(awContents2, client2, "test.ge
tValue()")); |
166 } | 166 } |
167 } | 167 } |
OLD | NEW |