| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 #include "public/web/WebTextCheckingResult.h" | 141 #include "public/web/WebTextCheckingResult.h" |
| 142 #include "public/web/WebViewClient.h" | 142 #include "public/web/WebViewClient.h" |
| 143 #include "testing/gmock/include/gmock/gmock.h" | 143 #include "testing/gmock/include/gmock/gmock.h" |
| 144 #include "testing/gtest/include/gtest/gtest.h" | 144 #include "testing/gtest/include/gtest/gtest.h" |
| 145 #include "v8/include/v8.h" | 145 #include "v8/include/v8.h" |
| 146 #include "web/TextFinder.h" | 146 #include "web/TextFinder.h" |
| 147 #include "web/WebLocalFrameImpl.h" | 147 #include "web/WebLocalFrameImpl.h" |
| 148 #include "web/WebRemoteFrameImpl.h" | 148 #include "web/WebRemoteFrameImpl.h" |
| 149 #include "web/WebViewImpl.h" | 149 #include "web/WebViewImpl.h" |
| 150 #include "web/tests/FrameTestHelpers.h" | 150 #include "web/tests/FrameTestHelpers.h" |
| 151 #include "web/tests/sim/SimDisplayItemList.h" |
| 152 #include "web/tests/sim/SimRequest.h" |
| 153 #include "web/tests/sim/SimTest.h" |
| 151 #include "wtf/Forward.h" | 154 #include "wtf/Forward.h" |
| 152 #include "wtf/PtrUtil.h" | 155 #include "wtf/PtrUtil.h" |
| 153 #include "wtf/dtoa/utils.h" | 156 #include "wtf/dtoa/utils.h" |
| 154 | 157 |
| 155 using blink::URLTestHelpers::toKURL; | 158 using blink::URLTestHelpers::toKURL; |
| 156 using blink::testing::runPendingTasks; | 159 using blink::testing::runPendingTasks; |
| 157 using testing::ElementsAre; | 160 using testing::ElementsAre; |
| 158 using testing::Mock; | 161 using testing::Mock; |
| 159 using testing::_; | 162 using testing::_; |
| 160 | 163 |
| (...skipping 11147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11308 webViewHelper.initializeAndLoad(m_baseURL + "frameset-repeated-name.html"); | 11311 webViewHelper.initializeAndLoad(m_baseURL + "frameset-repeated-name.html"); |
| 11309 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 11312 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 11310 HashSet<AtomicString> names; | 11313 HashSet<AtomicString> names; |
| 11311 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 11314 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
| 11312 frame = frame->tree().traverseNext()) { | 11315 frame = frame->tree().traverseNext()) { |
| 11313 EXPECT_TRUE(names.insert(frame->tree().uniqueName()).isNewEntry); | 11316 EXPECT_TRUE(names.insert(frame->tree().uniqueName()).isNewEntry); |
| 11314 } | 11317 } |
| 11315 EXPECT_EQ(10u, names.size()); | 11318 EXPECT_EQ(10u, names.size()); |
| 11316 } | 11319 } |
| 11317 | 11320 |
| 11321 class WebFrameSimTest : public SimTest {}; |
| 11322 |
| 11323 TEST_F(WebFrameSimTest, DisplayNoneIFrameHasNoLayoutObjects) { |
| 11324 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 11325 SimRequest frameResource("https://example.com/frame.html", "text/html"); |
| 11326 |
| 11327 loadURL("https://example.com/test.html"); |
| 11328 mainResource.complete( |
| 11329 "<!DOCTYPE html>" |
| 11330 "<iframe src=frame.html style='display: none'></iframe>"); |
| 11331 frameResource.complete( |
| 11332 "<!DOCTYPE html>" |
| 11333 "<html><body>This is a visible iframe.</body></html>"); |
| 11334 |
| 11335 Element* element = document().querySelector("iframe"); |
| 11336 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element); |
| 11337 Document* iframeDoc = frameOwnerElement->contentDocument(); |
| 11338 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11339 |
| 11340 // Changing the display from 'none' -> 'block' should cause layout objects to |
| 11341 // appear. |
| 11342 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock); |
| 11343 compositor().beginFrame(); |
| 11344 EXPECT_TRUE(iframeDoc->documentElement()->layoutObject()); |
| 11345 |
| 11346 // Changing the display from 'block' -> 'none' should cause layout objects to |
| 11347 // disappear. |
| 11348 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 11349 |
| 11350 compositor().beginFrame(); |
| 11351 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11352 } |
| 11353 |
| 11354 TEST_F(WebFrameSimTest, NormalIFrameHasLayoutObjects) { |
| 11355 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 11356 SimRequest frameResource("https://example.com/frame.html", "text/html"); |
| 11357 |
| 11358 loadURL("https://example.com/test.html"); |
| 11359 mainResource.complete( |
| 11360 "<!DOCTYPE html>" |
| 11361 "<iframe src=frame.html style='display: block'></iframe>"); |
| 11362 frameResource.complete( |
| 11363 "<!DOCTYPE html>" |
| 11364 "<html><body>This is a visible iframe.</body></html>"); |
| 11365 |
| 11366 Element* element = document().querySelector("iframe"); |
| 11367 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element); |
| 11368 Document* iframeDoc = frameOwnerElement->contentDocument(); |
| 11369 EXPECT_TRUE(iframeDoc->documentElement()->layoutObject()); |
| 11370 |
| 11371 // Changing the display from 'block' -> 'none' should cause layout objects to |
| 11372 // disappear. |
| 11373 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 11374 compositor().beginFrame(); |
| 11375 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11376 } |
| 11377 |
| 11318 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { | 11378 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { |
| 11319 class LoadingObserverFrameClient | 11379 class LoadingObserverFrameClient |
| 11320 : public FrameTestHelpers::TestWebFrameClient { | 11380 : public FrameTestHelpers::TestWebFrameClient { |
| 11321 public: | 11381 public: |
| 11322 void frameDetached(WebLocalFrame*, DetachType) override { | 11382 void frameDetached(WebLocalFrame*, DetachType) override { |
| 11323 m_didCallFrameDetached = true; | 11383 m_didCallFrameDetached = true; |
| 11324 } | 11384 } |
| 11325 | 11385 |
| 11326 void didStopLoading() override { | 11386 void didStopLoading() override { |
| 11327 // TODO(dcheng): Investigate not calling this as well during frame detach. | 11387 // TODO(dcheng): Investigate not calling this as well during frame detach. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11458 "document.querySelector('input').focus();")); | 11518 "document.querySelector('input').focus();")); |
| 11459 | 11519 |
| 11460 // Verify that the right WebWidgetClient has been notified. | 11520 // Verify that the right WebWidgetClient has been notified. |
| 11461 EXPECT_TRUE(webWidgetClient.didShowVirtualKeyboard()); | 11521 EXPECT_TRUE(webWidgetClient.didShowVirtualKeyboard()); |
| 11462 | 11522 |
| 11463 remoteFrame->close(); | 11523 remoteFrame->close(); |
| 11464 webViewHelper.reset(); | 11524 webViewHelper.reset(); |
| 11465 } | 11525 } |
| 11466 | 11526 |
| 11467 } // namespace blink | 11527 } // namespace blink |
| OLD | NEW |