| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 #include "public/platform/WebURL.h" | 94 #include "public/platform/WebURL.h" |
| 95 #include "public/platform/WebURLResponse.h" | 95 #include "public/platform/WebURLResponse.h" |
| 96 #include "public/platform/WebUnitTestSupport.h" | 96 #include "public/platform/WebUnitTestSupport.h" |
| 97 #include "public/web/WebCache.h" | 97 #include "public/web/WebCache.h" |
| 98 #include "public/web/WebConsoleMessage.h" | 98 #include "public/web/WebConsoleMessage.h" |
| 99 #include "public/web/WebDataSource.h" | 99 #include "public/web/WebDataSource.h" |
| 100 #include "public/web/WebDocument.h" | 100 #include "public/web/WebDocument.h" |
| 101 #include "public/web/WebFindOptions.h" | 101 #include "public/web/WebFindOptions.h" |
| 102 #include "public/web/WebFormElement.h" | 102 #include "public/web/WebFormElement.h" |
| 103 #include "public/web/WebFrameClient.h" | 103 #include "public/web/WebFrameClient.h" |
| 104 #include "public/web/WebFrameWidget.h" |
| 104 #include "public/web/WebHistoryItem.h" | 105 #include "public/web/WebHistoryItem.h" |
| 105 #include "public/web/WebPrintParams.h" | 106 #include "public/web/WebPrintParams.h" |
| 106 #include "public/web/WebRange.h" | 107 #include "public/web/WebRange.h" |
| 107 #include "public/web/WebRemoteFrame.h" | 108 #include "public/web/WebRemoteFrame.h" |
| 108 #include "public/web/WebScriptExecutionCallback.h" | 109 #include "public/web/WebScriptExecutionCallback.h" |
| 109 #include "public/web/WebScriptSource.h" | 110 #include "public/web/WebScriptSource.h" |
| 110 #include "public/web/WebSearchableFormData.h" | 111 #include "public/web/WebSearchableFormData.h" |
| 111 #include "public/web/WebSecurityPolicy.h" | 112 #include "public/web/WebSecurityPolicy.h" |
| 112 #include "public/web/WebSelection.h" | 113 #include "public/web/WebSelection.h" |
| 113 #include "public/web/WebSettings.h" | 114 #include "public/web/WebSettings.h" |
| (...skipping 7470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7584 | 7585 |
| 7585 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. | 7586 // If an iframe has a remote main frame, ensure the inital commit is correct
ly identified as WebInitialCommitInChildFrame. |
| 7586 CommitTypeWebFrameClient childFrameClient; | 7587 CommitTypeWebFrameClient childFrameClient; |
| 7587 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); | 7588 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); |
| 7588 registerMockedHttpURLLoad("foo.html"); | 7589 registerMockedHttpURLLoad("foo.html"); |
| 7589 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); | 7590 FrameTestHelpers::loadFrame(childFrame, m_baseURL + "foo.html"); |
| 7590 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); | 7591 EXPECT_EQ(WebInitialCommitInChildFrame, childFrameClient.historyCommitType()
); |
| 7591 view->close(); | 7592 view->close(); |
| 7592 } | 7593 } |
| 7593 | 7594 |
| 7595 class GestureEventTestWebViewClient : public FrameTestHelpers::TestWebViewClient
{ |
| 7596 public: |
| 7597 GestureEventTestWebViewClient() : m_didHandleGestureEvent(false) { } |
| 7598 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled
) override { m_didHandleGestureEvent = true; } |
| 7599 bool didHandleGestureEvent() const { return m_didHandleGestureEvent; } |
| 7600 |
| 7601 private: |
| 7602 bool m_didHandleGestureEvent; |
| 7603 }; |
| 7604 |
| 7605 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) |
| 7606 { |
| 7607 FrameTestHelpers::TestWebViewClient viewClient; |
| 7608 WebView* view = WebView::create(&viewClient); |
| 7609 |
| 7610 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; |
| 7611 view->setMainFrame(remoteClient.frame()); |
| 7612 |
| 7613 FrameTestHelpers::TestWebFrameClient childFrameClient; |
| 7614 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc
alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient
, nullptr); |
| 7615 |
| 7616 GestureEventTestWebViewClient childViewClient; |
| 7617 WebFrameWidget* widget = WebFrameWidget::create(&childViewClient, childFrame
); |
| 7618 |
| 7619 view->resize(WebSize(1000, 1000)); |
| 7620 view->layout(); |
| 7621 |
| 7622 widget->handleInputEvent(fatTap(20, 20)); |
| 7623 EXPECT_TRUE(childViewClient.didHandleGestureEvent()); |
| 7624 |
| 7625 widget->close(); |
| 7626 view->close(); |
| 7627 } |
| 7628 |
| 7594 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ | 7629 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient
{ |
| 7595 public: | 7630 public: |
| 7596 MockDocumentThreadableLoaderClient() : m_failed(false) { } | 7631 MockDocumentThreadableLoaderClient() : m_failed(false) { } |
| 7597 void didFail(const ResourceError&) override { m_failed = true;} | 7632 void didFail(const ResourceError&) override { m_failed = true;} |
| 7598 | 7633 |
| 7599 void reset() { m_failed = false; } | 7634 void reset() { m_failed = false; } |
| 7600 bool failed() { return m_failed; } | 7635 bool failed() { return m_failed; } |
| 7601 | 7636 |
| 7602 bool m_failed; | 7637 bool m_failed; |
| 7603 }; | 7638 }; |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8035 | 8070 |
| 8036 TEST_F(WebFrameTest, MaxFramesDetach) | 8071 TEST_F(WebFrameTest, MaxFramesDetach) |
| 8037 { | 8072 { |
| 8038 registerMockedHttpURLLoad("max-frames-detach.html"); | 8073 registerMockedHttpURLLoad("max-frames-detach.html"); |
| 8039 FrameTestHelpers::WebViewHelper webViewHelper; | 8074 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8040 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 8075 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
| 8041 webViewImpl->mainFrameImpl()->collectGarbage(); | 8076 webViewImpl->mainFrameImpl()->collectGarbage(); |
| 8042 } | 8077 } |
| 8043 | 8078 |
| 8044 } // namespace blink | 8079 } // namespace blink |
| OLD | NEW |