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.base.annotations.SuppressFBWarnings; |
9 import org.chromium.content_public.browser.LoadUrlParams; | 10 import org.chromium.content_public.browser.LoadUrlParams; |
10 | 11 |
11 /** | 12 /** |
12 * Common functionality for testing the Java Bridge. | 13 * Common functionality for testing the Java Bridge. |
13 */ | 14 */ |
14 public class JavaBridgeTestBase extends ContentViewTestBase { | 15 public class JavaBridgeTestBase extends ContentViewTestBase { |
| 16 @SuppressFBWarnings("CHROMIUM_SYNCHRONIZED_METHOD") |
15 protected class Controller { | 17 protected class Controller { |
16 private boolean mIsResultReady; | 18 private boolean mIsResultReady; |
17 | 19 |
18 protected synchronized void notifyResultIsReady() { | 20 protected synchronized void notifyResultIsReady() { |
19 mIsResultReady = true; | 21 mIsResultReady = true; |
20 notify(); | 22 notify(); |
21 } | 23 } |
22 protected synchronized void waitForResult() { | 24 protected synchronized void waitForResult() { |
23 while (!mIsResultReady) { | 25 while (!mIsResultReady) { |
24 try { | 26 try { |
(...skipping 17 matching lines...) Expand all Loading... |
42 // expression evaluated is not 'undefined', this value is | 44 // expression evaluated is not 'undefined', this value is |
43 // converted to a string and used as the new document for the | 45 // 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 | 46 // frame. We don't want this behaviour, so wrap the script in |
45 // an anonymous function. | 47 // an anonymous function. |
46 getWebContents().getNavigationController().loadUrl( | 48 getWebContents().getNavigationController().loadUrl( |
47 new LoadUrlParams("javascript:(function() { " + script +
" })()")); | 49 new LoadUrlParams("javascript:(function() { " + script +
" })()")); |
48 } | 50 } |
49 }); | 51 }); |
50 } | 52 } |
51 } | 53 } |
OLD | NEW |