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

Unified Diff: chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc

Issue 2099563002: WebUI: DisallowJavascript only on Refresh and non-same-page navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test Created 4 years, 6 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 | « no previous file | content/browser/webui/web_ui_impl.h » ('j') | content/browser/webui/web_ui_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc
diff --git a/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc b/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc
index f054a8138bacc13ad5f19903376645b435b4c793..68b64afe518ce8a7352758d7609504f1916bb021 100644
--- a/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/settings/md_settings_ui_browsertest.cc
@@ -60,3 +60,23 @@ IN_PROC_BROWSER_TEST_F(MdSettingsUITest, ToggleJavaScript) {
handler->AllowJavascriptForTesting();
}
}
+
+IN_PROC_BROWSER_TEST_F(MdSettingsUITest, InPageNavigations) {
+ NavigateToURL(browser(), GURL(chrome::kChromeUIMdSettingsURL));
+
+ auto handlers = browser()->tab_strip_model()->GetActiveWebContents()
+ ->GetWebUI()->GetHandlersForTesting();
+ for (content::WebUIMessageHandler* handler : *handlers) {
Charlie Reis 2016/06/25 00:02:19 nit: No braces needed. Same below.
tommycli 2016/06/25 00:12:17 Done.
+ handler->AllowJavascriptForTesting();
+ }
+
+ // Push onto window.history. Back should now be an in-page navigation.
+ ASSERT_TRUE(content::ExecuteScript(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ "window.history.pushState({}, '', 'foo.html')"));
+ chrome::GoBack(browser(), CURRENT_TAB);
Charlie Reis 2016/06/25 00:02:19 You might need to use WaitForLoadStop to avoid fla
tommycli 2016/06/25 00:12:17 I didn't detect any flakiness on my machine (the t
+
+ for (content::WebUIMessageHandler* handler : *handlers) {
+ EXPECT_TRUE(handler->IsJavascriptAllowed());
+ }
+}
« no previous file with comments | « no previous file | content/browser/webui/web_ui_impl.h » ('j') | content/browser/webui/web_ui_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698