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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/JavaScriptEvalChromeTest.java

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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 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.chrome.browser; 5 package org.chromium.chrome.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;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 assertFalse("Tab didn't open", tab1 == tab2); 48 assertFalse("Tab didn't open", tab1 == tab2);
49 49
50 JavaScriptUtils.executeJavaScriptAndWaitForResult( 50 JavaScriptUtils.executeJavaScriptAndWaitForResult(
51 tab1.getWebContents(), "counter = 0;"); 51 tab1.getWebContents(), "counter = 0;");
52 JavaScriptUtils.executeJavaScriptAndWaitForResult( 52 JavaScriptUtils.executeJavaScriptAndWaitForResult(
53 tab2.getWebContents(), "counter = 1;"); 53 tab2.getWebContents(), "counter = 1;");
54 54
55 for (int i = 1; i <= 30; ++i) { 55 for (int i = 1; i <= 30; ++i) {
56 for (int j = 0; j < 5; ++j) { 56 for (int j = 0; j < 5; ++j) {
57 // Start evaluation of a JavaScript script -- we don't need a re sult. 57 // Start evaluation of a JavaScript script -- we don't need a re sult.
58 tab1.getWebContents().evaluateJavaScriptForTests("foobar();", nu ll); 58 tab1.getWebContents().evaluateJavaScript("foobar();", null);
59 tab2.getWebContents().evaluateJavaScriptForTests("foobar();", nu ll); 59 tab2.getWebContents().evaluateJavaScript("foobar();", null);
60 } 60 }
61 assertEquals("Incorrect JavaScript evaluation result on tab1", 61 assertEquals("Incorrect JavaScript evaluation result on tab1",
62 i * 2, 62 i * 2,
63 Integer.parseInt( 63 Integer.parseInt(
64 JavaScriptUtils.executeJavaScriptAndWaitForResult( 64 JavaScriptUtils.executeJavaScriptAndWaitForResult(
65 tab1.getWebContents(), "add2()"))); 65 tab1.getWebContents(), "add2()")));
66 for (int j = 0; j < 5; ++j) { 66 for (int j = 0; j < 5; ++j) {
67 // Start evaluation of a JavaScript script -- we don't need a re sult. 67 // Start evaluation of a JavaScript script -- we don't need a re sult.
68 tab1.getWebContents().evaluateJavaScriptForTests("foobar();", nu ll); 68 tab1.getWebContents().evaluateJavaScript("foobar();", null);
69 tab2.getWebContents().evaluateJavaScriptForTests("foobar();", nu ll); 69 tab2.getWebContents().evaluateJavaScript("foobar();", null);
70 } 70 }
71 assertEquals("Incorrect JavaScript evaluation result on tab2", 71 assertEquals("Incorrect JavaScript evaluation result on tab2",
72 i * 2 + 1, 72 i * 2 + 1,
73 Integer.parseInt( 73 Integer.parseInt(
74 JavaScriptUtils.executeJavaScriptAndWaitForResult( 74 JavaScriptUtils.executeJavaScriptAndWaitForResult(
75 tab2.getWebContents(), "add2()"))); 75 tab2.getWebContents(), "add2()")));
76 } 76 }
77 } 77 }
78 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698