| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 577 |
| 578 TEST_F(RenderViewImplTest, DecideNavigationPolicy) { | 578 TEST_F(RenderViewImplTest, DecideNavigationPolicy) { |
| 579 WebUITestWebUIControllerFactory factory; | 579 WebUITestWebUIControllerFactory factory; |
| 580 WebUIControllerFactory::RegisterFactory(&factory); | 580 WebUIControllerFactory::RegisterFactory(&factory); |
| 581 | 581 |
| 582 DocumentState state; | 582 DocumentState state; |
| 583 state.set_navigation_state(NavigationStateImpl::CreateContentInitiated()); | 583 state.set_navigation_state(NavigationStateImpl::CreateContentInitiated()); |
| 584 | 584 |
| 585 // Navigations to normal HTTP URLs can be handled locally. | 585 // Navigations to normal HTTP URLs can be handled locally. |
| 586 blink::WebURLRequest request(GURL("http://foo.com")); | 586 blink::WebURLRequest request(GURL("http://foo.com")); |
| 587 request.setFetchRequestMode(blink::WebURLRequest::FetchRequestModeNavigate); |
| 588 request.setFetchCredentialsMode( |
| 589 blink::WebURLRequest::FetchCredentialsModeInclude); |
| 590 request.setFetchRedirectMode(blink::WebURLRequest::FetchRedirectModeManual); |
| 591 request.setFrameType(blink::WebURLRequest::FrameTypeTopLevel); |
| 587 blink::WebFrameClient::NavigationPolicyInfo policy_info(request); | 592 blink::WebFrameClient::NavigationPolicyInfo policy_info(request); |
| 588 policy_info.navigationType = blink::WebNavigationTypeLinkClicked; | 593 policy_info.navigationType = blink::WebNavigationTypeLinkClicked; |
| 589 policy_info.defaultPolicy = blink::WebNavigationPolicyCurrentTab; | 594 policy_info.defaultPolicy = blink::WebNavigationPolicyCurrentTab; |
| 590 blink::WebNavigationPolicy policy = frame()->decidePolicyForNavigation( | 595 blink::WebNavigationPolicy policy = frame()->decidePolicyForNavigation( |
| 591 policy_info); | 596 policy_info); |
| 592 if (!IsBrowserSideNavigationEnabled()) { | 597 if (!IsBrowserSideNavigationEnabled()) { |
| 593 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); | 598 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); |
| 594 } else { | 599 } else { |
| 595 // If this is a renderer-initiated navigation that just begun, it should | 600 // If this is a renderer-initiated navigation that just begun, it should |
| 596 // stop and be sent to the browser. | 601 // stop and be sent to the browser. |
| 597 EXPECT_EQ(blink::WebNavigationPolicyIgnore, policy); | 602 EXPECT_EQ(blink::WebNavigationPolicyHandledByClient, policy); |
| 598 | 603 |
| 599 // If this a navigation that is ready to commit, it should be handled | 604 // If this a navigation that is ready to commit, it should be handled |
| 600 // locally. | 605 // locally. |
| 601 request.setCheckForBrowserSideNavigation(false); | 606 request.setCheckForBrowserSideNavigation(false); |
| 602 policy = frame()->decidePolicyForNavigation(policy_info); | 607 policy = frame()->decidePolicyForNavigation(policy_info); |
| 603 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); | 608 EXPECT_EQ(blink::WebNavigationPolicyCurrentTab, policy); |
| 604 } | 609 } |
| 605 | 610 |
| 606 // Verify that form posts to WebUI URLs will be sent to the browser process. | 611 // Verify that form posts to WebUI URLs will be sent to the browser process. |
| 607 blink::WebURLRequest form_request(GURL("chrome://foo")); | 612 blink::WebURLRequest form_request(GURL("chrome://foo")); |
| (...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2745 FROM_HERE, | 2750 FROM_HERE, |
| 2746 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); | 2751 base::Bind(&DevToolsAgentTest::CloseWhilePaused, base::Unretained(this))); |
| 2747 ExecuteJavaScriptForTests("debugger;"); | 2752 ExecuteJavaScriptForTests("debugger;"); |
| 2748 | 2753 |
| 2749 // CloseWhilePaused should resume execution and continue here. | 2754 // CloseWhilePaused should resume execution and continue here. |
| 2750 EXPECT_FALSE(IsPaused()); | 2755 EXPECT_FALSE(IsPaused()); |
| 2751 Detach(); | 2756 Detach(); |
| 2752 } | 2757 } |
| 2753 | 2758 |
| 2754 } // namespace content | 2759 } // namespace content |
| OLD | NEW |