| 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.evaluateJavaScriptForTests( | 121 javascriptHelper.evaluateJavaScript(contentViewCore.getWebContents(), "g
etLoadtime();"); |
| 122 contentViewCore.getWebContents(), "getLoadtime();"); | |
| 123 javascriptHelper.waitUntilHasValue(); | 122 javascriptHelper.waitUntilHasValue(); |
| 124 String firstTimestamp = javascriptHelper.getJsonResultAndClear(); | 123 String firstTimestamp = javascriptHelper.getJsonResultAndClear(); |
| 125 assertNotNull("Timestamp was null.", firstTimestamp); | 124 assertNotNull("Timestamp was null.", firstTimestamp); |
| 126 | 125 |
| 127 // Grab the timestamp after a reload and make sure they don't match. | 126 // Grab the timestamp after a reload and make sure they don't match. |
| 128 reload(contentViewCore.getWebContents().getNavigationController(), | 127 reload(contentViewCore.getWebContents().getNavigationController(), |
| 129 testCallbackHelperContainer); | 128 testCallbackHelperContainer); |
| 130 javascriptHelper.evaluateJavaScriptForTests( | 129 javascriptHelper.evaluateJavaScript(contentViewCore.getWebContents(), "g
etLoadtime();"); |
| 131 contentViewCore.getWebContents(), "getLoadtime();"); | |
| 132 javascriptHelper.waitUntilHasValue(); | 130 javascriptHelper.waitUntilHasValue(); |
| 133 String secondTimestamp = javascriptHelper.getJsonResultAndClear(); | 131 String secondTimestamp = javascriptHelper.getJsonResultAndClear(); |
| 134 assertNotNull("Timestamp was null.", secondTimestamp); | 132 assertNotNull("Timestamp was null.", secondTimestamp); |
| 135 assertFalse("Timestamps matched.", firstTimestamp.equals(secondTimestamp
)); | 133 assertFalse("Timestamps matched.", firstTimestamp.equals(secondTimestamp
)); |
| 136 } | 134 } |
| 137 } | 135 } |
| OLD | NEW |