Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: content/shell/android/javatests/src/org/chromium/content_shell/JavaBridgeChildFrameTest.java

Issue 10911131: Upstream JavaBridge tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update ContentShellTestBase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.content_shell;
6
7 import android.test.suitebuilder.annotation.SmallTest;
8
9 import org.chromium.base.test.Feature;
10
11 /**
12 * Part of the test suite for the WebView's Java Bridge.
13 *
14 * Ensures that injected objects are exposed to child frames as well as the
15 * main frame.
16 */
17 public class JavaBridgeChildFrameTest extends JavaBridgeTestBase {
18 private class TestController extends Controller {
19 private String mStringValue;
20
21 public synchronized void setStringValue(String x) {
22 mStringValue = x;
23 notifyResultIsReady();
24 }
25 public synchronized String waitForStringValue() {
26 waitForResult();
27 return mStringValue;
28 }
29 }
30
31 TestController mTestController;
32
33 @Override
34 protected void setUp() throws Exception {
35 super.setUp();
36 mTestController = new TestController();
37 setUpContentView(mTestController, "testController");
38 }
39
40 @SmallTest
41 @Feature({"Android-WebView", "Android-JavaBridge"})
42 public void testInjectedObjectPresentInChildFrame() throws Throwable {
43 // In the case that the test fails (i.e. the child frame doesn't get the injected object,
44 // the call to testController.setStringValue in the child frame's onload handler will
45 // not be made.
46 loadDataSync(getContentView(),
47 "<html><head></head><body>" +
48 "<iframe id=\"childFrame\" onload=\"testController.setStringValu e('PASS');\" />" +
49 "</body></html>", "text/html", false);
50 assertEquals("PASS", mTestController.waitForStringValue());
51 }
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698