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

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

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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.MediumTest; 7 import android.test.suitebuilder.annotation.MediumTest;
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 final String urlLoadTime = UrlUtils.encodeHtmlDataUri(htmlLoadTime); 111 final String urlLoadTime = UrlUtils.encodeHtmlDataUri(htmlLoadTime);
112 112
113 ContentShellActivity activity = launchContentShellWithUrl(urlLoadTime); 113 ContentShellActivity activity = launchContentShellWithUrl(urlLoadTime);
114 waitForActiveShellToBeDoneLoading(); 114 waitForActiveShellToBeDoneLoading();
115 ContentViewCore contentViewCore = activity.getActiveContentViewCore(); 115 ContentViewCore contentViewCore = activity.getActiveContentViewCore();
116 TestCallbackHelperContainer testCallbackHelperContainer = 116 TestCallbackHelperContainer testCallbackHelperContainer =
117 new TestCallbackHelperContainer(contentViewCore); 117 new TestCallbackHelperContainer(contentViewCore);
118 OnEvaluateJavaScriptResultHelper javascriptHelper = new OnEvaluateJavaSc riptResultHelper(); 118 OnEvaluateJavaScriptResultHelper javascriptHelper = new OnEvaluateJavaSc riptResultHelper();
119 119
120 // Grab the first timestamp. 120 // Grab the first timestamp.
121 javascriptHelper.evaluateJavaScript(contentViewCore.getWebContents(), "g etLoadtime();"); 121 javascriptHelper.evaluateJavaScriptForTests(
122 contentViewCore.getWebContents(), "getLoadtime();");
122 javascriptHelper.waitUntilHasValue(); 123 javascriptHelper.waitUntilHasValue();
123 String firstTimestamp = javascriptHelper.getJsonResultAndClear(); 124 String firstTimestamp = javascriptHelper.getJsonResultAndClear();
124 assertNotNull("Timestamp was null.", firstTimestamp); 125 assertNotNull("Timestamp was null.", firstTimestamp);
125 126
126 // Grab the timestamp after a reload and make sure they don't match. 127 // Grab the timestamp after a reload and make sure they don't match.
127 reload(contentViewCore.getWebContents().getNavigationController(), 128 reload(contentViewCore.getWebContents().getNavigationController(),
128 testCallbackHelperContainer); 129 testCallbackHelperContainer);
129 javascriptHelper.evaluateJavaScript(contentViewCore.getWebContents(), "g etLoadtime();"); 130 javascriptHelper.evaluateJavaScriptForTests(
131 contentViewCore.getWebContents(), "getLoadtime();");
130 javascriptHelper.waitUntilHasValue(); 132 javascriptHelper.waitUntilHasValue();
131 String secondTimestamp = javascriptHelper.getJsonResultAndClear(); 133 String secondTimestamp = javascriptHelper.getJsonResultAndClear();
132 assertNotNull("Timestamp was null.", secondTimestamp); 134 assertNotNull("Timestamp was null.", secondTimestamp);
133 assertFalse("Timestamps matched.", firstTimestamp.equals(secondTimestamp )); 135 assertFalse("Timestamps matched.", firstTimestamp.equals(secondTimestamp ));
134 } 136 }
135 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698