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 junit.framework.Assert; | 7 import junit.framework.Assert; |
8 | 8 |
9 import org.chromium.content_public.browser.LoadUrlParams; | 9 import org.chromium.content_public.browser.LoadUrlParams; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 protected void executeJavaScript(final String script) throws Throwable { | 37 protected void executeJavaScript(final String script) throws Throwable { |
38 runTestOnUiThread(new Runnable() { | 38 runTestOnUiThread(new Runnable() { |
39 @Override | 39 @Override |
40 public void run() { | 40 public void run() { |
41 // When a JavaScript URL is executed, if the value of the last | 41 // When a JavaScript URL is executed, if the value of the last |
42 // expression evaluated is not 'undefined', this value is | 42 // expression evaluated is not 'undefined', this value is |
43 // converted to a string and used as the new document for the | 43 // converted to a string and used as the new document for the |
44 // frame. We don't want this behaviour, so wrap the script in | 44 // frame. We don't want this behaviour, so wrap the script in |
45 // an anonymous function. | 45 // an anonymous function. |
46 getContentViewCore().getWebContents().getNavigationController().
loadUrl( | 46 getWebContents().getNavigationController().loadUrl( |
47 new LoadUrlParams("javascript:(function() { " + script +
" })()")); | 47 new LoadUrlParams("javascript:(function() { " + script +
" })()")); |
48 } | 48 } |
49 }); | 49 }); |
50 } | 50 } |
51 } | 51 } |
OLD | NEW |