| OLD | NEW |
| 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.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.graphics.Rect; | 7 import android.graphics.Rect; |
| 8 import android.test.suitebuilder.annotation.LargeTest; | 8 import android.test.suitebuilder.annotation.LargeTest; |
| 9 | 9 |
| 10 import org.chromium.base.test.util.Feature; | 10 import org.chromium.base.test.util.Feature; |
| 11 import org.chromium.base.test.util.UrlUtils; | 11 import org.chromium.base.test.util.UrlUtils; |
| 12 import org.chromium.content.browser.test.util.Criteria; | 12 import org.chromium.content.browser.test.util.Criteria; |
| 13 import org.chromium.content.browser.test.util.CriteriaHelper; | 13 import org.chromium.content.browser.test.util.CriteriaHelper; |
| 14 import org.chromium.content.browser.test.util.DOMUtils; | 14 import org.chromium.content.browser.test.util.DOMUtils; |
| 15 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; | 15 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; |
| 16 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
FinishedHelper; | 16 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage
FinishedHelper; |
| 17 import org.chromium.content_shell_apk.ContentShellTestBase; | 17 import org.chromium.content_shell_apk.ContentShellTestBase; |
| 18 | 18 |
| 19 import java.util.concurrent.TimeUnit; | 19 import java.util.concurrent.TimeUnit; |
| 20 | 20 |
| 21 public class TestsJavaScriptEvalTest extends ContentShellTestBase { | 21 public class TestsJavaScriptEvalTest extends ContentShellTestBase { |
| 22 private static final int WAIT_TIMEOUT_SECONDS = 2; | |
| 23 private static final String JSTEST_URL = UrlUtils.encodeHtmlDataUri( | 22 private static final String JSTEST_URL = UrlUtils.encodeHtmlDataUri( |
| 24 "<html><head><script>" + | 23 "<html><head><script>" + |
| 25 " function foobar() { return 'foobar'; }" + | 24 " function foobar() { return 'foobar'; }" + |
| 26 "</script></head>" + | 25 "</script></head>" + |
| 27 "<body><button id=\"test\">Test button</button></body></html>"); | 26 "<body><button id=\"test\">Test button</button></body></html>"); |
| 28 | 27 |
| 29 public TestsJavaScriptEvalTest() { | 28 public TestsJavaScriptEvalTest() { |
| 30 } | 29 } |
| 31 | 30 |
| 32 /** | 31 /** |
| (...skipping 15 matching lines...) Expand all Loading... |
| 48 for(int j = 0; j < 10; ++j) { | 47 for(int j = 0; j < 10; ++j) { |
| 49 // Start evaluation of a JavaScript script -- we don't need a re
sult. | 48 // Start evaluation of a JavaScript script -- we don't need a re
sult. |
| 50 view.evaluateJavaScript("foobar();"); | 49 view.evaluateJavaScript("foobar();"); |
| 51 } | 50 } |
| 52 // DOMUtils does need to evaluate a JavaScript and get its result to
get DOM bounds. | 51 // DOMUtils does need to evaluate a JavaScript and get its result to
get DOM bounds. |
| 53 assertNotNull("Failed to get bounds", | 52 assertNotNull("Failed to get bounds", |
| 54 DOMUtils.getNodeBounds(view, viewClient, "test")); | 53 DOMUtils.getNodeBounds(view, viewClient, "test")); |
| 55 } | 54 } |
| 56 } | 55 } |
| 57 } | 56 } |
| OLD | NEW |