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 5480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5491 registerMockedHttpURLLoad("fragment_middle_click.html"); | 5491 registerMockedHttpURLLoad("fragment_middle_click.html"); |
5492 TestNavigationPolicyWebFrameClient client; | 5492 TestNavigationPolicyWebFrameClient client; |
5493 FrameTestHelpers::WebViewHelper webViewHelper; | 5493 FrameTestHelpers::WebViewHelper webViewHelper; |
5494 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); | 5494 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); |
5495 | 5495 |
5496 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 5496 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
5497 KURL destination = document->url(); | 5497 KURL destination = document->url(); |
5498 destination.setFragmentIdentifier("test"); | 5498 destination.setFragmentIdentifier("test"); |
5499 | 5499 |
5500 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, | 5500 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, |
5501 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false,
1, nullptr, nullptr); | 5501 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false,
1, 0, nullptr, nullptr); |
5502 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5502 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
5503 frameRequest.setTriggeringEvent(event); | 5503 frameRequest.setTriggeringEvent(event); |
5504 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); | 5504 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); |
5505 } | 5505 } |
5506 | 5506 |
5507 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { | 5507 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { |
5508 public: | 5508 public: |
5509 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, | 5509 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, |
5510 const WebString&, WebNavigationPolicy, bool) override | 5510 const WebString&, WebNavigationPolicy, bool) override |
5511 { | 5511 { |
(...skipping 28 matching lines...) Expand all Loading... |
5540 TestNewWindowWebViewClient webViewClient; | 5540 TestNewWindowWebViewClient webViewClient; |
5541 TestNewWindowWebFrameClient webFrameClient; | 5541 TestNewWindowWebFrameClient webFrameClient; |
5542 FrameTestHelpers::WebViewHelper webViewHelper; | 5542 FrameTestHelpers::WebViewHelper webViewHelper; |
5543 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra
meClient, &webViewClient); | 5543 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra
meClient, &webViewClient); |
5544 | 5544 |
5545 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); | 5545 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF
rame())->document(); |
5546 KURL destination = toKURL(m_baseURL + "hello_world.html"); | 5546 KURL destination = toKURL(m_baseURL + "hello_world.html"); |
5547 | 5547 |
5548 // ctrl+click event | 5548 // ctrl+click event |
5549 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, | 5549 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click,
false, false, |
5550 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0
, nullptr, nullptr); | 5550 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0
, 0, nullptr, nullptr); |
5551 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5551 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
5552 frameRequest.setTriggeringEvent(event); | 5552 frameRequest.setTriggeringEvent(event); |
5553 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 5553 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
5554 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); | 5554 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa
d(frameRequest); |
5555 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF
rame()); | 5555 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF
rame()); |
5556 | 5556 |
5557 // decidePolicyForNavigation should be called both for the original request
and the ctrl+click. | 5557 // decidePolicyForNavigation should be called both for the original request
and the ctrl+click. |
5558 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); | 5558 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); |
5559 } | 5559 } |
5560 | 5560 |
(...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6916 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6916 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
6917 | 6917 |
6918 // Neither should a page reload. | 6918 // Neither should a page reload. |
6919 localFrame->reload(); | 6919 localFrame->reload(); |
6920 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); | 6920 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); |
6921 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); | 6921 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); |
6922 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); | 6922 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); |
6923 } | 6923 } |
6924 | 6924 |
6925 } // namespace | 6925 } // namespace |
OLD | NEW |