OLD | NEW |
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.SmallTest; | 7 import android.test.suitebuilder.annotation.SmallTest; |
8 | 8 |
9 import org.chromium.base.annotations.SuppressFBWarnings; | 9 import org.chromium.base.annotations.SuppressFBWarnings; |
10 import org.chromium.base.test.util.CommandLineFlags; | 10 import org.chromium.base.test.util.CommandLineFlags; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 @Override | 250 @Override |
251 public void handleJavaScriptResult(String jsonResult) { | 251 public void handleJavaScriptResult(String jsonResult) { |
252 result[0] = jsonResult; | 252 result[0] = jsonResult; |
253 notifyResultIsReady(); | 253 notifyResultIsReady(); |
254 } | 254 } |
255 } | 255 } |
256 final ResultCallback resultCallback = new ResultCallback(); | 256 final ResultCallback resultCallback = new ResultCallback(); |
257 runTestOnUiThread(new Runnable() { | 257 runTestOnUiThread(new Runnable() { |
258 @Override | 258 @Override |
259 public void run() { | 259 public void run() { |
260 webContents.evaluateJavaScriptForTests(script, resultCallback); | 260 webContents.evaluateJavaScript(script, resultCallback); |
261 } | 261 } |
262 }); | 262 }); |
263 resultCallback.waitForResult(); | 263 resultCallback.waitForResult(); |
264 return result[0]; | 264 return result[0]; |
265 } | 265 } |
266 | 266 |
267 /** | 267 /** |
268 * Loads data on the UI thread and blocks until onPageFinished is called. | 268 * Loads data on the UI thread and blocks until onPageFinished is called. |
269 */ | 269 */ |
270 private void loadDataSync(final NavigationController navigationController, f
inal String data, | 270 private void loadDataSync(final NavigationController navigationController, f
inal String data, |
271 final String mimeType, final boolean isBase64Encoded) throws Throwab
le { | 271 final String mimeType, final boolean isBase64Encoded) throws Throwab
le { |
272 loadUrl(navigationController, mTestCallbackHelperContainer, | 272 loadUrl(navigationController, mTestCallbackHelperContainer, |
273 LoadUrlParams.createLoadDataParams(data, mimeType, isBase64Encod
ed)); | 273 LoadUrlParams.createLoadDataParams(data, mimeType, isBase64Encod
ed)); |
274 } | 274 } |
275 } | 275 } |
OLD | NEW |