Title: [116686] trunk/Source/WebKit/chromium
- Revision
- 116686
- Author
- [email protected]
- Date
- 2012-05-10 14:14:12 -0700 (Thu, 10 May 2012)
Log Message
[Chromium] WebFrameTest.ChromePageNoJavascript isn't catching regressions
https://bugs.webkit.org/show_bug.cgi?id=86046
Reviewed by Adam Barth.
Test both cases for registerURLSchemeAsNotAllowingJavascriptURLs. Also add
a call to layout() to ensure the _javascript_ result is seen.
* tests/WebFrameTest.cpp:
(WebKit::TEST_F):
(WebKit):
Modified Paths
Diff
Modified: trunk/Source/WebKit/chromium/ChangeLog (116685 => 116686)
--- trunk/Source/WebKit/chromium/ChangeLog 2012-05-10 21:09:31 UTC (rev 116685)
+++ trunk/Source/WebKit/chromium/ChangeLog 2012-05-10 21:14:12 UTC (rev 116686)
@@ -1,3 +1,17 @@
+2012-05-10 Tom Sepez <[email protected]>
+
+ [Chromium] WebFrameTest.ChromePageNoJavascript isn't catching regressions
+ https://bugs.webkit.org/show_bug.cgi?id=86046
+
+ Reviewed by Adam Barth.
+
+ Test both cases for registerURLSchemeAsNotAllowingJavascriptURLs. Also add
+ a call to layout() to ensure the _javascript_ result is seen.
+
+ * tests/WebFrameTest.cpp:
+ (WebKit::TEST_F):
+ (WebKit):
+
2012-05-10 Varun Jain <[email protected]>
[chromium] Trigger context menu for long press gesture
Modified: trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp (116685 => 116686)
--- trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp 2012-05-10 21:09:31 UTC (rev 116685)
+++ trunk/Source/WebKit/chromium/tests/WebFrameTest.cpp 2012-05-10 21:14:12 UTC (rev 116686)
@@ -137,19 +137,40 @@
WebSearchableFormData searchableDataForm(forms[0]);
}
+TEST_F(WebFrameTest, ChromePageJavascript)
+{
+ registerMockedChromeURLLoad("history.html");
+
+ // Pass true to enable _javascript_.
+ WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
+
+ // Try to run JS against the chrome-style URL.
+ FrameTestHelpers::loadFrame(webView->mainFrame(), "_javascript_:document.body.appendChild(document.createTextNode('Clobbered'))");
+
+ // Required to see any updates in contentAsText.
+ webView->layout();
+
+ // Now retrieve the frame's text and ensure it was modified by running _javascript_.
+ std::string content = webView->mainFrame()->contentAsText(1024).utf8();
+ EXPECT_NE(std::string::npos, content.find("Clobbered"));
+}
+
TEST_F(WebFrameTest, ChromePageNoJavascript)
{
registerMockedChromeURLLoad("history.html");
+ /// Pass true to enable _javascript_.
WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_chromeURL + "history.html", true);
- // Try to run JS against the chrome-style URL.
+ // Try to run JS against the chrome-style URL after prohibiting it.
WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs("chrome");
FrameTestHelpers::loadFrame(webView->mainFrame(), "_javascript_:document.body.appendChild(document.createTextNode('Clobbered'))");
- // Now retrieve the frames text and see if it was clobbered.
+ // Required to see any updates in contentAsText.
+ webView->layout();
+
+ // Now retrieve the frame's text and ensure it wasn't modified by running _javascript_.
std::string content = webView->mainFrame()->contentAsText(1024).utf8();
- EXPECT_NE(std::string::npos, content.find("Simulated Chromium History Page"));
EXPECT_EQ(std::string::npos, content.find("Clobbered"));
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes