OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |