OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_commands.h" | 7 #include "chrome/browser/ui/browser_commands.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 9 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 ->tab_strip_model() | 71 ->tab_strip_model() |
72 ->GetActiveWebContents() | 72 ->GetActiveWebContents() |
73 ->GetWebUI() | 73 ->GetWebUI() |
74 ->AddMessageHandler(test_handler); | 74 ->AddMessageHandler(test_handler); |
75 test_handler->AllowJavascriptForTesting(); | 75 test_handler->AllowJavascriptForTesting(); |
76 | 76 |
77 // Push onto window.history. Back should now be an in-page navigation. | 77 // Push onto window.history. Back should now be an in-page navigation. |
78 ASSERT_TRUE(content::ExecuteScript( | 78 ASSERT_TRUE(content::ExecuteScript( |
79 browser()->tab_strip_model()->GetActiveWebContents(), | 79 browser()->tab_strip_model()->GetActiveWebContents(), |
80 "window.history.pushState({}, '', 'foo.html')")); | 80 "window.history.pushState({}, '', 'foo.html')")); |
81 chrome::GoBack(browser(), CURRENT_TAB); | 81 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); |
82 content::WaitForLoadStop( | 82 content::WaitForLoadStop( |
83 browser()->tab_strip_model()->GetActiveWebContents()); | 83 browser()->tab_strip_model()->GetActiveWebContents()); |
84 | 84 |
85 // Test handler should still have JavaScript allowed after in-page navigation. | 85 // Test handler should still have JavaScript allowed after in-page navigation. |
86 EXPECT_TRUE(test_handler->IsJavascriptAllowed()); | 86 EXPECT_TRUE(test_handler->IsJavascriptAllowed()); |
87 | 87 |
88 chrome::Reload(browser(), CURRENT_TAB); | 88 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
89 content::WaitForLoadStop( | 89 content::WaitForLoadStop( |
90 browser()->tab_strip_model()->GetActiveWebContents()); | 90 browser()->tab_strip_model()->GetActiveWebContents()); |
91 | 91 |
92 // Verify that after a reload, the test handler has been disallowed. | 92 // Verify that after a reload, the test handler has been disallowed. |
93 EXPECT_FALSE(test_handler->IsJavascriptAllowed()); | 93 EXPECT_FALSE(test_handler->IsJavascriptAllowed()); |
94 } | 94 } |
OLD | NEW |