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

Side by Side Diff: content/public/android/javatests/src/org/chromium/content/browser/TestsJavaScriptEvalTest.java

Issue 744453002: Fix a bunch of Java Checkstyle issues. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.test.suitebuilder.annotation.LargeTest; 7 import android.test.suitebuilder.annotation.LargeTest;
8 8
9 import org.chromium.base.test.util.Feature; 9 import org.chromium.base.test.util.Feature;
10 import org.chromium.base.test.util.UrlUtils; 10 import org.chromium.base.test.util.UrlUtils;
11 import org.chromium.content.browser.test.util.DOMUtils; 11 import org.chromium.content.browser.test.util.DOMUtils;
12 import org.chromium.content_public.browser.WebContents; 12 import org.chromium.content_public.browser.WebContents;
13 import org.chromium.content_shell_apk.ContentShellTestBase; 13 import org.chromium.content_shell_apk.ContentShellTestBase;
14 14
15 /** 15 /**
16 * Integration tests for JavaScript execution. 16 * Integration tests for JavaScript execution.
17 */ 17 */
18 public class TestsJavaScriptEvalTest extends ContentShellTestBase { 18 public class TestsJavaScriptEvalTest extends ContentShellTestBase {
19 private static final String JSTEST_URL = UrlUtils.encodeHtmlDataUri( 19 private static final String JSTEST_URL = UrlUtils.encodeHtmlDataUri("<html>< head><script>"
20 "<html><head><script>" + 20 + " function foobar() { return 'foobar'; }"
21 " function foobar() { return 'foobar'; }" + 21 + "</script></head>"
22 "</script></head>" + 22 + "<body><button id=\"test\">Test button</button></body></html>");
23 "<body><button id=\"test\">Test button</button></body></html>");
24 23
25 public TestsJavaScriptEvalTest() { 24 public TestsJavaScriptEvalTest() {
26 } 25 }
27 26
28 /** 27 /**
29 * Tests that evaluation of JavaScript for test purposes (using JavaScriptUt ils, DOMUtils etc) 28 * Tests that evaluation of JavaScript for test purposes (using JavaScriptUt ils, DOMUtils etc)
30 * works even in presence of "background" (non-test-initiated) JavaScript ev aluation activity. 29 * works even in presence of "background" (non-test-initiated) JavaScript ev aluation activity.
31 */ 30 */
32 @LargeTest 31 @LargeTest
33 @Feature({"Browser"}) 32 @Feature({"Browser"})
34 public void testJavaScriptEvalIsCorrectlyOrdered() 33 public void testJavaScriptEvalIsCorrectlyOrdered()
35 throws InterruptedException, Exception, Throwable { 34 throws InterruptedException, Exception, Throwable {
36 launchContentShellWithUrl(JSTEST_URL); 35 launchContentShellWithUrl(JSTEST_URL);
37 assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading()); 36 assertTrue("Page failed to load", waitForActiveShellToBeDoneLoading());
38 37
39 final WebContents webContents = getWebContents(); 38 final WebContents webContents = getWebContents();
40 for (int i = 0; i < 30; ++i) { 39 for (int i = 0; i < 30; ++i) {
41 for (int j = 0; j < 10; ++j) { 40 for (int j = 0; j < 10; ++j) {
42 // Start evaluation of a JavaScript script -- we don't need a re sult. 41 // Start evaluation of a JavaScript script -- we don't need a re sult.
43 webContents.evaluateJavaScript("foobar();", null); 42 webContents.evaluateJavaScript("foobar();", null);
44 } 43 }
45 // DOMUtils does need to evaluate a JavaScript and get its result to get DOM bounds. 44 // DOMUtils does need to evaluate a JavaScript and get its result to get DOM bounds.
46 assertNotNull("Failed to get bounds", 45 assertNotNull("Failed to get bounds",
47 DOMUtils.getNodeBounds(webContents, "test")); 46 DOMUtils.getNodeBounds(webContents, "test"));
48 } 47 }
49 } 48 }
50 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698