| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 5488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5499 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5499 registerMockedHttpURLLoad("fragment_middle_click.html"); |
| 5500 TestNavigationPolicyWebFrameClient client; | 5500 TestNavigationPolicyWebFrameClient client; |
| 5501 FrameTestHelpers::WebViewHelper webViewHelper; | 5501 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5502 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); | 5502 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); |
| 5503 | 5503 |
| 5504 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 5504 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
| 5505 KURL destination = document->url(); | 5505 KURL destination = document->url(); |
| 5506 destination.setFragmentIdentifier("test"); | 5506 destination.setFragmentIdentifier("test"); |
| 5507 | 5507 |
| 5508 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, | 5508 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, |
| 5509 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false,
1, nullptr, nullptr); | 5509 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false,
1, 0, nullptr, nullptr); |
| 5510 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5510 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
| 5511 frameRequest.setTriggeringEvent(event); | 5511 frameRequest.setTriggeringEvent(event); |
| 5512 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); | 5512 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); |
| 5513 } | 5513 } |
| 5514 | 5514 |
| 5515 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { | 5515 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { |
| 5516 public: | 5516 public: |
| 5517 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, | 5517 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, |
| 5518 const WebString&, WebNavigationPolicy, bool) override | 5518 const WebString&, WebNavigationPolicy, bool) override |
| 5519 { | 5519 { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 5548 TestNewWindowWebViewClient webViewClient; | 5548 TestNewWindowWebViewClient webViewClient; |
| 5549 TestNewWindowWebFrameClient webFrameClient; | 5549 TestNewWindowWebFrameClient webFrameClient; |
| 5550 FrameTestHelpers::WebViewHelper webViewHelper; | 5550 FrameTestHelpers::WebViewHelper webViewHelper; |
| 5551 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra
meClient, &webViewClient); | 5551 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra
meClient, &webViewClient); |
| 5552 | 5552 |
| 5553 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 5553 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
| 5554 KURL destination = toKURL(m_baseURL + "hello_world.html"); | 5554 KURL destination = toKURL(m_baseURL + "hello_world.html"); |
| 5555 | 5555 |
| 5556 // ctrl+click event | 5556 // ctrl+click event |
| 5557 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, | 5557 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, |
| 5558 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0
, nullptr, nullptr); | 5558 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0
, 0, nullptr, nullptr); |
| 5559 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5559 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
| 5560 frameRequest.setTriggeringEvent(event); | 5560 frameRequest.setTriggeringEvent(event); |
| 5561 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 5561 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
| 5562 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); | 5562 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); |
| 5563 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF
rame()); | 5563 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF
rame()); |
| 5564 | 5564 |
| 5565 // decidePolicyForNavigation should be called both for the original request
and the ctrl+click. | 5565 // decidePolicyForNavigation should be called both for the original request
and the ctrl+click. |
| 5566 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); | 5566 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); |
| 5567 } | 5567 } |
| 5568 | 5568 |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6924 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6924 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 6925 | 6925 |
| 6926 // Neither should a page reload. | 6926 // Neither should a page reload. |
| 6927 localFrame->reload(); | 6927 localFrame->reload(); |
| 6928 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 6928 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
| 6929 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 6929 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
| 6930 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6930 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
| 6931 } | 6931 } |
| 6932 | 6932 |
| 6933 } // namespace | 6933 } // namespace |
| OLD | NEW |