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

Side by Side Diff: third_party/WebKit/Source/core/css/ActiveStyleSheetsTest.cpp

Issue 2843883002: Remove, or rewrite if necessary, tests which use /deep/ or ::shadow (Closed)
Patch Set: rev Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/css/ActiveStyleSheets.h" 5 #include "core/css/ActiveStyleSheets.h"
6 6
7 #include "bindings/core/v8/V8BindingForCore.h" 7 #include "bindings/core/v8/V8BindingForCore.h"
8 #include "core/css/CSSStyleSheet.h" 8 #include "core/css/CSSStyleSheet.h"
9 #include "core/css/MediaQueryEvaluator.h" 9 #include "core/css/MediaQueryEvaluator.h"
10 #include "core/css/StyleSheetContents.h" 10 #include "core/css/StyleSheetContents.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 new_style_sheets.push_back( 468 new_style_sheets.push_back(
469 std::make_pair(sheet, &sheet->Contents()->GetRuleSet())); 469 std::make_pair(sheet, &sheet->Contents()->GetRuleSet()));
470 470
471 GetStyleEngine().ApplyRuleSetChanges(shadow_root, ActiveStyleSheetVector(), 471 GetStyleEngine().ApplyRuleSetChanges(shadow_root, ActiveStyleSheetVector(),
472 new_style_sheets); 472 new_style_sheets);
473 473
474 EXPECT_FALSE(GetDocument().NeedsStyleRecalc()); 474 EXPECT_FALSE(GetDocument().NeedsStyleRecalc());
475 EXPECT_EQ(kSubtreeStyleChange, host->GetStyleChangeType()); 475 EXPECT_EQ(kSubtreeStyleChange, host->GetStyleChangeType());
476 } 476 }
477 477
478 TEST_F(ApplyRulesetsTest, AddShadowV0BoundaryCrossingRuleToDocument) {
479 GetDocument().View()->UpdateAllLifecyclePhases();
480
481 CSSStyleSheet* sheet = CreateSheet(".a /deep/ .b { color:red }");
482
483 ActiveStyleSheetVector new_style_sheets;
484 new_style_sheets.push_back(
485 std::make_pair(sheet, &sheet->Contents()->GetRuleSet()));
486
487 GetStyleEngine().ApplyRuleSetChanges(GetDocument(), ActiveStyleSheetVector(),
488 new_style_sheets);
489
490 EXPECT_EQ(kSubtreeStyleChange, GetDocument().GetStyleChangeType());
491 }
492
493 TEST_F(ApplyRulesetsTest, AddShadowV0BoundaryCrossingRuleToShadowTree) {
494 GetDocument().body()->setInnerHTML("<div id=host></div>");
495 Element* host = GetDocument().GetElementById("host");
496 ASSERT_TRUE(host);
497
498 ShadowRoot& shadow_root = AttachShadow(*host);
499 GetDocument().View()->UpdateAllLifecyclePhases();
500
501 CSSStyleSheet* sheet = CreateSheet(".a /deep/ .b { color:red }");
502
503 ActiveStyleSheetVector new_style_sheets;
504 new_style_sheets.push_back(
505 std::make_pair(sheet, &sheet->Contents()->GetRuleSet()));
506
507 GetStyleEngine().ApplyRuleSetChanges(shadow_root, ActiveStyleSheetVector(),
508 new_style_sheets);
509
510 EXPECT_FALSE(GetDocument().NeedsStyleRecalc());
511 EXPECT_EQ(kSubtreeStyleChange, host->GetStyleChangeType());
512 }
513
514 TEST_F(ApplyRulesetsTest, AddFontFaceRuleToDocument) { 478 TEST_F(ApplyRulesetsTest, AddFontFaceRuleToDocument) {
515 GetDocument().View()->UpdateAllLifecyclePhases(); 479 GetDocument().View()->UpdateAllLifecyclePhases();
516 480
517 CSSStyleSheet* sheet = 481 CSSStyleSheet* sheet =
518 CreateSheet("@font-face { font-family: ahum; src: url(ahum.ttf) }"); 482 CreateSheet("@font-face { font-family: ahum; src: url(ahum.ttf) }");
519 483
520 ActiveStyleSheetVector new_style_sheets; 484 ActiveStyleSheetVector new_style_sheets;
521 new_style_sheets.push_back( 485 new_style_sheets.push_back(
522 std::make_pair(sheet, &sheet->Contents()->GetRuleSet())); 486 std::make_pair(sheet, &sheet->Contents()->GetRuleSet()));
523 487
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 ActiveStyleSheetVector old_style_sheets; 535 ActiveStyleSheetVector old_style_sheets;
572 old_style_sheets.push_back( 536 old_style_sheets.push_back(
573 std::make_pair(css_sheet, &css_sheet->Contents()->GetRuleSet())); 537 std::make_pair(css_sheet, &css_sheet->Contents()->GetRuleSet()));
574 GetStyleEngine().ApplyRuleSetChanges(shadow_root, old_style_sheets, 538 GetStyleEngine().ApplyRuleSetChanges(shadow_root, old_style_sheets,
575 ActiveStyleSheetVector()); 539 ActiveStyleSheetVector());
576 540
577 EXPECT_TRUE(GetStyleEngine().TreeBoundaryCrossingScopes().IsEmpty()); 541 EXPECT_TRUE(GetStyleEngine().TreeBoundaryCrossingScopes().IsEmpty());
578 } 542 }
579 543
580 } // namespace blink 544 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/dom/custom-elements.html ('k') | third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698