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 MockTestWebViewClient : public FrameTestHelpers::TestWebViewClient { | |
dcheng
2015/08/31 16:51:20
MockTestWebViewClient -> GestureEventTestWebViewCl
Peng
2015/08/31 17:34:58
Done.
| |
7596 public: | |
7597 MockTestWebViewClient() : m_didHandleGestureEvent(false) { } | |
7598 void didHandleGestureEvent(const WebGestureEvent& event, bool eventCancelled ) override { m_didHandleGestureEvent = true; } | |
7599 bool didHandleGestureEvent() { return m_didHandleGestureEvent; } | |
dcheng
2015/08/31 16:51:20
Nit: const
Peng
2015/08/31 17:34:57
Done.
| |
7600 bool m_didHandleGestureEvent; | |
dcheng
2015/08/31 16:51:20
And make this private.
Peng
2015/08/31 17:34:57
Done.
| |
7601 }; | |
7602 | |
7603 TEST_P(ParameterizedWebFrameTest, FrameWidgetTest) | |
7604 { | |
7605 FrameTestHelpers::TestWebViewClient viewClient; | |
7606 WebView* view = WebView::create(&viewClient); | |
7607 | |
7608 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; | |
7609 view->setMainFrame(remoteClient.frame()); | |
7610 | |
7611 FrameTestHelpers::TestWebFrameClient childFrameClient; | |
7612 WebLocalFrame* childFrame = view->mainFrame()->toWebRemoteFrame()->createLoc alChild(WebTreeScopeType::Document, "", WebSandboxFlags::None, &childFrameClient , nullptr); | |
7613 | |
7614 MockTestWebViewClient childViewClient; | |
7615 WebFrameWidget* widget = WebFrameWidget::create(&childViewClient, childFrame ); | |
7616 | |
7617 view->resize(WebSize(1000, 1000)); | |
7618 view->layout(); | |
7619 | |
7620 widget->handleInputEvent(fatTap(20, 20)); | |
7621 EXPECT_TRUE(childViewClient.didHandleGestureEvent()); | |
7622 | |
7623 widget->close(); | |
7624 view->close(); | |
7625 } | |
7626 | |
7594 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient { | 7627 class MockDocumentThreadableLoaderClient : public DocumentThreadableLoaderClient { |
7595 public: | 7628 public: |
7596 MockDocumentThreadableLoaderClient() : m_failed(false) { } | 7629 MockDocumentThreadableLoaderClient() : m_failed(false) { } |
7597 void didFail(const ResourceError&) override { m_failed = true;} | 7630 void didFail(const ResourceError&) override { m_failed = true;} |
7598 | 7631 |
7599 void reset() { m_failed = false; } | 7632 void reset() { m_failed = false; } |
7600 bool failed() { return m_failed; } | 7633 bool failed() { return m_failed; } |
7601 | 7634 |
7602 bool m_failed; | 7635 bool m_failed; |
7603 }; | 7636 }; |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8035 | 8068 |
8036 TEST_F(WebFrameTest, MaxFramesDetach) | 8069 TEST_F(WebFrameTest, MaxFramesDetach) |
8037 { | 8070 { |
8038 registerMockedHttpURLLoad("max-frames-detach.html"); | 8071 registerMockedHttpURLLoad("max-frames-detach.html"); |
8039 FrameTestHelpers::WebViewHelper webViewHelper; | 8072 FrameTestHelpers::WebViewHelper webViewHelper; |
8040 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); | 8073 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max- frames-detach.html", true); |
8041 webViewImpl->mainFrameImpl()->collectGarbage(); | 8074 webViewImpl->mainFrameImpl()->collectGarbage(); |
8042 } | 8075 } |
8043 | 8076 |
8044 } // namespace blink | 8077 } // namespace blink |
OLD | NEW |