| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 | 579 |
| 580 TEST_F(RenderViewImplTest, DecideNavigationPolicy) { | 580 TEST_F(RenderViewImplTest, DecideNavigationPolicy) { |
| 581 WebUITestWebUIControllerFactory factory; | 581 WebUITestWebUIControllerFactory factory; |
| 582 WebUIControllerFactory::RegisterFactory(&factory); | 582 WebUIControllerFactory::RegisterFactory(&factory); |
| 583 | 583 |
| 584 DocumentState state; | 584 DocumentState state; |
| 585 state.set_navigation_state(NavigationStateImpl::CreateContentInitiated()); | 585 state.set_navigation_state(NavigationStateImpl::CreateContentInitiated()); |
| 586 | 586 |
| 587 // Navigations to normal HTTP URLs can be handled locally. | 587 // Navigations to normal HTTP URLs can be handled locally. |
| 588 blink::WebURLRequest request(GURL("http://foo.com")); | 588 blink::WebURLRequest request(GURL("http://foo.com")); |
| 589 request.setFetchRequestMode(blink::WebURLRequest::FetchRequestModeNavigate); |
| 590 request.setFetchCredentialsMode( |
| 591 blink::WebURLRequest::FetchCredentialsModeInclude); |
| 592 request.setFetchRedirectMode(blink::WebURLRequest::FetchRedirectModeManual); |
| 593 request.setFrameType(blink::WebURLRequest::FrameTypeTopLevel); |
| 589 blink::WebFrameClient::NavigationPolicyInfo policy_info(request); | 594 blink::WebFrameClient::NavigationPolicyInfo policy_info(request); |
| 590 policy_info.navigationType = blink::WebNavigationTypeLinkClicked; | 595 policy_info.navigationType = blink::WebNavigationTypeLinkClicked; |
| 591 policy_info.defaultPolicy = blink::WebNavigationPolicyCurrentTab; | 596 policy_info.defaultPolicy = blink::WebNavigationPolicyCurrentTab; |
| 592 blink::WebNavigationPolicy policy = frame()->decidePolicyForNavigation( | 597 blink::WebNavigationPolicy policy = frame()->decidePolicyForNavigation( |
| 593 policy_info); | 598 policy_info); |
| 594 if (!IsBrowserSideNavigationEnabled()) { | 599 if (!IsBrowserSideNavigationEnabled()) { |
| 595 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); | 600 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); |
| 596 } else { | 601 } else { |
| 597 // If this is a renderer-initiated navigation that just begun, it should | 602 // If this is a renderer-initiated navigation that just begun, it should |
| 598 // stop and be sent to the browser. | 603 // stop and be sent to the browser. |
| 599 EXPECT_EQ(blink::WebNavigationPolicyIgnore, policy); | 604 EXPECT_EQ(blink::WebNavigationPolicyHandledByClient, policy); |
| 600 | 605 |
| 601 // If this a navigation that is ready to commit, it should be handled | 606 // If this a navigation that is ready to commit, it should be handled |
| 602 // locally. | 607 // locally. |
| 603 request.setCheckForBrowserSideNavigation(false); | 608 request.setCheckForBrowserSideNavigation(false); |
| 604 policy = frame()->decidePolicyForNavigation(policy_info); | 609 policy = frame()->decidePolicyForNavigation(policy_info); |
| 605 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); | 610 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); |
| 606 } | 611 } |
| 607 | 612 |
| 608 // Verify that form posts to WebUI URLs will be sent to the browser process. | 613 // Verify that form posts to WebUI URLs will be sent to the browser process. |
| 609 blink::WebURLRequest form_request(GURL("chrome://foo")); | 614 blink::WebURLRequest form_request(GURL("chrome://foo")); |
| (...skipping 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2754 FROM_HERE, | 2759 FROM_HERE, |
| 2755 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2760 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2756 ExecuteJavaScriptForTests("debugger;"); | 2761 ExecuteJavaScriptForTests("debugger;"); |
| 2757 | 2762 |
| 2758 // CloseWhilePaused should resume execution and continue here. | 2763 // CloseWhilePaused should resume execution and continue here. |
| 2759 EXPECT_FALSE(IsPaused()); | 2764 EXPECT_FALSE(IsPaused()); |
| 2760 Detach(); | 2765 Detach(); |
| 2761 } | 2766 } |
| 2762 | 2767 |
| 2763 } // namespace content | 2768 } // namespace content |
| OLD | NEW |