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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 1289033003: Start changing WebDOMMessageEvent for using target execution context. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed obsolote todo Created 5 years, 4 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
OLDNEW
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 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 TEST_P(ParameterizedWebFrameTest, DispatchMessageEventWithOriginCheck) 803 TEST_P(ParameterizedWebFrameTest, DispatchMessageEventWithOriginCheck)
804 { 804 {
805 registerMockedHttpURLLoad("postmessage_test.html"); 805 registerMockedHttpURLLoad("postmessage_test.html");
806 806
807 // Pass true to enable JavaScript. 807 // Pass true to enable JavaScript.
808 FrameTestHelpers::WebViewHelper webViewHelper(this); 808 FrameTestHelpers::WebViewHelper webViewHelper(this);
809 webViewHelper.initializeAndLoad(m_baseURL + "postmessage_test.html", true); 809 webViewHelper.initializeAndLoad(m_baseURL + "postmessage_test.html", true);
810 810
811 // Send a message with the correct origin. 811 // Send a message with the correct origin.
812 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)) ); 812 WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL)) );
813 WebDOMEvent event = webViewHelper.webView()->mainFrame()->document().createE vent("MessageEvent"); 813 WebDocument document = webViewHelper.webView()->mainFrame()->document();
814 WebDOMEvent event = document.createEvent("MessageEvent");
814 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); 815 WebDOMMessageEvent message = event.to<WebDOMMessageEvent>();
815 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); 816 WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo"));
816 message.initMessageEvent("message", false, false, data, "http://origin.com", 0, ""); 817 message.initMessageEvent("message", false, false, data, "http://origin.com", 0, document, "");
817 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(co rrectOrigin, message); 818 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(co rrectOrigin, message);
818 819
819 // Send another message with incorrect origin. 820 // Send another message with incorrect origin.
820 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeU RL))); 821 WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeU RL)));
821 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(in correctOrigin, message); 822 webViewHelper.webView()->mainFrame()->dispatchMessageEventWithOriginCheck(in correctOrigin, message);
822 823
823 // Required to see any updates in contentAsText. 824 // Required to see any updates in contentAsText.
824 webViewHelper.webView()->layout(); 825 webViewHelper.webView()->layout();
825 826
826 // Verify that only the first addition is in the body of the page. 827 // Verify that only the first addition is in the body of the page.
(...skipping 7213 matching lines...) Expand 10 before | Expand all | Expand 10 after
8040 8041
8041 TEST_F(WebFrameTest, MaxFramesDetach) 8042 TEST_F(WebFrameTest, MaxFramesDetach)
8042 { 8043 {
8043 registerMockedHttpURLLoad("max-frames-detach.html"); 8044 registerMockedHttpURLLoad("max-frames-detach.html");
8044 FrameTestHelpers::WebViewHelper webViewHelper; 8045 FrameTestHelpers::WebViewHelper webViewHelper;
8045 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); 8046 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true);
8046 webViewImpl->mainFrameImpl()->collectGarbage(); 8047 webViewImpl->mainFrameImpl()->collectGarbage();
8047 } 8048 }
8048 8049
8049 } // namespace blink 8050 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698