| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 { | 813 { |
| 814 registerMockedHttpURLLoad("postmessage_test.html"); | 814 registerMockedHttpURLLoad("postmessage_test.html"); |
| 815 | 815 |
| 816 // Pass true to enable JavaScript. | 816 // Pass true to enable JavaScript. |
| 817 FrameTestHelpers::WebViewHelper webViewHelper(this); | 817 FrameTestHelpers::WebViewHelper webViewHelper(this); |
| 818 webViewHelper.initializeAndLoad(m_baseURL + "postmessage_test.html", true); | 818 webViewHelper.initializeAndLoad(m_baseURL + "postmessage_test.html", true); |
| 819 | 819 |
| 820 // Send a message with the correct origin. | 820 // Send a message with the correct origin. |
| 821 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL))
); | 821 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL))
); |
| 822 WebDocument document = webViewHelper.webView()->mainFrame()->document(); | 822 WebDocument document = webViewHelper.webView()->mainFrame()->document(); |
| 823 WebDOMEvent event = document.createEvent("MessageEvent"); | |
| 824 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); | |
| 825 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); | 823 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); |
| 826 message.initMessageEvent("message", false, false, data, "http://origin.com",
0, document, ""); | 824 WebDOMMessageEvent message(data, "http://origin.com"); |
| 827 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(co
rrectOrigin, message); | 825 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(co
rrectOrigin, message); |
| 828 | 826 |
| 829 // Send another message with incorrect origin. | 827 // Send another message with incorrect origin. |
| 830 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeU
RL))); | 828 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeU
RL))); |
| 831 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(in
correctOrigin, message); | 829 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(in
correctOrigin, message); |
| 832 | 830 |
| 833 // Required to see any updates in contentAsText. | 831 // Required to see any updates in contentAsText. |
| 834 webViewHelper.webView()->layout(); | 832 webViewHelper.webView()->layout(); |
| 835 | 833 |
| 836 // Verify that only the first addition is in the body of the page. | 834 // Verify that only the first addition is in the body of the page. |
| (...skipping 7385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8222 | 8220 |
| 8223 TEST_F(WebFrameTest, MaxFramesDetach) | 8221 TEST_F(WebFrameTest, MaxFramesDetach) |
| 8224 { | 8222 { |
| 8225 registerMockedHttpURLLoad("max-frames-detach.html"); | 8223 registerMockedHttpURLLoad("max-frames-detach.html"); |
| 8226 FrameTestHelpers::WebViewHelper webViewHelper; | 8224 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8227 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 8225 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
| 8228 webViewImpl->mainFrameImpl()->collectGarbage(); | 8226 webViewImpl->mainFrameImpl()->collectGarbage(); |
| 8229 } | 8227 } |
| 8230 | 8228 |
| 8231 } // namespace blink | 8229 } // namespace blink |
| OLD | NEW |