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

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

Issue 2692993003: Invalidate throttling-related dirty bits when changing cross-origin status. (Closed)
Patch Set: none Created 3 years, 10 months 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
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptController.h" 5 #include "bindings/core/v8/ScriptController.h"
6 #include "bindings/core/v8/ScriptSourceCode.h" 6 #include "bindings/core/v8/ScriptSourceCode.h"
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 ->setScrollOffset(ScrollOffset(0, 480), ProgrammaticScroll); 419 ->setScrollOffset(ScrollOffset(0, 480), ProgrammaticScroll);
420 auto displayItems = compositeFrame(); 420 auto displayItems = compositeFrame();
421 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "red")); 421 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "red"));
422 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green")); 422 EXPECT_FALSE(displayItems.contains(SimCanvas::Rect, "green"));
423 423
424 // Make sure the new style shows up instead of the old one. 424 // Make sure the new style shows up instead of the old one.
425 auto displayItems2 = compositeFrame(); 425 auto displayItems2 = compositeFrame();
426 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green")); 426 EXPECT_TRUE(displayItems2.contains(SimCanvas::Rect, "green"));
427 } 427 }
428 428
429 TEST_P(FrameThrottlingTest, ChangeOriginInThrottledFrame) {
430 // Create a hidden frame which is throttled.
431 SimRequest mainResource("http://example.com/", "text/html");
432 SimRequest frameResource("http://sub.example.com/iframe.html", "text/html");
433 loadURL("http://example.com/");
434 mainResource.complete(
435 "<iframe style='position: absolute; top: 10000px' id=frame "
436 "src=http://sub.example.com/iframe.html></iframe>");
437 frameResource.complete("");
438
439 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
440
441 compositeFrame();
442
443 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering());
444 EXPECT_TRUE(
445 frameElement->contentDocument()->frame()->isCrossOriginSubframe());
446 EXPECT_FALSE(frameElement->contentDocument()
447 ->view()
448 ->layoutView()
449 ->needsPaintPropertyUpdate());
450
451 NonThrowableExceptionState exceptionState;
452
453 // Security policy requires setting domain on both frames.
454 document().setDomain(String("example.com"), exceptionState);
455 frameElement->contentDocument()->setDomain(String("example.com"),
456 exceptionState);
457
458 EXPECT_FALSE(
459 frameElement->contentDocument()->frame()->isCrossOriginSubframe());
460 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
461 EXPECT_TRUE(frameElement->contentDocument()
462 ->view()
463 ->layoutView()
464 ->needsPaintPropertyUpdate());
465 }
466
429 TEST_P(FrameThrottlingTest, ThrottledFrameWithFocus) { 467 TEST_P(FrameThrottlingTest, ThrottledFrameWithFocus) {
430 webView().settings()->setJavaScriptEnabled(true); 468 webView().settings()->setJavaScriptEnabled(true);
431 webView().settings()->setAcceleratedCompositingEnabled(true); 469 webView().settings()->setAcceleratedCompositingEnabled(true);
432 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true); 470 RuntimeEnabledFeatures::setCompositedSelectionUpdateEnabled(true);
433 471
434 // Create a hidden frame which is throttled and has a text selection. 472 // Create a hidden frame which is throttled and has a text selection.
435 SimRequest mainResource("https://example.com/", "text/html"); 473 SimRequest mainResource("https://example.com/", "text/html");
436 SimRequest frameResource("https://example.com/iframe.html", "text/html"); 474 SimRequest frameResource("https://example.com/iframe.html", "text/html");
437 475
438 loadURL("https://example.com/"); 476 loadURL("https://example.com/");
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 compositeFrame(); 1045 compositeFrame();
1008 EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); 1046 EXPECT_TRUE(frameDocument->view()->canThrottleRendering());
1009 1047
1010 // Setting display:none unthrottles the frame. 1048 // Setting display:none unthrottles the frame.
1011 frameElement->setAttribute(styleAttr, "display: none"); 1049 frameElement->setAttribute(styleAttr, "display: none");
1012 compositeFrame(); 1050 compositeFrame();
1013 EXPECT_FALSE(frameDocument->view()->canThrottleRendering()); 1051 EXPECT_FALSE(frameDocument->view()->canThrottleRendering());
1014 } 1052 }
1015 1053
1016 } // namespace blink 1054 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698