Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 | 53 |
| 54 auto handlers = browser()->tab_strip_model()->GetActiveWebContents() | 54 auto handlers = browser()->tab_strip_model()->GetActiveWebContents() |
| 55 ->GetWebUI()->GetHandlersForTesting(); | 55 ->GetWebUI()->GetHandlersForTesting(); |
| 56 | 56 |
| 57 for (content::WebUIMessageHandler* handler : *handlers) { | 57 for (content::WebUIMessageHandler* handler : *handlers) { |
| 58 handler->AllowJavascriptForTesting(); | 58 handler->AllowJavascriptForTesting(); |
| 59 handler->DisallowJavascript(); | 59 handler->DisallowJavascript(); |
| 60 handler->AllowJavascriptForTesting(); | 60 handler->AllowJavascriptForTesting(); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | |
| 64 IN_PROC_BROWSER_TEST_F(MdSettingsUITest, InPageNavigations) { | |
| 65 NavigateToURL(browser(), GURL(chrome::kChromeUIMdSettingsURL)); | |
| 66 | |
| 67 auto handlers = browser()->tab_strip_model()->GetActiveWebContents() | |
| 68 ->GetWebUI()->GetHandlersForTesting(); | |
| 69 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.
| |
| 70 handler->AllowJavascriptForTesting(); | |
| 71 } | |
| 72 | |
| 73 // Push onto window.history. Back should now be an in-page navigation. | |
| 74 ASSERT_TRUE(content::ExecuteScript( | |
| 75 browser()->tab_strip_model()->GetActiveWebContents(), | |
| 76 "window.history.pushState({}, '', 'foo.html')")); | |
| 77 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
| |
| 78 | |
| 79 for (content::WebUIMessageHandler* handler : *handlers) { | |
| 80 EXPECT_TRUE(handler->IsJavascriptAllowed()); | |
| 81 } | |
| 82 } | |
| OLD | NEW |