| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 #include "public/web/WebTextCheckingCompletion.h" | 133 #include "public/web/WebTextCheckingCompletion.h" |
| 134 #include "public/web/WebTextCheckingResult.h" | 134 #include "public/web/WebTextCheckingResult.h" |
| 135 #include "public/web/WebViewClient.h" | 135 #include "public/web/WebViewClient.h" |
| 136 #include "testing/gmock/include/gmock/gmock.h" | 136 #include "testing/gmock/include/gmock/gmock.h" |
| 137 #include "testing/gtest/include/gtest/gtest.h" | 137 #include "testing/gtest/include/gtest/gtest.h" |
| 138 #include "web/TextFinder.h" | 138 #include "web/TextFinder.h" |
| 139 #include "web/WebLocalFrameImpl.h" | 139 #include "web/WebLocalFrameImpl.h" |
| 140 #include "web/WebRemoteFrameImpl.h" | 140 #include "web/WebRemoteFrameImpl.h" |
| 141 #include "web/WebViewImpl.h" | 141 #include "web/WebViewImpl.h" |
| 142 #include "web/tests/FrameTestHelpers.h" | 142 #include "web/tests/FrameTestHelpers.h" |
| 143 #include "web/tests/sim/SimDisplayItemList.h" |
| 144 #include "web/tests/sim/SimRequest.h" |
| 145 #include "web/tests/sim/SimTest.h" |
| 143 #include "wtf/Forward.h" | 146 #include "wtf/Forward.h" |
| 144 #include "wtf/PtrUtil.h" | 147 #include "wtf/PtrUtil.h" |
| 145 #include "wtf/dtoa/utils.h" | 148 #include "wtf/dtoa/utils.h" |
| 146 #include <map> | 149 #include <map> |
| 147 #include <memory> | 150 #include <memory> |
| 148 #include <stdarg.h> | 151 #include <stdarg.h> |
| 149 #include <v8.h> | 152 #include <v8.h> |
| 150 | 153 |
| 151 using blink::URLTestHelpers::toKURL; | 154 using blink::URLTestHelpers::toKURL; |
| 152 using blink::testing::runPendingTasks; | 155 using blink::testing::runPendingTasks; |
| (...skipping 11011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11164 webViewHelper.initializeAndLoad(m_baseURL + "frameset-repeated-name.html"); | 11167 webViewHelper.initializeAndLoad(m_baseURL + "frameset-repeated-name.html"); |
| 11165 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); | 11168 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); |
| 11166 HashSet<AtomicString> names; | 11169 HashSet<AtomicString> names; |
| 11167 for (Frame* frame = mainFrame->tree().firstChild(); frame; | 11170 for (Frame* frame = mainFrame->tree().firstChild(); frame; |
| 11168 frame = frame->tree().traverseNext()) { | 11171 frame = frame->tree().traverseNext()) { |
| 11169 EXPECT_TRUE(names.insert(frame->tree().uniqueName()).isNewEntry); | 11172 EXPECT_TRUE(names.insert(frame->tree().uniqueName()).isNewEntry); |
| 11170 } | 11173 } |
| 11171 EXPECT_EQ(10u, names.size()); | 11174 EXPECT_EQ(10u, names.size()); |
| 11172 } | 11175 } |
| 11173 | 11176 |
| 11177 class WebFrameSimTest : public SimTest {}; |
| 11178 |
| 11179 TEST_F(WebFrameSimTest, DisplayNoneIFrameHasNoLayoutObjects) { |
| 11180 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 11181 SimRequest frameResource("https://example.com/frame.html", "text/html"); |
| 11182 |
| 11183 loadURL("https://example.com/test.html"); |
| 11184 mainResource.complete( |
| 11185 "<!DOCTYPE html>" |
| 11186 "<iframe src=frame.html style='display: none'></iframe>"); |
| 11187 frameResource.complete( |
| 11188 "<!DOCTYPE html>" |
| 11189 "<html><body>This is a visible iframe.</body></html>"); |
| 11190 |
| 11191 Element* element = document().querySelector("iframe"); |
| 11192 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element); |
| 11193 Document* iframeDoc = frameOwnerElement->contentDocument(); |
| 11194 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11195 |
| 11196 // Changing the display from 'none' -> 'block' should cause layout objects to |
| 11197 // appear. |
| 11198 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock); |
| 11199 compositor().beginFrame(); |
| 11200 EXPECT_TRUE(iframeDoc->documentElement()->layoutObject()); |
| 11201 |
| 11202 // Changing the display from 'block' -> 'none' should cause layout objects to |
| 11203 // disappear. |
| 11204 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 11205 |
| 11206 compositor().beginFrame(); |
| 11207 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11208 } |
| 11209 |
| 11210 TEST_F(WebFrameSimTest, NormalIFrameHasLayoutObjects) { |
| 11211 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 11212 SimRequest frameResource("https://example.com/frame.html", "text/html"); |
| 11213 |
| 11214 loadURL("https://example.com/test.html"); |
| 11215 mainResource.complete( |
| 11216 "<!DOCTYPE html>" |
| 11217 "<iframe src=frame.html style='display: block'></iframe>"); |
| 11218 frameResource.complete( |
| 11219 "<!DOCTYPE html>" |
| 11220 "<html><body>This is a visible iframe.</body></html>"); |
| 11221 |
| 11222 Element* element = document().querySelector("iframe"); |
| 11223 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element); |
| 11224 Document* iframeDoc = frameOwnerElement->contentDocument(); |
| 11225 EXPECT_TRUE(iframeDoc->documentElement()->layoutObject()); |
| 11226 |
| 11227 // Changing the display from 'block' -> 'none' should cause layout objects to |
| 11228 // disappear. |
| 11229 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 11230 compositor().beginFrame(); |
| 11231 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11232 } |
| 11233 |
| 11174 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { | 11234 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { |
| 11175 class LoadingObserverFrameClient | 11235 class LoadingObserverFrameClient |
| 11176 : public FrameTestHelpers::TestWebFrameClient { | 11236 : public FrameTestHelpers::TestWebFrameClient { |
| 11177 public: | 11237 public: |
| 11178 void frameDetached(WebLocalFrame*, DetachType) override { | 11238 void frameDetached(WebLocalFrame*, DetachType) override { |
| 11179 m_didCallFrameDetached = true; | 11239 m_didCallFrameDetached = true; |
| 11180 } | 11240 } |
| 11181 | 11241 |
| 11182 void didStopLoading() override { | 11242 void didStopLoading() override { |
| 11183 // TODO(dcheng): Investigate not calling this as well during frame detach. | 11243 // TODO(dcheng): Investigate not calling this as well during frame detach. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11257 | 11317 |
| 11258 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11318 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11259 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11319 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11260 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11320 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11261 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11321 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11262 | 11322 |
| 11263 webViewHelper.reset(); | 11323 webViewHelper.reset(); |
| 11264 } | 11324 } |
| 11265 | 11325 |
| 11266 } // namespace blink | 11326 } // namespace blink |
| OLD | NEW |