OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 10 matching lines...) Expand all Loading... |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
| 31 #include "core/loader/FrameLoadRequest.h" |
31 #include "core/page/Page.h" | 32 #include "core/page/Page.h" |
32 #include "public/web/WebFrameClient.h" | 33 #include "public/web/WebFrameClient.h" |
33 #include "public/web/WebInputEvent.h" | 34 #include "public/web/WebInputEvent.h" |
34 #include "public/web/WebLocalFrame.h" | 35 #include "public/web/WebLocalFrame.h" |
35 #include "public/web/WebView.h" | 36 #include "public/web/WebView.h" |
36 #include "public/web/WebViewClient.h" | 37 #include "public/web/WebViewClient.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "web/WebLocalFrameImpl.h" |
38 #include "web/WebViewImpl.h" | 40 #include "web/WebViewImpl.h" |
39 #include "web/tests/FrameTestHelpers.h" | 41 #include "web/tests/FrameTestHelpers.h" |
40 | 42 |
41 namespace blink { | 43 namespace blink { |
42 | 44 |
43 void setCurrentInputEventForTest(const WebInputEvent* event) | 45 void setCurrentInputEventForTest(const WebInputEvent* event) |
44 { | 46 { |
45 WebViewImpl::m_currentInputEvent = event; | 47 WebViewImpl::m_currentInputEvent = event; |
46 } | 48 } |
47 | 49 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 250 } |
249 | 251 |
250 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) | 252 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) |
251 { | 253 { |
252 m_chromeClientImpl->setResizable(false); | 254 m_chromeClientImpl->setResizable(false); |
253 EXPECT_TRUE(isNavigationPolicyPopup()); | 255 EXPECT_TRUE(isNavigationPolicyPopup()); |
254 m_chromeClientImpl->setResizable(true); | 256 m_chromeClientImpl->setResizable(true); |
255 EXPECT_FALSE(isNavigationPolicyPopup()); | 257 EXPECT_FALSE(isNavigationPolicyPopup()); |
256 } | 258 } |
257 | 259 |
| 260 class ViewCreatingClient : public FrameTestHelpers::TestWebViewClient { |
| 261 public: |
| 262 WebView* createView(WebLocalFrame* opener, const WebURLRequest&, const WebWi
ndowFeatures&, const WebString& name, WebNavigationPolicy, bool) override |
| 263 { |
| 264 return m_webViewHelper.initializeWithOpener(opener, true); |
| 265 } |
| 266 |
| 267 private: |
| 268 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 269 }; |
| 270 |
| 271 class CreateWindowTest : public testing::Test { |
| 272 protected: |
| 273 void SetUp() override |
| 274 { |
| 275 m_webView = toWebViewImpl(WebView::create(&m_webViewClient, WebPageVisib
ilityStateVisible)); |
| 276 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr
ameClient); |
| 277 m_webView->setMainFrame(m_mainFrame); |
| 278 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient
()); |
| 279 } |
| 280 |
| 281 void TearDown() override |
| 282 { |
| 283 m_webView->close(); |
| 284 m_mainFrame->close(); |
| 285 } |
| 286 |
| 287 ViewCreatingClient m_webViewClient; |
| 288 WebViewImpl* m_webView; |
| 289 WebFrame* m_mainFrame; |
| 290 FrameTestHelpers::TestWebFrameClient m_webFrameClient; |
| 291 Persistent<ChromeClientImpl> m_chromeClientImpl; |
| 292 }; |
| 293 |
| 294 TEST_F(CreateWindowTest, CreateWindowFromDeferredPage) |
| 295 { |
| 296 m_webView->page()->setDefersLoading(true); |
| 297 LocalFrame* frame = toWebLocalFrameImpl(m_mainFrame)->frame(); |
| 298 FrameLoadRequest request(frame->document()); |
| 299 WindowFeatures features; |
| 300 EXPECT_EQ(nullptr, m_chromeClientImpl->createWindow(frame, request, features
, NavigationPolicyNewForegroundTab)); |
| 301 m_webView->page()->setDefersLoading(false); |
| 302 } |
| 303 |
258 } // namespace blink | 304 } // namespace blink |
OLD | NEW |