OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 4202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4213 ScopedPageSuspender suspender2; | 4213 ScopedPageSuspender suspender2; |
4214 EXPECT_TRUE(webView->page()->suspended()); | 4214 EXPECT_TRUE(webView->page()->suspended()); |
4215 } | 4215 } |
4216 | 4216 |
4217 EXPECT_TRUE(webView->page()->suspended()); | 4217 EXPECT_TRUE(webView->page()->suspended()); |
4218 } | 4218 } |
4219 | 4219 |
4220 EXPECT_FALSE(webView->page()->suspended()); | 4220 EXPECT_FALSE(webView->page()->suspended()); |
4221 } | 4221 } |
4222 | 4222 |
| 4223 TEST_P(WebViewTest, ClosingPageIsSuspended) { |
| 4224 WebViewImpl* webView = m_webViewHelper.initialize(); |
| 4225 Page* page = m_webViewHelper.webView()->page(); |
| 4226 EXPECT_FALSE(page->suspended()); |
| 4227 |
| 4228 webView->setOpenedByDOM(); |
| 4229 |
| 4230 LocalFrame* mainFrame = toLocalFrame(page->mainFrame()); |
| 4231 EXPECT_FALSE(mainFrame->domWindow()->closed()); |
| 4232 |
| 4233 mainFrame->domWindow()->close(nullptr); |
| 4234 // The window should be marked closed... |
| 4235 EXPECT_TRUE(mainFrame->domWindow()->closed()); |
| 4236 // EXPECT_TRUE(page->isClosing()); |
| 4237 // ...but not yet detached. |
| 4238 EXPECT_TRUE(mainFrame->host()); |
| 4239 |
| 4240 { |
| 4241 ScopedPageSuspender suspender; |
| 4242 EXPECT_TRUE(page->suspended()); |
| 4243 } |
| 4244 } |
| 4245 |
4223 TEST_P(WebViewTest, ForceAndResetViewport) { | 4246 TEST_P(WebViewTest, ForceAndResetViewport) { |
4224 URLTestHelpers::registerMockedURLFromBaseURL( | 4247 URLTestHelpers::registerMockedURLFromBaseURL( |
4225 WebString::fromUTF8(m_baseURL.c_str()), | 4248 WebString::fromUTF8(m_baseURL.c_str()), |
4226 WebString::fromUTF8("200-by-300.html")); | 4249 WebString::fromUTF8("200-by-300.html")); |
4227 WebViewImpl* webViewImpl = | 4250 WebViewImpl* webViewImpl = |
4228 m_webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html"); | 4251 m_webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html"); |
4229 webViewImpl->resize(WebSize(100, 150)); | 4252 webViewImpl->resize(WebSize(100, 150)); |
4230 webViewImpl->layerTreeView()->setViewportSize(WebSize(100, 150)); | 4253 webViewImpl->layerTreeView()->setViewportSize(WebSize(100, 150)); |
4231 VisualViewport* visualViewport = | 4254 VisualViewport* visualViewport = |
4232 &webViewImpl->page()->frameHost().visualViewport(); | 4255 &webViewImpl->page()->frameHost().visualViewport(); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4355 .translate(50, 55) | 4378 .translate(50, 55) |
4356 .scale(1. / 2.f); | 4379 .scale(1. / 2.f); |
4357 EXPECT_EQ(expectedMatrix, | 4380 EXPECT_EQ(expectedMatrix, |
4358 webViewImpl->getDeviceEmulationTransformForTesting()); | 4381 webViewImpl->getDeviceEmulationTransformForTesting()); |
4359 // visibleContentRect doesn't change. | 4382 // visibleContentRect doesn't change. |
4360 EXPECT_EQ(IntRect(50, 55, 50, 75), | 4383 EXPECT_EQ(IntRect(50, 55, 50, 75), |
4361 *devToolsEmulator->visibleContentRectForPainting()); | 4384 *devToolsEmulator->visibleContentRectForPainting()); |
4362 } | 4385 } |
4363 | 4386 |
4364 } // namespace blink | 4387 } // namespace blink |
OLD | NEW |