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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 #include "public/web/WebTextCheckingResult.h" | 143 #include "public/web/WebTextCheckingResult.h" |
144 #include "public/web/WebViewClient.h" | 144 #include "public/web/WebViewClient.h" |
145 #include "testing/gmock/include/gmock/gmock.h" | 145 #include "testing/gmock/include/gmock/gmock.h" |
146 #include "testing/gtest/include/gtest/gtest.h" | 146 #include "testing/gtest/include/gtest/gtest.h" |
147 #include "v8/include/v8.h" | 147 #include "v8/include/v8.h" |
148 #include "web/TextFinder.h" | 148 #include "web/TextFinder.h" |
149 #include "web/WebLocalFrameImpl.h" | 149 #include "web/WebLocalFrameImpl.h" |
150 #include "web/WebRemoteFrameImpl.h" | 150 #include "web/WebRemoteFrameImpl.h" |
151 #include "web/WebViewImpl.h" | 151 #include "web/WebViewImpl.h" |
152 #include "web/tests/FrameTestHelpers.h" | 152 #include "web/tests/FrameTestHelpers.h" |
| 153 #include "web/tests/sim/SimDisplayItemList.h" |
| 154 #include "web/tests/sim/SimRequest.h" |
| 155 #include "web/tests/sim/SimTest.h" |
153 #include "wtf/Forward.h" | 156 #include "wtf/Forward.h" |
154 #include "wtf/PtrUtil.h" | 157 #include "wtf/PtrUtil.h" |
155 #include "wtf/dtoa/utils.h" | 158 #include "wtf/dtoa/utils.h" |
156 | 159 |
157 using blink::URLTestHelpers::toKURL; | 160 using blink::URLTestHelpers::toKURL; |
158 using blink::testing::runPendingTasks; | 161 using blink::testing::runPendingTasks; |
159 using testing::ElementsAre; | 162 using testing::ElementsAre; |
160 using testing::Mock; | 163 using testing::Mock; |
161 using testing::_; | 164 using testing::_; |
162 | 165 |
(...skipping 11136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11299 scrollableArea->mouseEnteredScrollbar(*scrollableArea->verticalScrollbar()); | 11302 scrollableArea->mouseEnteredScrollbar(*scrollableArea->verticalScrollbar()); |
11300 testing::runDelayedTasks(kMockOverlayFadeOutDelayMs); | 11303 testing::runDelayedTasks(kMockOverlayFadeOutDelayMs); |
11301 EXPECT_FALSE(scrollableArea->scrollbarsHidden()); | 11304 EXPECT_FALSE(scrollableArea->scrollbarsHidden()); |
11302 scrollableArea->mouseExitedScrollbar(*scrollableArea->verticalScrollbar()); | 11305 scrollableArea->mouseExitedScrollbar(*scrollableArea->verticalScrollbar()); |
11303 testing::runDelayedTasks(kMockOverlayFadeOutDelayMs); | 11306 testing::runDelayedTasks(kMockOverlayFadeOutDelayMs); |
11304 EXPECT_TRUE(scrollableArea->scrollbarsHidden()); | 11307 EXPECT_TRUE(scrollableArea->scrollbarsHidden()); |
11305 | 11308 |
11306 mockOverlayTheme.setOverlayScrollbarFadeOutDelay(0.0); | 11309 mockOverlayTheme.setOverlayScrollbarFadeOutDelay(0.0); |
11307 } | 11310 } |
11308 | 11311 |
| 11312 class WebFrameSimTest : public SimTest {}; |
| 11313 |
| 11314 TEST_F(WebFrameSimTest, DisplayNoneIFrameHasNoLayoutObjects) { |
| 11315 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 11316 SimRequest frameResource("https://example.com/frame.html", "text/html"); |
| 11317 |
| 11318 loadURL("https://example.com/test.html"); |
| 11319 mainResource.complete( |
| 11320 "<!DOCTYPE html>" |
| 11321 "<iframe src=frame.html style='display: none'></iframe>"); |
| 11322 frameResource.complete( |
| 11323 "<!DOCTYPE html>" |
| 11324 "<html><body>This is a visible iframe.</body></html>"); |
| 11325 |
| 11326 Element* element = document().querySelector("iframe"); |
| 11327 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element); |
| 11328 Document* iframeDoc = frameOwnerElement->contentDocument(); |
| 11329 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11330 |
| 11331 // Changing the display from 'none' -> 'block' should cause layout objects to |
| 11332 // appear. |
| 11333 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueBlock); |
| 11334 compositor().beginFrame(); |
| 11335 EXPECT_TRUE(iframeDoc->documentElement()->layoutObject()); |
| 11336 |
| 11337 // Changing the display from 'block' -> 'none' should cause layout objects to |
| 11338 // disappear. |
| 11339 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 11340 |
| 11341 compositor().beginFrame(); |
| 11342 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11343 } |
| 11344 |
| 11345 TEST_F(WebFrameSimTest, NormalIFrameHasLayoutObjects) { |
| 11346 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 11347 SimRequest frameResource("https://example.com/frame.html", "text/html"); |
| 11348 |
| 11349 loadURL("https://example.com/test.html"); |
| 11350 mainResource.complete( |
| 11351 "<!DOCTYPE html>" |
| 11352 "<iframe src=frame.html style='display: block'></iframe>"); |
| 11353 frameResource.complete( |
| 11354 "<!DOCTYPE html>" |
| 11355 "<html><body>This is a visible iframe.</body></html>"); |
| 11356 |
| 11357 Element* element = document().querySelector("iframe"); |
| 11358 HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(element); |
| 11359 Document* iframeDoc = frameOwnerElement->contentDocument(); |
| 11360 EXPECT_TRUE(iframeDoc->documentElement()->layoutObject()); |
| 11361 |
| 11362 // Changing the display from 'block' -> 'none' should cause layout objects to |
| 11363 // disappear. |
| 11364 element->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); |
| 11365 compositor().beginFrame(); |
| 11366 EXPECT_FALSE(iframeDoc->documentElement()->layoutObject()); |
| 11367 } |
| 11368 |
11309 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { | 11369 TEST_F(WebFrameTest, NoLoadingCompletionCallbacksInDetach) { |
11310 class LoadingObserverFrameClient | 11370 class LoadingObserverFrameClient |
11311 : public FrameTestHelpers::TestWebFrameClient { | 11371 : public FrameTestHelpers::TestWebFrameClient { |
11312 public: | 11372 public: |
11313 void frameDetached(WebLocalFrame*, DetachType) override { | 11373 void frameDetached(WebLocalFrame*, DetachType) override { |
11314 m_didCallFrameDetached = true; | 11374 m_didCallFrameDetached = true; |
11315 } | 11375 } |
11316 | 11376 |
11317 void didStopLoading() override { | 11377 void didStopLoading() override { |
11318 // TODO(dcheng): Investigate not calling this as well during frame detach. | 11378 // TODO(dcheng): Investigate not calling this as well during frame detach. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11499 EXPECT_FALSE(testSelectAll("<textarea></textarea>")); | 11559 EXPECT_FALSE(testSelectAll("<textarea></textarea>")); |
11500 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>")); | 11560 EXPECT_TRUE(testSelectAll("<textarea>nonempty</textarea>")); |
11501 EXPECT_FALSE(testSelectAll("<input>")); | 11561 EXPECT_FALSE(testSelectAll("<input>")); |
11502 EXPECT_TRUE(testSelectAll("<input value='nonempty'>")); | 11562 EXPECT_TRUE(testSelectAll("<input value='nonempty'>")); |
11503 // TODO(amaralp): Empty contenteditable should not have select all enabled. | 11563 // TODO(amaralp): Empty contenteditable should not have select all enabled. |
11504 EXPECT_TRUE(testSelectAll("<div contenteditable></div>")); | 11564 EXPECT_TRUE(testSelectAll("<div contenteditable></div>")); |
11505 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>")); | 11565 EXPECT_TRUE(testSelectAll("<div contenteditable>nonempty</div>")); |
11506 } | 11566 } |
11507 | 11567 |
11508 } // namespace blink | 11568 } // namespace blink |
OLD | NEW |