| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "content/browser/frame_host/navigation_entry_impl.h" | 10 #include "content/browser/frame_host/navigation_entry_impl.h" |
| (...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 // Test that a direct navigation to a view-source URL works. | 773 // Test that a direct navigation to a view-source URL works. |
| 774 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ViewSourceDirectNavigation) { | 774 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, ViewSourceDirectNavigation) { |
| 775 ASSERT_TRUE(embedded_test_server()->Start()); | 775 ASSERT_TRUE(embedded_test_server()->Start()); |
| 776 const GURL kUrl(embedded_test_server()->GetURL("/simple_page.html")); | 776 const GURL kUrl(embedded_test_server()->GetURL("/simple_page.html")); |
| 777 const GURL kViewSourceURL(kViewSourceScheme + std::string(":") + kUrl.spec()); | 777 const GURL kViewSourceURL(kViewSourceScheme + std::string(":") + kUrl.spec()); |
| 778 NavigateToURL(shell(), kViewSourceURL); | 778 NavigateToURL(shell(), kViewSourceURL); |
| 779 // Displayed view-source URLs don't include the scheme of the effective URL if | 779 // Displayed view-source URLs don't include the scheme of the effective URL if |
| 780 // the effective URL is HTTP. (e.g. view-source:example.com is displayed | 780 // the effective URL is HTTP. (e.g. view-source:example.com is displayed |
| 781 // instead of view-source:http://example.com). | 781 // instead of view-source:http://example.com). |
| 782 EXPECT_EQ(base::ASCIIToUTF16(std::string("view-source:") + kUrl.host() + ":" + | 782 EXPECT_EQ(base::ASCIIToUTF16(std::string("view-source:") + kUrl.host() + ":" + |
| 783 kUrl.port() + kUrl.path()), | 783 kUrl.port() + kUrl.path().as_string()), |
| 784 shell()->web_contents()->GetTitle()); | 784 shell()->web_contents()->GetTitle()); |
| 785 EXPECT_TRUE(shell() | 785 EXPECT_TRUE(shell() |
| 786 ->web_contents() | 786 ->web_contents() |
| 787 ->GetController() | 787 ->GetController() |
| 788 .GetLastCommittedEntry() | 788 .GetLastCommittedEntry() |
| 789 ->IsViewSourceMode()); | 789 ->IsViewSourceMode()); |
| 790 } | 790 } |
| 791 | 791 |
| 792 // Test that window.open to a view-source URL is blocked. | 792 // Test that window.open to a view-source URL is blocked. |
| 793 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, | 793 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 // Make sure the WebContents cleaned up the previous pending request. A new | 1298 // Make sure the WebContents cleaned up the previous pending request. A new |
| 1299 // request should be forwarded to the WebContentsDelegate. | 1299 // request should be forwarded to the WebContentsDelegate. |
| 1300 delegate.get()->request_to_lock_mouse_called_ = false; | 1300 delegate.get()->request_to_lock_mouse_called_ = false; |
| 1301 ASSERT_TRUE(ExecuteScript(shell(), | 1301 ASSERT_TRUE(ExecuteScript(shell(), |
| 1302 "window.domAutomationController.send(document.body." | 1302 "window.domAutomationController.send(document.body." |
| 1303 "requestPointerLock());")); | 1303 "requestPointerLock());")); |
| 1304 EXPECT_TRUE(delegate.get()->request_to_lock_mouse_called_); | 1304 EXPECT_TRUE(delegate.get()->request_to_lock_mouse_called_); |
| 1305 } | 1305 } |
| 1306 | 1306 |
| 1307 } // namespace content | 1307 } // namespace content |
| OLD | NEW |