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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 23710021: Merge 157196 "Don't wait to notify client of spoof attempt if a ..." (Closed) Base URL: svn://svn.chromium.org/blink/branches/chromium/1599/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/PageGroupLoadDeferrer.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
===================================================================
--- Source/web/tests/WebFrameTest.cpp (revision 157485)
+++ Source/web/tests/WebFrameTest.cpp (working copy)
@@ -3323,6 +3323,39 @@
m_webView = 0;
}
+TEST_F(WebFrameTest, DidAccessInitialDocumentBodyBeforeModalDialog)
+{
+ TestAccessInitialDocumentWebFrameClient webFrameClient;
+ m_webView = FrameTestHelpers::createWebView(true, &webFrameClient);
+ runPendingTasks();
+ EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
+
+ // Create another window that will try to access it.
+ WebView* newView = FrameTestHelpers::createWebView(true);
+ newView->mainFrame()->setOpener(m_webView->mainFrame());
+ runPendingTasks();
+ EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
+
+ // Access the initial document by modifying the body. We normally set a
+ // timer to notify the client.
+ newView->mainFrame()->executeScript(
+ WebScriptSource("window.opener.document.body.innerHTML += 'Modified';"));
+ EXPECT_FALSE(webFrameClient.m_didAccessInitialDocument);
+
+ // Make sure that a modal dialog forces us to notify right away.
+ newView->mainFrame()->executeScript(
+ WebScriptSource("window.opener.confirm('Modal');"));
+ EXPECT_TRUE(webFrameClient.m_didAccessInitialDocument);
+
+ // Ensure that we don't notify again later.
+ runPendingTasks();
+ EXPECT_TRUE(webFrameClient.m_didAccessInitialDocument);
+
+ newView->close();
+ m_webView->close();
+ m_webView = 0;
+}
+
class TestMainFrameUserOrProgrammaticScrollFrameClient : public WebFrameClient {
public:
TestMainFrameUserOrProgrammaticScrollFrameClient() { reset(); }
« no previous file with comments | « Source/core/page/PageGroupLoadDeferrer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698