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 5707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5718 TestNavigationPolicyWebFrameClient client; | 5718 TestNavigationPolicyWebFrameClient client; |
5719 FrameTestHelpers::WebViewHelper webViewHelper; | 5719 FrameTestHelpers::WebViewHelper webViewHelper; |
5720 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); | 5720 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr
ue, &client); |
5721 | 5721 |
5722 Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame
())->document(); | 5722 Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame
())->document(); |
5723 KURL destination = document->url(); | 5723 KURL destination = document->url(); |
5724 destination.setFragmentIdentifier("test"); | 5724 destination.setFragmentIdentifier("test"); |
5725 | 5725 |
5726 Event* event = MouseEvent::create(EventTypeNames::click, false, false, | 5726 Event* event = MouseEvent::create(EventTypeNames::click, false, false, |
5727 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, PlatformEvent::NoModifiers,
1, 0, nullptr, 0, | 5727 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, PlatformEvent::NoModifiers,
1, 0, nullptr, 0, |
5728 PlatformMouseEvent::RealOrIndistinguishable, String()); | 5728 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); |
5729 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5729 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
5730 frameRequest.setTriggeringEvent(event); | 5730 frameRequest.setTriggeringEvent(event); |
5731 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(fr
ameRequest); | 5731 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(fr
ameRequest); |
5732 } | 5732 } |
5733 | 5733 |
5734 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { | 5734 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { |
5735 public: | 5735 public: |
5736 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, | 5736 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW
indowFeatures&, |
5737 const WebString&, WebNavigationPolicy, bool) override | 5737 const WebString&, WebNavigationPolicy, bool) override |
5738 { | 5738 { |
(...skipping 29 matching lines...) Expand all Loading... |
5768 TestNewWindowWebFrameClient webFrameClient; | 5768 TestNewWindowWebFrameClient webFrameClient; |
5769 FrameTestHelpers::WebViewHelper webViewHelper; | 5769 FrameTestHelpers::WebViewHelper webViewHelper; |
5770 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra
meClient, &webViewClient); | 5770 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra
meClient, &webViewClient); |
5771 | 5771 |
5772 Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame
())->document(); | 5772 Document* document = toLocalFrame(webViewHelper.webView()->page()->mainFrame
())->document(); |
5773 KURL destination = toKURL(m_baseURL + "hello_world.html"); | 5773 KURL destination = toKURL(m_baseURL + "hello_world.html"); |
5774 | 5774 |
5775 // ctrl+click event | 5775 // ctrl+click event |
5776 Event* event = MouseEvent::create(EventTypeNames::click, false, false, | 5776 Event* event = MouseEvent::create(EventTypeNames::click, false, false, |
5777 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, PlatformEvent::CtrlKey, 0, 0
, nullptr, 0, | 5777 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, PlatformEvent::CtrlKey, 0, 0
, nullptr, 0, |
5778 PlatformMouseEvent::RealOrIndistinguishable, String()); | 5778 PlatformMouseEvent::RealOrIndistinguishable, String(), nullptr); |
5779 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); | 5779 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); |
5780 frameRequest.setTriggeringEvent(event); | 5780 frameRequest.setTriggeringEvent(event); |
5781 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); | 5781 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); |
5782 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(fr
ameRequest); | 5782 toLocalFrame(webViewHelper.webView()->page()->mainFrame())->loader().load(fr
ameRequest); |
5783 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()-
>mainFrame()); | 5783 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()-
>mainFrame()); |
5784 | 5784 |
5785 // decidePolicyForNavigation should be called both for the original request
and the ctrl+click. | 5785 // decidePolicyForNavigation should be called both for the original request
and the ctrl+click. |
5786 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); | 5786 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); |
5787 } | 5787 } |
5788 | 5788 |
(...skipping 3149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8938 FrameTestHelpers::WebViewHelper helper; | 8938 FrameTestHelpers::WebViewHelper helper; |
8939 helper.initializeAndLoad(url, true); | 8939 helper.initializeAndLoad(url, true); |
8940 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); | 8940 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); |
8941 | 8941 |
8942 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do
cument(); | 8942 Document* document = toLocalFrame(helper.webView()->page()->mainFrame())->do
cument(); |
8943 EXPECT_TRUE(document->isImageDocument()); | 8943 EXPECT_TRUE(document->isImageDocument()); |
8944 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g
etStatus()); | 8944 EXPECT_EQ(Resource::DecodeError, toImageDocument(document)->cachedImage()->g
etStatus()); |
8945 } | 8945 } |
8946 | 8946 |
8947 } // namespace blink | 8947 } // namespace blink |
OLD | NEW |