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

Side by Side Diff: sky/engine/core/css/invalidation/DescendantInvalidationSetTest.cpp

Issue 712173002: Remove StyleInvalidator machinery. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "core/css/invalidation/DescendantInvalidationSet.h"
7
8 #include <gtest/gtest.h>
9
10 using namespace blink;
11
12 namespace {
13
14 // Once we setWholeSubtreeInvalid, we should not keep the HashSets.
15 TEST(DescendantInvalidationSetTest, SubtreeInvalid_AddBefore)
16 {
17 RefPtr<DescendantInvalidationSet> set = DescendantInvalidationSet::create();
18 set->addClass("a");
19 set->setWholeSubtreeInvalid();
20
21 ASSERT_TRUE(set->isEmpty());
22 }
23
24 // Don't (re)create HashSets if we've already setWholeSubtreeInvalid.
25 TEST(DescendantInvalidationSetTest, SubtreeInvalid_AddAfter)
26 {
27 RefPtr<DescendantInvalidationSet> set = DescendantInvalidationSet::create();
28 set->setWholeSubtreeInvalid();
29 set->addTagName("a");
30
31 ASSERT_TRUE(set->isEmpty());
32 }
33
34 // No need to keep the HashSets when combining with a wholeSubtreeInvalid set.
35 TEST(DescendantInvalidationSetTest, SubtreeInvalid_Combine_1)
36 {
37 RefPtr<DescendantInvalidationSet> set1 = DescendantInvalidationSet::create() ;
38 RefPtr<DescendantInvalidationSet> set2 = DescendantInvalidationSet::create() ;
39
40 set1->addId("a");
41 set2->setWholeSubtreeInvalid();
42
43 set1->combine(*set2);
44
45 ASSERT_TRUE(set1->wholeSubtreeInvalid());
46 ASSERT_TRUE(set1->isEmpty());
47 }
48
49 // No need to add HashSets from combining set when we already have wholeSubtreeI nvalid.
50 TEST(DescendantInvalidationSetTest, SubtreeInvalid_Combine_2)
51 {
52 RefPtr<DescendantInvalidationSet> set1 = DescendantInvalidationSet::create() ;
53 RefPtr<DescendantInvalidationSet> set2 = DescendantInvalidationSet::create() ;
54
55 set1->setWholeSubtreeInvalid();
56 set2->addAttribute("a");
57
58 set1->combine(*set2);
59
60 ASSERT_TRUE(set1->wholeSubtreeInvalid());
61 ASSERT_TRUE(set1->isEmpty());
62 }
63
64 } // namespace
OLDNEW
« no previous file with comments | « sky/engine/core/css/invalidation/DescendantInvalidationSet.cpp ('k') | sky/engine/core/css/invalidation/StyleInvalidator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698