Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2580703003: Make sure pages that are closing but not yet closed are still suspended. (Closed)
Patch Set: revert no longer needed test change Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 4092 matching lines...) Expand 10 before | Expand all | Expand 10 after
4103 ScopedPageSuspender suspender2; 4103 ScopedPageSuspender suspender2;
4104 EXPECT_TRUE(webView->page()->suspended()); 4104 EXPECT_TRUE(webView->page()->suspended());
4105 } 4105 }
4106 4106
4107 EXPECT_TRUE(webView->page()->suspended()); 4107 EXPECT_TRUE(webView->page()->suspended());
4108 } 4108 }
4109 4109
4110 EXPECT_FALSE(webView->page()->suspended()); 4110 EXPECT_FALSE(webView->page()->suspended());
4111 } 4111 }
4112 4112
4113 TEST_P(WebViewTest, ClosingPageIsSuspended) {
4114 WebViewImpl* webView = m_webViewHelper.initialize();
4115 Page* page = m_webViewHelper.webView()->page();
4116 EXPECT_FALSE(page->suspended());
4117
4118 webView->setOpenedByDOM();
4119
4120 LocalFrame* mainFrame = toLocalFrame(page->mainFrame());
4121 EXPECT_FALSE(mainFrame->domWindow()->closed());
4122
4123 mainFrame->domWindow()->close(nullptr);
4124 // The window should be marked closed...
4125 EXPECT_TRUE(mainFrame->domWindow()->closed());
4126 // EXPECT_TRUE(page->isClosing());
4127 // ...but not yet detached.
4128 EXPECT_TRUE(mainFrame->host());
4129
4130 {
4131 ScopedPageSuspender suspender;
4132 EXPECT_TRUE(page->suspended());
4133 }
4134 }
4135
4113 TEST_P(WebViewTest, ForceAndResetViewport) { 4136 TEST_P(WebViewTest, ForceAndResetViewport) {
4114 URLTestHelpers::registerMockedURLFromBaseURL( 4137 URLTestHelpers::registerMockedURLFromBaseURL(
4115 WebString::fromUTF8(m_baseURL.c_str()), 4138 WebString::fromUTF8(m_baseURL.c_str()),
4116 WebString::fromUTF8("200-by-300.html")); 4139 WebString::fromUTF8("200-by-300.html"));
4117 WebViewImpl* webViewImpl = 4140 WebViewImpl* webViewImpl =
4118 m_webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html"); 4141 m_webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html");
4119 webViewImpl->resize(WebSize(100, 150)); 4142 webViewImpl->resize(WebSize(100, 150));
4120 webViewImpl->layerTreeView()->setViewportSize(WebSize(100, 150)); 4143 webViewImpl->layerTreeView()->setViewportSize(WebSize(100, 150));
4121 VisualViewport* visualViewport = 4144 VisualViewport* visualViewport =
4122 &webViewImpl->page()->frameHost().visualViewport(); 4145 &webViewImpl->page()->frameHost().visualViewport();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4245 .translate(50, 55) 4268 .translate(50, 55)
4246 .scale(1. / 2.f); 4269 .scale(1. / 2.f);
4247 EXPECT_EQ(expectedMatrix, 4270 EXPECT_EQ(expectedMatrix,
4248 webViewImpl->getDeviceEmulationTransformForTesting()); 4271 webViewImpl->getDeviceEmulationTransformForTesting());
4249 // visibleContentRect doesn't change. 4272 // visibleContentRect doesn't change.
4250 EXPECT_EQ(IntRect(50, 55, 50, 75), 4273 EXPECT_EQ(IntRect(50, 55, 50, 75),
4251 *devToolsEmulator->visibleContentRectForPainting()); 4274 *devToolsEmulator->visibleContentRectForPainting());
4252 } 4275 }
4253 4276
4254 } // namespace blink 4277 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698