Chromium Code Reviews| 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..b86a704beaa9f064410240b1f24c7b2e9aa07ab8 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,33 @@ IN_PROC_BROWSER_TEST_F(MdSettingsUITest, ToggleJavaScript) { |
| handler->AllowJavascriptForTesting(); |
| } |
| } |
| + |
| +IN_PROC_BROWSER_TEST_F(MdSettingsUITest, InPageNavigationsAndReload) { |
| + NavigateToURL(browser(), GURL(chrome::kChromeUIMdSettingsURL)); |
| + |
| + auto handlers = browser()->tab_strip_model()->GetActiveWebContents() |
| + ->GetWebUI()->GetHandlersForTesting(); |
| + for (content::WebUIMessageHandler* handler : *handlers) |
| + 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); |
| + WaitForLoadStop(browser()->tab_strip_model()->GetActiveWebContents()); |
| + |
| + for (content::WebUIMessageHandler* handler : *handlers) |
| + EXPECT_TRUE(handler->IsJavascriptAllowed()); |
| + |
| + chrome::Reload(browser(), CURRENT_TAB); |
| + WaitForLoadStop(browser()->tab_strip_model()->GetActiveWebContents()); |
| + |
| + // Verify that after a reload, at least some of the handlers are disallowed. |
|
Charlie Reis
2016/06/25 00:17:02
I'm not sure I understand this. Wouldn't all of t
tommycli
2016/06/25 00:21:51
Some of the handlers only are used on subpages. Th
tommycli
2016/06/25 00:22:50
I'm trying to test that on Reload, the handlers ar
Charlie Reis
2016/06/27 21:31:31
Hmm. Would the list of enabled handlers match the
tommycli
2016/06/27 21:56:08
Ah yes. Using the test handler was the best sugges
|
| + bool all_handlers_allowed = true; |
| + for (content::WebUIMessageHandler* handler : *handlers) { |
| + if (!handler->IsJavascriptAllowed()) |
| + all_handlers_allowed = false; |
| + } |
| + EXPECT_FALSE(all_handlers_allowed); |
| +} |