| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.test.util.Feature; | 9 import org.chromium.base.test.util.Feature; |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 protected void setUp() throws Exception { | 65 protected void setUp() throws Exception { |
| 66 super.setUp(); | 66 super.setUp(); |
| 67 mMessageObject = new MessageObject(); | 67 mMessageObject = new MessageObject(); |
| 68 setUpContentView(mMessageObject, "messageObject"); | 68 setUpContentView(mMessageObject, "messageObject"); |
| 69 } | 69 } |
| 70 | 70 |
| 71 @SmallTest | 71 @SmallTest |
| 72 @Feature({"AndroidWebView", "Android-PostMessage"}) | 72 @Feature({"AndroidWebView", "Android-PostMessage"}) |
| 73 public void testPostMessageToMainFrame() throws Throwable { | 73 public void testPostMessageToMainFrame() throws Throwable { |
| 74 ContentViewCore contentViewCore = getContentViewCore(); | 74 ContentViewCore contentViewCore = getContentViewCore(); |
| 75 loadDataSync(contentViewCore, URL1, "text/html", false); | 75 loadDataSync(contentViewCore.getWebContents().getNavigationController(),
URL1, "text/html", |
| 76 false); |
| 76 contentViewCore.postMessageToFrame(null, MESSAGE, SOURCE_ORIGIN, "*"); | 77 contentViewCore.postMessageToFrame(null, MESSAGE, SOURCE_ORIGIN, "*"); |
| 77 mMessageObject.waitForMessage(); | 78 mMessageObject.waitForMessage(); |
| 78 assertEquals(MESSAGE, mMessageObject.getData()); | 79 assertEquals(MESSAGE, mMessageObject.getData()); |
| 79 assertEquals(SOURCE_ORIGIN, mMessageObject.getOrigin()); | 80 assertEquals(SOURCE_ORIGIN, mMessageObject.getOrigin()); |
| 80 } | 81 } |
| 81 } | 82 } |
| OLD | NEW |